diff --git a/root/app/le-renew.sh b/root/app/le_renew.sh similarity index 83% rename from root/app/le-renew.sh rename to root/app/le_renew.sh index a936df7..85839d3 100644 --- a/root/app/le-renew.sh +++ b/root/app/le_renew.sh @@ -7,4 +7,4 @@ echo echo "<------------------------------------------------->" echo "cronjob running on "$(date) echo "Running certbot renew" -certbot renew --noninteractive --no-self-upgrade +certbot renew --non-interactive --no-self-upgrade diff --git a/root/defaults/deploy/deploy-certs.sh b/root/defaults/deploy/01-deploy_certs.sh similarity index 94% rename from root/defaults/deploy/deploy-certs.sh rename to root/defaults/deploy/01-deploy_certs.sh index dc87d60..8d8aefd 100644 --- a/root/defaults/deploy/deploy-certs.sh +++ b/root/defaults/deploy/01-deploy_certs.sh @@ -7,7 +7,11 @@ # new certificates and keys; the shell variable $RENEWED_DOMAINS will contain a space-delimited list # of renewed certificate domains (for example, "example.com www.example.com" (default: None) +echo "Running deploy script ..." + KEYPATH="/letsencrypt" +echo "KEYPATH is ${KEYPATH}" +echo "LINEAGE is ${RENEWED_LINEAGE}" # clean current KEYPATH contents rm -f ${KEYPATH}/* diff --git a/root/etc/cont-init.d/00-s6-secret-init.sh b/root/etc/cont-init.d/00-s6_secret_init.sh similarity index 100% rename from root/etc/cont-init.d/00-s6-secret-init.sh rename to root/etc/cont-init.d/00-s6_secret_init.sh diff --git a/root/etc/cont-init.d/02-set-timezone.sh b/root/etc/cont-init.d/02-set_timezone.sh similarity index 100% rename from root/etc/cont-init.d/02-set-timezone.sh rename to root/etc/cont-init.d/02-set_timezone.sh diff --git a/root/etc/cont-init.d/50-certbot.sh b/root/etc/cont-init.d/50-lets_encrypt.sh similarity index 95% rename from root/etc/cont-init.d/50-certbot.sh rename to root/etc/cont-init.d/50-lets_encrypt.sh index cbf814a..f9ae600 100644 --- a/root/etc/cont-init.d/50-certbot.sh +++ b/root/etc/cont-init.d/50-lets_encrypt.sh @@ -53,9 +53,9 @@ ln -s /config/crontabs /etc/crontabs # Copy deploy hook defaults if needed # [[ -z "$(ls -A /letsencrypt/renewal-hooks/deploy)" ]] && \ -[[ ! -f /config/deploy/deploy-certs.sh ]] && \ +[[ ! -f /config/deploy/01-deploy_certs.sh ]] && \ echo "Copying deploy hooks..." && \ - cp -n /defaults/deploy/deploy-certs.sh /config/deploy/ + cp -n /defaults/deploy/01-deploy_certs.sh /config/deploy/ chmod +x /config/deploy/* # Link /config/deploy echo "Linking /config/deploy -> /etc/letsencrypt/renewal-hooks/deploy ..." @@ -169,7 +169,10 @@ echo -e "ORIGTLD=\"${TLD}\" ORIGSUBDOMAINS=\"${SUBDOMAINS}\" ORIGONLY_SUBDOMAINS if [ ! -f "/letsencrypt/fullchain.pem" ]; then echo "Generating new certificate" # shellcheck disable=SC2086 - certbot certonly --renew-by-default --server ${ACMESERVER} ${PREFCHAL} --rsa-key-size 4096 ${EMAILPARAM} --agree-tos ${TLD_REAL} + certbot certonly --non-interactive --force-renewal --server ${ACMESERVER} ${PREFCHAL} --rsa-key-size 4096 ${EMAILPARAM} --agree-tos ${TLD_REAL} + echo $(printenv) + /usr/bin/with-contenv bash /etc/letsencrypt/renewal-hooks/deploy/01-deploy_certs.sh + if [ -f /letsencrypt/fullchain.pem ]; then cd /letsencrypt || exit else diff --git a/root/etc/cont-init.d/60_renewal-init.sh b/root/etc/cont-init.d/60-renewal_init.sh similarity index 96% rename from root/etc/cont-init.d/60_renewal-init.sh rename to root/etc/cont-init.d/60-renewal_init.sh index a28d347..4a30a98 100644 --- a/root/etc/cont-init.d/60_renewal-init.sh +++ b/root/etc/cont-init.d/60-renewal_init.sh @@ -10,6 +10,6 @@ if openssl x509 -in /letsencrypt/fullchain.pem -noout -checkend 86400 >/dev/null echo "Letting the cron script handle the renewal attempts overnight (2:08am)." else echo "The cert is either expired or it expires within the next day. Attempting to renew. This could take up to 10 minutes." - /app/le-renew.sh + /app/le_renew.sh sleep 1 fi \ No newline at end of file