From a448f3ab3b011a5acc2507de713ff47a587cfce5 Mon Sep 17 00:00:00 2001 From: Menkveld Date: Wed, 22 Feb 2023 01:07:58 +0100 Subject: [PATCH] Added force renew option --- README.md | 3 +++ certer.sh | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 02f9065..92ae4d2 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,9 @@ | CURL_DEBUG | Adds the -v flag to curl requests | false | N | | CURL_QUIET | Displays curl output in terminal (including certificates) | false | N | | CURL_IGNORESSL | Ignore ssl errors when making requests to APISIX | true | N | +| FORCE_RENEW | Force certbot to renew the certificate if it doesn't want to | false | N | + +##### Tip: mount /etc/letsencrypt to a volume or sth to prevent certbot from making a new account each run ### Versions Version overview, this is not fully tested on all versions diff --git a/certer.sh b/certer.sh index bed4fcd..496f131 100755 --- a/certer.sh +++ b/certer.sh @@ -24,8 +24,9 @@ ignoreSSL=$([ $CURL_IGNORESSL == "true" ] && echo "-k" || echo "") showOutput=$([ $CURL_QUIET == "true" ] && echo "-o /dev/null" || echo "-o /tmp/debug_body") debugCurl=$([ $CURL_DEBUG == "true" ] && echo "-v" || echo "") agreeCertbotTOS=$([ $AGREE_TOS == "true" ] && echo "--agree-tos" || echo "") +forceRenew=$([ $FORCE_RENEW == "true" ] && echo "--force-renew" || echo "") -echo "[CERTER} v1.0.0" +echo "[CERTER] v1.1.0" echo "[CERTER] Generating certificates for: $domain" # Validate the response of any curl @@ -59,10 +60,10 @@ echo "[CERTER] Created temporary acme challenge route!" echo "[CERTER] Certbot output vvvvvvvvvvvvvvvvvvvvvv" if [[ $stagingOrProd == "production" ]]; then echo "[CERTER] Generating production certificates...." - certbot certonly --standalone --domains $domain --email $mail $agreeCertbotTOS --non-interactive + certbot certonly --standalone --domains $domain --email $mail $agreeCertbotTOS --non-interactive $forceRenew else echo "[CERTER] Generating staging certificates...." - certbot certonly --standalone --staging --domains $domain --email $mail $agreeCertbotTOS --non-interactive + certbot certonly --standalone --staging --domains $domain --email $mail $agreeCertbotTOS --non-interactive $forceRenew fi echo "[CERTER] Certbot output ^^^^^^^^^^^^^^^^^^^^^^" echo "[CERTER] Generated certificates!"