Update nodemgmt-scripts.sh
This commit is contained in:
@@ -578,6 +578,7 @@ NIGHTLYRENEW(){
|
||||
}
|
||||
|
||||
LISTCERTS(){
|
||||
declare -i cw; declare -i spc1; declare -i c
|
||||
if [ ! -z ${LOCAL_SERVICES+x} ]; then
|
||||
NCMD="ssh root@${PRIMARYHOST}"
|
||||
${NCMD} rm -f /tmp/ssllist
|
||||
@@ -599,14 +600,15 @@ LISTCERTS(){
|
||||
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');
|
||||
|
||||
SUBJECTNAMES=${SUBJECTNAMES//$'\n'/, }
|
||||
SUBJECTNAMES=$(echo $SUBJECTNAMES | sed "s/${SUBJECT}, //g")
|
||||
SUBJECTNAMES=$(echo $SUBJECTNAMES | sed "s/, ${SUBJECT}//g")
|
||||
SUBJECTNAMES=$(echo $SUBJECTNAMES | sed "s/${SUBJECT}//g")
|
||||
CERTEXPIRE=$(date -d "$(: | ${NCMD} openssl x509 -in ${certdir}/cert.pem -text | grep 'Not After' |awk '{print $4,$5,$7}')" '+%s');
|
||||
IFS=', '; SUBJECT_NAMES=(${SUBJECTNAMES}); unset IFS
|
||||
DAYS=14; DUEIN=$(($(date +%s) + (86400*$DAYS)));
|
||||
|
||||
declare -i cw; declare -i spc1; declare -i c
|
||||
c=0; cw=30; spc=''
|
||||
spc1=${cw}-${#SUBJECT}
|
||||
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
||||
@@ -615,7 +617,14 @@ 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]}"
|
||||
if [ ${#SUBJECT_NAMES[@]} -lt 4 ]; then
|
||||
echo -e "${idsCL[Cyan]}${SUBJECT}${spc}${date} ${idsCL[Cyan]}${SUBJECTNAMES}${idsCL[Default]}"
|
||||
elif [ ${#SUBJECT_NAMES[@]} -lt 7 ]; then
|
||||
echo -e "${idsCL[Cyan]}${SUBJECT}${spc}${date} ${idsCL[Cyan]}${SUBJECT_NAMES[0]}, ${SUBJECT_NAMES[1]}, ${SUBJECT_NAMES[2]}${idsCL[Default]}"
|
||||
c=0; spc=''; until [ $c = ${cw} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
||||
echo -e "${idsCL[Cyan]}${spc} ${idsCL[Cyan]}${SUBJECT_NAMES[3]}, ${SUBJECT_NAMES[4]}, ${SUBJECT_NAMES[5]}${idsCL[Default]}"
|
||||
|
||||
fi
|
||||
done
|
||||
echo
|
||||
if [ -z $action ] || [ "${action}" = "gui" ]; then
|
||||
|
||||
Reference in New Issue
Block a user