Skip to content

Commit

Permalink
Add gen-self-signed-cert.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
clcain committed Oct 12, 2019
1 parent 0ceaf48 commit 37e852f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -26,10 +26,10 @@ To set up the HTTPS reverse proxy for your site, copy the [example configuration

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.

## Notes
## Self signed certificates

If you want to generate your own SSL key for testing, you can do so with OpenSSL. You must rename the files accordingly.
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.

```
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes -subj '/CN=example.com'
bash gen-self-signed-cert.sh [domain name]
```
6 changes: 6 additions & 0 deletions gen-cert.sh
@@ -1,3 +1,9 @@
#!/bin/bash

if [ -z $1 ]
then
echo "Usage: bash gen-cert.sh [domain name]"
exit 1
fi

docker exec -ti nginx-https-proxy_app_1 certbot --nginx --no-redirect -d $1
14 changes: 14 additions & 0 deletions gen-self-signed-cert.sh
@@ -0,0 +1,14 @@
#!/bin/bash

if [ -z $1 ]
then
echo "Usage: bash gen-self-signed-cert.sh [domain name]"
exit 1
fi

sudo mkdir -p letsencrypt/live/$1/

sudo openssl req -x509 -newkey rsa:4096 \
-keyout letsencrypt/live/$1/privkey.pem \
-out letsencrypt/live/$1/fullchain.pem \
-days 365 -nodes -subj '/CN=$1'

0 comments on commit 37e852f

Please sign in to comment.