From 14e312b67aee44540a49349568f6e96497b9afb0 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Wed, 22 Nov 2023 23:39:44 -0600 Subject: [PATCH] Update certs.inc --- inc/certs.inc | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/inc/certs.inc b/inc/certs.inc index 46712183..0e0520a0 100755 --- a/inc/certs.inc +++ b/inc/certs.inc @@ -706,7 +706,6 @@ export PDNS_Ttl=60 UPGRADECERTS(){ ssldir=$(${NCMD} find ${NM_CERTPATH}/live/* -type d) - i=1 for certdir in ${ssldir[@]}; do SUBJECT=$(${NCMD} openssl x509 -in ${certdir}/cert.pem -noout -subject|grep -oP '(?<=CN = )[^,]+'|sort -uV) SUBJECTNAMES=$(${NCMD} openssl x509 -in ${certdir}/cert.pem -noout -text|grep -oP '(?<=DNS:|IP Address:)[^,]+'|sort -uV) @@ -715,23 +714,14 @@ UPGRADECERTS(){ SUBJECTNAMES=$(echo $SUBJECTNAMES | sed "s/, ${SUBJECT}//g") SUBJECTNAMES=$(echo $SUBJECTNAMES | sed "s/${SUBJECT}, //g") SUBJECTNAMES=$(echo $SUBJECTNAMES | sed "s/${SUBJECT}//g") - if [ "${SUBJECTNAMES}" == "" ]; then - allnames=${SUBJECT} - else - allnames="${SUBJECT},$SUBJECTNAMES" - fi - $CERT_DAEMON certonly --expand --preferred-chain "ISRG Root X1" --key-type rsa --server https://acme-v02.api.letsencrypt.org/directory --webroot --webroot-path ${NM_CERTPATH}/letsencrypt-acme-challenge -d ${allnames} - + [ "${SUBJECTNAMES}" == "" ] && allnames=${SUBJECT} || allnames="${SUBJECT},$SUBJECTNAMES" - if [ -d ${NM_CERTPATH}/live/${MAIN_CERT} ]; then - echo - echo -e "${idsCL[Green]}Certificate has been successfully created for '${idsCL[Yellow]}${NEW_CERT}${idsCL[Green]}'...${idsCL[Default]}" - else - echo - echo -e "${idsCL[Red]}Certificate could not be created for '${idsCL[Yellow]}${NEW_CERT}${idsCL[Red]}'...${idsCL[Default]}" - fi + echo -e "${idsCL[LightGreen]}Certificate upgrading for '${idsCL[Yellow]}${SUBJECT}${idsCL[Green]}'${idsCL[Default]}" + echo -e "${idsCL[Green]}All SSL Hostnames: '${idsCL[Yellow]}${allnames}${idsCL[Green]}'${idsCL[Default]}" + $CERT_DAEMON certonly --preferred-chain "ISRG Root X1" --key-type rsa --server https://acme-v02.api.letsencrypt.org/directory --webroot --webroot-path ${NM_CERTPATH}/letsencrypt-acme-challenge -d ${allnames} + echo done chown -R root:le ${NM_CERTPATH}