From: Simon Ruderich Date: Tue, 8 Dec 2015 09:06:17 +0000 (+0100) Subject: simplify expiry check X-Git-Tag: v0.1.0~165 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c10390fbd1eab12853ee5872e845cc5d50a1707d;p=thirdparty%2Fdehydrated.git simplify expiry check --- diff --git a/letsencrypt.sh b/letsencrypt.sh index 303a499..1631914 100755 --- a/letsencrypt.sh +++ b/letsencrypt.sh @@ -327,12 +327,10 @@ fi if [[ -e "${cert}" ]]; then echo " + Found existing cert..." - # Turning off exit on non-zero status for cert validation - set +e; openssl x509 -checkend $((RENEW_DAYS * 86400)) -noout -in "${cert}"; expiring=$?; set -e valid="$(openssl x509 -enddate -noout -in "${cert}" | cut -d= -f2- )" echo -n " + Valid till ${valid} " - if [[ ${expiring} -eq 0 ]]; then + if openssl x509 -checkend $((RENEW_DAYS * 86400)) -noout -in "${cert}"; then echo "(Longer than ${RENEW_DAYS} days). Skipping!" continue fi