Update nodemgmt-scripts.sh

This commit is contained in:
2023-01-29 09:07:20 -06:00
parent 27cd6fc52c
commit c8dae44c7b

View File

@@ -1004,13 +1004,6 @@ LISTCERTS_NPM(){
}
COPYCERTS_NPM(){
ssldir='/opt/nginx-proxy/ssl'
olddirs=$(find $ssldir -type l ! -exec test -e {} \; -print)
for od in ${olddirs[@]}; do
echo "Removing old folder ... ${od}"
rm -f $od
done
if [ ! -z ${LOCAL_SERVICES+x} ]; then
NCMD="ssh root@${LB_HOSTS[0]}"
${NCMD} rm -f /tmp/ssllist
@@ -1020,19 +1013,33 @@ COPYCERTS_NPM(){
rm -f /tmp/ssllist
for certdir in /opt/nginx-proxy/letsencrypt/live/*/ ; do echo $certdir; done > /tmp/ssllist
fi
if [ "${1}" = "reset" ]; then
echo "Resetting ... Deleting all SSL symlink folders"
for certdir in $(</tmp/ssllist); do
rm -f $certdir
done
else
olddirs=$(find $ssldir -type l ! -exec test -e {} \; -print)
for od in ${olddirs[@]}; do
echo "Removing old folder ... ${od}"
rm -f $od
done
fi
if [ -z $action ] || [ "${action}" = "gui" ]; then
DIVIDER true
fi
#echo
# for certdir in $(</tmp/ssllist); do
# SUBJECT=$(${NCMD} openssl x509 -in ${certdir}cert.pem -noout -subject|grep -oP '(?<=CN = )[^,]+'|sort -uV)
# #echo ${ssldir}/${SUBJECT}
# if [ ! -L ${ssldir}/${SUBJECT} ]; then
# echo "${SUBJECT} ... creating"
# /bin/ln -s ${certdir} ${ssldir}/${SUBJECT}
# fi
# done
for certdir in $(</tmp/ssllist); do
SUBJECT=$(${NCMD} openssl x509 -in ${certdir}cert.pem -noout -subject|grep -oP '(?<=CN = )[^,]+'|sort -uV)
#echo ${ssldir}/${SUBJECT}
if [ ! -L ${ssldir}/${SUBJECT} ]; then
echo "${SUBJECT} ... creating"
/bin/ln -s ${certdir} ${ssldir}/${SUBJECT}
fi
done
if [ -z $action ] || [ "${action}" = "gui" ]; then
echo
DIVIDER true
@@ -2469,7 +2476,7 @@ if [ ${action-x} ]; then
delssl) DEL-SSL ${2};;
listcerts) LISTCERTS;;
listcerts-npm) LISTCERTS_NPM;;
copynpmcerts) COPYCERTS_NPM;;
copynpmcerts) COPYCERTS_NPM ${2};;
checkcerts) CHECK-CERTS ${2};;
nightlyrenew) NIGHTLYRENEW;;
delsite) DELSITE ${2} ${3} ${4} ${5};;