Update certs.inc

This commit is contained in:
2023-11-12 21:22:15 -06:00
parent bda2d2da55
commit b9ea916237

View File

@@ -167,6 +167,21 @@ CONCAT_SSL(){
}
LISTCERTS(){
EDIT=0; SEARCH=0
while [ $# -gt 0 ]; do
case "${1}" in
-edit|-e) EDIT=1;;
-search|-s) SEARCH=${2};;
-h | -help | --help)
echo -e "Usage: ${idsCL[Yellow]}nodemgmt / nmg listcerts${idsCL[Default]} {"
width=33
printf "%-${width}s- %s\n" " -edit|-e" "(enables edit mode)"
printf "%-${width}s- %s\n" " -search|-s {search}" "(narrows list to cert names containing {search})"
echo -e "}\n"
exit 0;;
esac
shift
done
declare -i cw; declare -i spc1; declare -i c
if [ -f ${NM_FOLDER}/conf/ssl-domain-checks.conf ]; then
declare -A CHECKCERT_DOMAINS
@@ -197,10 +212,15 @@ LISTCERTS(){
echo -e "Subject Name Monitored Expires Alternate Subject Names"
DIVIDER false yellow 120
cw=30;
cw=34;
c=0; spc2=''; until [ $c = ${cw} ]; do spc2="${spc2} "; c=`expr $c + 1`; done
ssldir=$(${NCMD} find ${NM_CERTPATH}/live/*dns* -type d)
if [ "${SEARCH}" != "0" ]; then
ssldir=$(${NCMD} find ${NM_CERTPATH}/live/*${SEARCH,,}* -type d)
else
ssldir=$(${NCMD} find ${NM_CERTPATH}/live/* -type d)
fi
i=0
for certdir in ${ssldir[@]}; do
SUBJECT=$(${NCMD} openssl x509 -in ${certdir}/cert.pem -noout -subject|grep -oP '(?<=CN = )[^,]+'|sort -uV)