Skip to content

Commit 5ca7fb5

Browse files
authored
Merge pull request #8517 from Couchers-org/devops/fix/skip-cert-fetch-when-valid
nginx: skip cert fetch on startup when existing cert is still valid
2 parents 71f6b77 + 724a658 commit 5ca7fb5

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

app/nginx/scripts/get-certs.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ for LINE in $(cat /scripts/domains); do
2929
flags="$flags --challenge-alias $ALIAS_DOMAIN"
3030
fi
3131

32+
# skip if we already have a cert that's valid for more than 3 days; cron will handle renewals
33+
CERT_FILE=/certs/live/$folder/fullchain.pem
34+
if [[ -f $CERT_FILE ]] && openssl x509 -checkend $((3*86400)) -noout -in "$CERT_FILE" >/dev/null 2>&1; then
35+
echo "Skipping $DOMAIN: existing cert valid for >3 days"
36+
continue
37+
fi
38+
3239
mkdir -p /certs/live/$folder
3340

3441
/scripts/acme.sh/acme.sh --home /certs --issue --dns dns_aws $flags \

0 commit comments

Comments
 (0)