Update nodemgmt-scripts.sh

This commit is contained in:
2019-02-11 11:21:32 -06:00
parent c38a57b5b1
commit 6b5ff6708a

View File

@@ -578,6 +578,15 @@ NIGHTLYRENEW(){
}
LISTCERTS(){
if [ ! -z ${LOCAL_SERVICES+x} ]; then
NCMD='ssh root@10.5.10.51'
ssh username@server "for certdir in /etc/letsencrypt/live/*/ ; do echo $certdir; done" > log
for line in $(<log); do
echo $line
done
else
NCMD=''
fi
if [ -z $action ] || [ "${action}" = "gui" ]; then
DIVIDER true
fi
@@ -586,13 +595,11 @@ LISTCERTS(){
DIVIDER
echo -e "Subject Name Expires Alternate Subjects"
DIVIDER
AWK=$(which awk)
DATE=$(which date)
GREP=$(which grep)
OPENSSL=$(which openssl)
SED=$(which sed)
for certdir in /etc/letsencrypt/live/*/ ; do
SUBJECT=$(openssl x509 -in ${certdir}/cert.pem -noout -subject|grep -oP '(?<=CN = )[^,]+'|sort -uV)
SUBJECT=$(${NCMD} openssl x509 -in ${certdir}/cert.pem -noout -subject|grep -oP '(?<=CN = )[^,]+'|sort -uV)
SUBJECTNAMES=$(openssl x509 -in ${certdir}/cert.pem -noout -text|grep -oP '(?<=DNS:|IP Address:)[^,]+'|sort -uV)
SUBJECTNAMES=${SUBJECTNAMES//$'\n'/, }
SUBJECTNAMES=$(echo $SUBJECTNAMES | sed "s/${SUBJECT}, //g")