Update nodemgmt-scripts.sh

This commit is contained in:
2019-02-04 23:32:15 -06:00
parent 5f88bcca0c
commit 0072473d3d

View File

@@ -88,7 +88,8 @@ LISTCERTS(){
for certdir in /etc/letsencrypt/temp/*/ ; do
SUBJECT=$(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)
IFS=','; SUBJECT_NAMES=(${SUBJECTNAMES//$'\n'/,}); unset IFS
SUBJECTNAMES=${SUBJECTNAMES//$'\n'/,}
IFS=','; SUBJECT_NAMES=(${SUBJECTNAMES}); unset IFS
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)));
@@ -97,11 +98,9 @@ LISTCERTS(){
if [ "${#SUBJECT_NAMES[*]}" -gt 1 ]; then
anid=1
for ALTNAME in "${SUBJECT_NAMES[@]}"; do
if [ "${ALTNAME}" != "${SUBJECT}" ]; then
if [ "${anid}" = 1 ]; then alttitle='Alternate Subject(s):'; else alttitle=' '; fi
echo -e "${alttitle} ${idsCL[LightCyan]}${ALTNAME}${idsCL[Default]}"
anid=`expr $anid + 1`
fi
if [ "${anid}" = 1 ]; then alttitle='Alternate Subject(s):'; else alttitle=' '; fi
echo -e "${alttitle} ${idsCL[LightCyan]}${ALTNAME}${idsCL[Default]}"
anid=`expr $anid + 1`
done
fi
if [ $DUEIN -gt $CERTEXPIRE ]; then