From: Markus Germeier Date: Sun, 6 Dec 2015 17:25:54 +0000 (+0100) Subject: change openssl to use enddate for expiry date check X-Git-Tag: v0.1.0~198^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F13%2Fhead;p=thirdparty%2Fdehydrated.git change openssl to use enddate for expiry date check --- diff --git a/letsencrypt.sh b/letsencrypt.sh index 0971032..cec6ebc 100755 --- a/letsencrypt.sh +++ b/letsencrypt.sh @@ -221,8 +221,8 @@ fi echo -n "Found existing cert for ${domain}. Expire date ..." set +e; openssl x509 -checkend $((${RENEW_DAYS} * 86400)) -noout -in "certs/${domain}/cert.pem"; expiring=$?; set -e if [[ ${expiring} -eq 0 ]]; then - valid=$(openssl x509 -text -noout -in "certs/${domain}/cert.pem" | grep -i "not after" | cut -d: -f2- ) - echo "${valid} Skipping. (Valid longer than ${RENEW_DAYS} days.)" + valid=$(openssl x509 -enddate -noout -in "certs/${domain}/cert.pem" | cut -d= -f2- ) + echo " ${valid} Skipping. (Valid longer than ${RENEW_DAYS} days.)" continue fi echo " is within ${RENEW_DAYS} days. Renewing..."