Update nodemgmt-scripts.sh

This commit is contained in:
2019-02-10 17:00:48 -06:00
parent 199dcb9baf
commit d6e4c1a616

View File

@@ -584,14 +584,14 @@ LISTCERTS(){
echo -e "Subject Name Expires Alternate Subjects" echo -e "Subject Name Expires Alternate Subjects"
DIVIDER DIVIDER
for certdir in /etc/letsencrypt/live/*/ ; do for certdir in /etc/letsencrypt/live/*/ ; do
SUBJECT=$(openssl x509 -in ${certdir}/cert.pem -noout -subject|grep -oP '(?<=CN = )[^,]+'|sort -uV) # 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) # SUBJECTNAMES=$(openssl x509 -in ${certdir}/cert.pem -noout -text|grep -oP '(?<=DNS:|IP Address:)[^,]+'|sort -uV)
SUBJECTNAMES=${SUBJECTNAMES//$'\n'/, } # SUBJECTNAMES=${SUBJECTNAMES//$'\n'/, }
SUBJECTNAMES=$(echo $SUBJECTNAMES | sed "s/${SUBJECT}, //g") # SUBJECTNAMES=$(echo $SUBJECTNAMES | sed "s/${SUBJECT}, //g")
SUBJECTNAMES=$(echo $SUBJECTNAMES | sed "s/, ${SUBJECT}//g") # SUBJECTNAMES=$(echo $SUBJECTNAMES | sed "s/, ${SUBJECT}//g")
SUBJECTNAMES=$(echo $SUBJECTNAMES | sed "s/${SUBJECT}//g") # 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'); # 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))); # DAYS=14; DUEIN=$(($(date +%s) + (86400*$DAYS)));
AWK=$(which awk) AWK=$(which awk)
DATE=$(which date) DATE=$(which date)
@@ -601,11 +601,9 @@ LISTCERTS(){
CERTDATE=$(${OPENSSL} x509 -in ${certdir}/cert.pem -text -enddate -noout -inform pem | ${SED} 's/notAfter\=//') CERTDATE=$(${OPENSSL} x509 -in ${certdir}/cert.pem -text -enddate -noout -inform pem | ${SED} 's/notAfter\=//')
COMMONNAME=$(${OPENSSL} x509 -in ${certdir}/cert.pem -text -subject -noout -inform pem | \ SUBJECT=$(${OPENSSL} x509 -in ${certdir}/cert.pem -text -subject -noout -inform pem | \
${SED} -e 's/.*CN=//' | \ ${SED} -e 's/.*CN=//' | \
${SED} -e 's/\/.*//') ${SED} -e 's/\/.*//')
SUBJECT=${COMMONNAME}
declare -i cw; declare -i spc1; declare -i c declare -i cw; declare -i spc1; declare -i c