Last active
December 13, 2017 16:03
-
-
Save kopiro/c89f709c9ba8d90fe7672f000db53565 to your computer and use it in GitHub Desktop.
SSL Renewal with LE using same CSR
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
#!/bin/bash | |
CONTAINER="/var/www/html" | |
DOMAIN="kopiro.it" | |
PUBLIC_DIR="$CONTAINER/public" | |
BACKUP_DIR="$CONTAINER/conf/backup/$(date +%s)" | |
mkdir -p "$BACKUP_DIR" | |
cp -v $CONTAINER/conf/*.pem "$BACKUP_DIR/" | |
rm "$CONTAINER/conf/cert.pem" | |
rm "$CONTAINER/conf/chain.pem" | |
rm "$CONTAINER/conf/fullchain.pem" | |
certbot-auto certonly \ | |
--non-interactive \ | |
--agree-tos \ | |
--email "[email protected]" \ | |
-a webroot \ | |
-w "$PUBLIC_DIR" \ | |
--rsa-key-size 4096 \ | |
--csr "$CONTAINER/conf/csr.pem" \ | |
--domain "$DOMAIN" \ | |
--cert-path "$CONTAINER/conf/cert.pem" \ | |
--chain-path "$CONTAINER/conf/chain.pem" \ | |
--fullchain-path "$CONTAINER/conf/fullchain.pem" && | |
nginx -t && | |
nginx -s reload |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment