Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
starting changes to get automatic certificates working
- Loading branch information
Showing
7 changed files
with
54 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#! /bin/bash | ||
# taken and slightly modified from https://www.metachris.com/2015/12/comparison-of-10-acme-lets-encrypt-clients/ | ||
|
||
# Create a directory for the keys and cert | ||
DOMAIN=expfactory.org | ||
cd /etc/ssl/certs | ||
|
||
# backup old key and cert | ||
cp domain.key{,.bak.$(date +%s)} | ||
cp chained.pem{,.bak.$(date +%s)} | ||
|
||
# Generate a private key | ||
openssl genrsa 4096 > account.key | ||
|
||
# Generate a domain private key (if you haven't already) | ||
openssl genrsa 4096 > domain.key | ||
|
||
# Create a CSR for $DOMAIN | ||
openssl req -new -sha256 -key domain.key -subj "/CN=$DOMAIN" > domain.csr | ||
|
||
# Create the challenge folder in the webroot | ||
mkdir -p /var/www/.well-known/acme-challenge/ | ||
|
||
# Get a signed certificate with acme-tiny | ||
python /opt/acme-tiny/acme_tiny.py --account-key ./account.key --csr ./domain.csr --acme-dir /var/www/.well-known/acme-challenge/ > ./signed.crt | ||
|
||
wget -O - https://letsencrypt.org/certs/lets-encrypt-x3-cross-signed.pem > intermediate.pem | ||
cat signed.crt intermediate.pem > chained.pem | ||
|
||
# Restart nginx container | ||
cd $HOME/expfactory-docker | ||
docker-compose restart nginx |