Skip to content

Commit 37e852f

Browse files
committed
Add gen-self-signed-cert.sh
1 parent 0ceaf48 commit 37e852f

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ To set up the HTTPS reverse proxy for your site, copy the [example configuration
2626

2727
Running the service is as easy as `docker-compose up` (or `docker-compose up --build` if you recently changed the `sites-enabled` directory. You may also run `bash start.sh` to start the service for you.
2828

29-
## Notes
29+
## Self signed certificates
3030

31-
If you want to generate your own SSL key for testing, you can do so with OpenSSL. You must rename the files accordingly.
31+
If you want to generate a self signed certficate, you can use the `gen-self-signed-cert.sh` script to do so using OpenSSL. OpenSSL must be installed for this script to work.
3232

3333
```
34-
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes -subj '/CN=example.com'
34+
bash gen-self-signed-cert.sh [domain name]
3535
```

gen-cert.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
#!/bin/bash
22

3+
if [ -z $1 ]
4+
then
5+
echo "Usage: bash gen-cert.sh [domain name]"
6+
exit 1
7+
fi
8+
39
docker exec -ti nginx-https-proxy_app_1 certbot --nginx --no-redirect -d $1

gen-self-signed-cert.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
if [ -z $1 ]
4+
then
5+
echo "Usage: bash gen-self-signed-cert.sh [domain name]"
6+
exit 1
7+
fi
8+
9+
sudo mkdir -p letsencrypt/live/$1/
10+
11+
sudo openssl req -x509 -newkey rsa:4096 \
12+
-keyout letsencrypt/live/$1/privkey.pem \
13+
-out letsencrypt/live/$1/fullchain.pem \
14+
-days 365 -nodes -subj '/CN=$1'

0 commit comments

Comments
 (0)