Update nodemgmt-scripts.sh

This commit is contained in:
2023-01-29 09:24:25 -06:00
parent a69580d681
commit 189323defd

View File

@@ -1004,8 +1004,6 @@ LISTCERTS_NPM(){
} }
COPYCERTS_NPM(){ COPYCERTS_NPM(){
ssldir='/opt/nginx-proxy/ssl' ssldir='/opt/nginx-proxy/ssl'
for certdir in /opt/nginx-proxy/letsencrypt/live/*/ ; do echo $certdir; done > /tmp/ssllist
for certdir in ${ssldir}/*/ ; do echo $certdir; done > /tmp/ssldirlist
if [ "${1}" = "reset" ]; then if [ "${1}" = "reset" ]; then
echo "Resetting ... Deleting all SSL symlink folders" echo "Resetting ... Deleting all SSL symlink folders"
@@ -1023,19 +1021,16 @@ COPYCERTS_NPM(){
if [ -z $action ] || [ "${action}" = "gui" ]; then if [ -z $action ] || [ "${action}" = "gui" ]; then
DIVIDER true DIVIDER true
fi fi
for certdir in $(</tmp/ssllist); do ssldirs=$(find $ssldir -type l)
SUBJECT=$(${NCMD} openssl x509 -in ${certdir}cert.pem -noout -subject|grep -oP '(?<=CN = )[^,]+'|sort -uV) for certdir in ${$ssldirs[@]}; do
#echo ${ssldir}/${SUBJECT} SUBJECT=$(openssl x509 -in ${certdir}/cert.pem -noout -subject|grep -oP '(?<=CN = )[^,]+'|sort -uV)
if [ ! -L ${ssldir}/${SUBJECT} ]; then if [ ! -L ${ssldir}/${SUBJECT} ]; then
echo "${SUBJECT} ... creating" echo "${SUBJECT} ... creating"
/bin/ln -s ${certdir} ${ssldir}/${SUBJECT} /bin/ln -s ${certdir} ${ssldir}/${SUBJECT}
fi fi
done done
rm -f /tmp/ssllist
rm -f /tmp/ssldirlist
if [ -z $action ] || [ "${action}" = "gui" ]; then if [ -z $action ] || [ "${action}" = "gui" ]; then
echo echo
DIVIDER true DIVIDER true