Update nodemgmt-scripts.sh
This commit is contained in:
@@ -88,15 +88,15 @@ LISTCERTS(){
|
||||
for certdir in /etc/letsencrypt/live/*/ ; 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=','; SUBJECTNAMES=(${SUBJECTNAMES//$'\n'/,}); unset IFS
|
||||
IFS=','; SUBJECT_NAMES=(${SUBJECTNAMES//$'\n'/,}); 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)));
|
||||
|
||||
DIVIDER true
|
||||
echo -e "Certificate Subject: ${idsST[Bold]}${idsBG[Blue]}${SUBJECT}${idsST[Reset]}${idsBG[Default]}"
|
||||
if [ "${#SUBJECTNAMES[*]}" -gt 1 ]; then
|
||||
if [ "${#SUBJECT_NAMES[*]}" -gt 1 ]; then
|
||||
anid=1
|
||||
for ALTNAME in "${SUBJECTNAMES[@]}"; do
|
||||
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]}"
|
||||
@@ -110,7 +110,7 @@ LISTCERTS(){
|
||||
echo -e "Expiration Date: ${idsCL[Green]}$(date -d @${CERTEXPIRE} '+%m-%d-%Y')${idsCL[Default]}"
|
||||
fi
|
||||
echo ""
|
||||
echo
|
||||
echo $SUBJECTNAMES
|
||||
echo ""
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user