This commit is contained in:
2023-11-10 11:09:11 -06:00
parent 7dcb7b7a27
commit 4af88732e9
2 changed files with 6 additions and 33 deletions

View File

@@ -48,38 +48,21 @@ NEWCERT(){
chmod -R 6775 ${NM_CERTPATH}
if [ -d ${NM_CERTPATH}/live/${MAIN_CERT} ]; then
touch ${NM_CERTPATH}/live/${MAIN_CERT}/newcert
echo -e "$(date +%Y-%m-%d-%H-%M-%S) - ${NEW_CERT}" >> ${NM_LOGFOLDER}/cert.requests
if [ -f ${NM_NGINXPATH}/sites-enabled/${MAIN_CERT}.conf ]; then
echo -e "$(date +%Y-%m-%d-%H-%M-%S) - ${NEW_CERT}" >> ${NM_LOGFOLDER}/cert.requests
sed -i "s/#ssl_certificate/ssl_certificate/g" ${NM_NGINXPATH}/sites-enabled/${MAIN_CERT}.conf
DIVIDER true
if [ "${2}" != "newsite" ] && [ "${NM_HOSTS['LB']}" != "" ]; then
echo -e -n "${idsCL[LightCyan]}Reload NGINX on LB Nodes (Y/n): ${idsCL[Default]}"
if [ "${2}" != "newsite" ]; then
echo -e -n "${idsCL[LightCyan]}Restart NGINX on all Nodes (Y/n): ${idsCL[Default]}"
read -n 1 NGINXRELOAD
if [[ ${NGINXRELOAD} =~ ^[Nn]$ ]]; then
tmp=''
else
echo
echo -en "${idsCL[LightYellow]}Waiting for Cert replication across the nodes... ${idsCL[Default]}"
for nip in "${NM_HOSTS['LB'][@]}"; do
checkhost=$(CHECK_HOST ${nip})
if [ "${checkhost}" != "false" ]; then
if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) != *"${nip}"* ]]; then
checked=false
until [ "${checked}" = "" ]; do
checked=`ssh root@${nip} "[ ! -f ${NM_CERTPATH}/live/${MAIN_CERT}/newcert ] && echo '.'"`
done
fi
fi
done
rm -f ${NM_CERTPATH}/live/${MAIN_CERT}/newcert
echo -e "${idsCL[Green]}Completed${idsCL[Default]}"
echo
SERVICE nginx restart
fi
fi
fi
echo
echo -e "${idsCL[Green]}Certificate has been successfully created for '${idsCL[Yellow]}${NEW_CERT}${idsCL[Green]}'...${idsCL[Default]}"
@@ -88,16 +71,6 @@ NEWCERT(){
echo -e "${idsCL[Red]}Certificate could not be created for '${idsCL[Yellow]}${NEW_CERT}${idsCL[Red]}'...${idsCL[Default]}"
fi
# echo
# echo -en "${idsCL[LightYellow]}Starting other Webservers... ${idsCL[Default]}"
# for nip in "${NM_HOSTS['WEB'][@]}"; do
# if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) != *"${nip}"* ]]; then
# `ssh root@${nip} service nginx start`
# # SERVICE nginx start ${nip}
# fi
# done
# echo -e "${idsCL[Green]}Completed${idsCL[Default]}"
echo
if [ -z $action ] || [ "${action}" = "gui" ]; then
DIVIDER true

View File

@@ -458,7 +458,7 @@ NEWSITE(){
if [ "${CREATE_SSL}" = "yes" ]; then
[ "${ssladd}" != "" ] && NEWCERT ${NEW_SITE},${ssladd} newsite ${CERTTEST} || NEWCERT ${NEW_SITE} newsite ${CERTTEST}
# if [ "${SITE_TYPE}" == "proxy" ]; then
sed -i "s/#ssl_certificate/ssl_certificate/g" ${nginxconfig}
# sed -i "s/#ssl_certificate/ssl_certificate/g" ${nginxconfig}
# fi
fi