Update nodemgmt-scripts.sh

This commit is contained in:
2019-02-04 22:39:04 -06:00
parent ee2d3a0fac
commit 96b1c86713

View File

@@ -85,13 +85,13 @@ CERTRENEW(){
LISTCERTS(){
#DIVIDER true
for d in /etc/letsencrypt/live/*/ ; do
SUBJECT=$(openssl x509 -in ${d}/cert.pem -noout -subject)
SUBJECTNAMES=$(openssl x509 -in ${d}/cert.pem -noout -text|grep -oP '(?<=DNS:|IP Address:)[^,]+'|sort -uV)
for certdir in /etc/letsencrypt/live/*/ ; do
#SUBJECT=$(openssl x509 -in ${certdir}/cert.pem -noout -subject)
SUBJECT=$(openssl x509 -in ${certdir}/cert.pem -noout -subject|grep -oP '(?<=DNS:|IP Address:)[^,]+'|sort -uV)
SUBJECTNAMES=$(openssl x509 -in ${certdir}/cert.pem -noout -text|grep -oP '(?<=CN = )[^,]+'|sort -uV)
IFS=':'; SUBJECTNAMES=(${SUBJECTNAMES//$'\n'/:}); unset IFS
DAYS=14
CERTEXPIRE=$(date -d "$(: | openssl x509 -in ${d}/cert.pem -text | grep 'Not After' |awk '{print $4,$5,$7}')" '+%s');
DUEIN=$(($(date +%s) + (86400*$DAYS)));
CERTEXPIRE=$(date -d "$(: | openssl x509 -in ${certdir}/cert.pem -text | grep 'Not After' |awk '{print $4,$5,$7}')" '+%s');
DAYS=14; DUEIN=$(($(date +%s) + (86400*$DAYS)));
if [ $DUEIN -gt $CERTEXPIRE ]; then CERTEXPIRED=true; else CERTEXPIRED=false; fi
echo $d