From 0e754a70bbc604edc7d99827c474255b9ca80d1d Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sun, 10 Feb 2019 15:57:23 -0600 Subject: [PATCH] Update nodemgmt-scripts.sh --- nodemgmt-scripts.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index fc72ccf4..6715d1a5 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -592,6 +592,15 @@ LISTCERTS(){ SUBJECTNAMES=$(echo $SUBJECTNAMES | sed "s/${SUBJECT}//g") 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))); + + OPENSSL=$(which openssl) + CERTDATE=$(${OPENSSL} x509 -in ${certdir}/cert.pem -enddate -noout -inform pem | \ + ${SED} 's/notAfter\=//') + COMMONNAME=$(${OPENSSL} x509 -in ${certdir}/cert.pem -subject -noout -inform pem | \ + ${SED} -e 's/.*CN=//' | \ + ${SED} -e 's/\/.*//') + + SUBJECT=${COMMONNAME} declare -i cw; declare -i spc1; declare -i c c=0; cw=30; spc='' @@ -602,7 +611,7 @@ LISTCERTS(){ else date="${idsCL[Green]}$(date -d @${CERTEXPIRE} '+%m-%d-%Y')${idsCL[Default]}" fi - echo -e "${idsCL[Cyan]}${SUBJECT}${spc}${date} ${idsCL[Cyan]}${SUBJECTNAMES}${idsCL[Default]}" + echo -e "${idsCL[Cyan]}${SUBJECT}${spc}${CERTDATE} ${idsCL[Cyan]}${SUBJECTNAMES}${idsCL[Default]}" done echo if [ -z $action ] || [ "${action}" = "gui" ]; then