mirror of
https://github.com/dehydrated-io/dehydrated.git
synced 2026-07-08 22:15:19 +02:00
Renew timeframe as config option
This commit is contained in:
committed by
Lukas Schauer
parent
5060dea068
commit
e300c0a173
@@ -8,3 +8,6 @@ WELLKNOWN="/var/www/letsencrypt/.well-known/acme-challenge"
|
|||||||
# token; can be used to e.g. upload the challenge if this script doesn't run
|
# token; can be used to e.g. upload the challenge if this script doesn't run
|
||||||
# on the webserver
|
# on the webserver
|
||||||
#HOOK_CHALLENGE=
|
#HOOK_CHALLENGE=
|
||||||
|
|
||||||
|
# try to renew certs that are within RENEW_DAYS days of there expire date
|
||||||
|
#RENEW_DAYS="14"
|
||||||
+4
-3
@@ -8,6 +8,7 @@ set -o pipefail
|
|||||||
CA="https://acme-v01.api.letsencrypt.org"
|
CA="https://acme-v01.api.letsencrypt.org"
|
||||||
LICENSE="https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf"
|
LICENSE="https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf"
|
||||||
HOOK_CHALLENGE=
|
HOOK_CHALLENGE=
|
||||||
|
RENEW_DAYS="14"
|
||||||
KEYSIZE="4096"
|
KEYSIZE="4096"
|
||||||
|
|
||||||
. ./config.sh
|
. ./config.sh
|
||||||
@@ -189,12 +190,12 @@ fi
|
|||||||
domain="$(echo $line | cut -d' ' -f1)"
|
domain="$(echo $line | cut -d' ' -f1)"
|
||||||
if [[ -e "certs/${domain}/cert.pem" ]]; then
|
if [[ -e "certs/${domain}/cert.pem" ]]; then
|
||||||
echo -n "Found existing cert for ${domain}. Expire date ..."
|
echo -n "Found existing cert for ${domain}. Expire date ..."
|
||||||
set +e; openssl x509 -checkend 1209600 -noout -in "certs/${domain}/cert.pem"; expiring=$?; set -e
|
set +e; openssl x509 -checkend $((${RENEW_DAYS} * 86400)) -noout -in "certs/${domain}/cert.pem"; expiring=$?; set -e
|
||||||
if [[ ${expiring} -eq 0 ]]; then
|
if [[ ${expiring} -eq 0 ]]; then
|
||||||
echo " is not within 2 weeks. Skipping"
|
echo " is not within ${RENEW_DAYS} days. Skipping"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
echo " is within 2 weeks. Renewing..."
|
echo " is within ${RENEW_DAYS} days. Renewing..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sign_domain $line
|
sign_domain $line
|
||||||
|
|||||||
Reference in New Issue
Block a user