From 09eb18adda50d2ebfdbb87a274470ea0bc48991d Mon Sep 17 00:00:00 2001 From: MrMeeb Date: Mon, 20 Jun 2022 22:08:30 +0000 Subject: [PATCH] Added PROPOGATION_TIME variable --- Dockerfile | 1 + README.md | 2 ++ renew.sh | 4 ++-- run.sh | 6 ++++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 65cac6d..e06cf65 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,7 @@ ENV DOMAINS= ENV EMAIL= ENV INTERVAL="0 */6 * * *" ENV STAGING=false +ENV PROPOGATION_TIME=10 ENTRYPOINT ["/usr/bin/tini", "-s", "/run.sh"] diff --git a/README.md b/README.md index 29ed638..db4a789 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,8 @@ docker run -d --name certbot-cron \ | DOMAINS | None | Domains to be included in the certificate. Comma separated list, no spaces. Wildcards supported | | INTERVAL | 0 */6 * * * | How often certbot attempts to renew the certificate. Cron syntax | | STAGING | false | Uses the LetsEncrypt staging endpoint for testing - avoids the aggressive rate-limiting of the production endpoint | +| PROPOGATION_TIME | 10 | The amount of time (seconds) that certbot waits for the TXT records to propogate to Cloudflare before verifying - the more domains in the certificate, the longer you might need | + ## Volumes diff --git a/renew.sh b/renew.sh index 75eba59..db27d7c 100644 --- a/renew.sh +++ b/renew.sh @@ -4,12 +4,12 @@ echo "Attempting to renew certificates" if [[ $STAGING = true ]] then echo "Using staging endpoint - THIS SHOULD BE USED FOR TESTING ONLY" - certbot certonly --staging --non-interactive --agree-tos --dns-cloudflare --dns-cloudflare-credentials /config/.secrets/cloudflare.ini --email $EMAIL -d $DOMAINS + certbot certonly --staging --non-interactive --agree-tos --dns-cloudflare --dns-cloudflare-propagation-seconds $PROPOGATION_TIME --dns-cloudflare-credentials /config/.secrets/cloudflare.ini --email $EMAIL -d $DOMAINS echo "Renewal attempt complete" elif [[ $STAGING = false ]] then echo "Using production endpoint" - certbot certonly --non-interactive --agree-tos --dns-cloudflare --dns-cloudflare-credentials /config/.secrets/cloudflare.ini --email $EMAIL -d $DOMAINS + certbot certonly --non-interactive --agree-tos --dns-cloudflare --dns-cloudflare-propagation-seconds $PROPOGATION_TIME --dns-cloudflare-credentials /config/.secrets/cloudflare.ini --email $EMAIL -d $DOMAINS echo "Renewal attempt complete" else echo "Unrecognised option for STAGING variable - check your configuration" diff --git a/run.sh b/run.sh index 313a2e8..1081cdd 100644 --- a/run.sh +++ b/run.sh @@ -51,17 +51,19 @@ ln -s /config/letsencrypt /etc/letsencrypt echo "Domains being added to the certificate are "$DOMAINS +echo "Propogation time is $PROPOGATION_TIME seconds" + echo "Creating certificates, or attempting to renew if they already exist" if [[ $STAGING = true ]] then echo "Using staging endpoint - THIS SHOULD BE USED FOR TESTING ONLY" - certbot certonly --staging --non-interactive --agree-tos --dns-cloudflare --dns-cloudflare-credentials /config/.secrets/cloudflare.ini --email $EMAIL -d $DOMAINS + certbot certonly --staging --non-interactive --agree-tos --dns-cloudflare --dns-cloudflare-propagation-seconds $PROPOGATION_TIME --dns-cloudflare-credentials /config/.secrets/cloudflare.ini --email $EMAIL -d $DOMAINS echo "Creation/renewal attempt complete" elif [[ $STAGING = false ]] then echo "Using production endpoint" - certbot certonly --non-interactive --agree-tos --dns-cloudflare --dns-cloudflare-credentials /config/.secrets/cloudflare.ini --email $EMAIL -d $DOMAINS + certbot certonly --non-interactive --agree-tos --dns-cloudflare --dns-cloudflare-propagation-seconds $PROPOGATION_TIME --dns-cloudflare-credentials /config/.secrets/cloudflare.ini --email $EMAIL -d $DOMAINS echo "Creation/renewal attempt complete" else echo "Unrecognised option for STAGING variable - check your configuration"