Update nodemgmt-scripts.sh

This commit is contained in:
2023-01-29 11:56:13 -06:00
parent 62c4eaa07c
commit 30366a211b

View File

@@ -866,12 +866,12 @@ LISTCERTS(){
unset IFS
if [ ! -z ${LOCAL_SERVICES+x} ]; then
NCMD="ssh root@${MYSQL_HOSTS[0]}"
${NCMD} rm -f /tmp/ssllist
${NCMD} 'for certdir in /etc/letsencrypt/live/*/ ; do echo $certdir; done' > /tmp/ssllist
#${NCMD} rm -f /tmp/ssllist
#${NCMD} 'for certdir in /etc/letsencrypt/live/*/ ; do echo $certdir; done' > /tmp/ssllist
else
NCMD=''
rm -f /tmp/ssllist
for certdir in /etc/letsencrypt/live/*/ ; do echo $certdir; done > /tmp/ssllist
#for certdir in /etc/letsencrypt/live/*/ ; do echo $certdir; done > /tmp/ssllist
fi
if [ -z $action ] || [ "${action}" = "gui" ]; then
DIVIDER true
@@ -884,10 +884,12 @@ LISTCERTS(){
cw=30;
c=0; spc2=''; until [ $c = ${cw} ]; do spc2="${spc2} "; c=`expr $c + 1`; done
for certdir in $(</tmp/ssllist); 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)
CERTEXPIRE=$(date -d "$(: | ${NCMD} openssl x509 -in ${certdir}cert.pem -text | grep 'Not After' |awk '{print $4,$5,$7}')" '+%s');
ssldir=$(${NCMD} find /opt/nginx-proxy/letsencrypt/live/* -type d)
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)
CERTEXPIRE=$(date -d "$(: | ${NCMD} openssl x509 -in ${certdir}/cert.pem -text | grep 'Not After' |awk '{print $4,$5,$7}')" '+%s');
SUBJECTNAMES=${SUBJECTNAMES//$'\n'/, }
# SUBJECTNAMES=$(echo $SUBJECTNAMES | sed "s/\n/, /g")