Skip to content

Instantly share code, notes, and snippets.

@progress44
Forked from kopiro/sslrenewal
Created June 26, 2017 14:00
Show Gist options
  • Save progress44/5e9573399dfb4c3736c5e1ce6d97e8e5 to your computer and use it in GitHub Desktop.
Save progress44/5e9573399dfb4c3736c5e1ce6d97e8e5 to your computer and use it in GitHub Desktop.
SSL Renewal with LE using same CSR
#!/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/"
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