Skip to content

Instantly share code, notes, and snippets.

@ninsuo
Last active June 15, 2017 07:51
Show Gist options
  • Save ninsuo/edc400d85de8c160b5ff3e598d8f46af to your computer and use it in GitHub Desktop.
Save ninsuo/edc400d85de8c160b5ff3e598d8f46af to your computer and use it in GitHub Desktop.
auto renewing cerificates generated from lets-encrypt
#!/dgr/bin/busybox sh
# copied from https://github.com/n0rad/rkt-images/blob/master/aci/arch/aci-arch-nginx-certbot/templates/start.tmpl.sh
set -e
. /dgr/bin/functions.sh
isLevelEnabled "debug" && set -x
## Create certif
# certbot certonly --email [email protected] --webroot -w /var/lib/letsencrypt/ -d domain.tld,sub.domain.tld
mkdir -p /var/lib/letsencrypt/.well-known
chgrp http /var/lib/letsencrypt
chmod g+s /var/lib/letsencrypt
nginx -g "daemon on;"
while true; do
# renew
certbot renew --agree-tos
# update nginx
nginx -s reload
sleep 86400 # 1d
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment