This commit is contained in:
2023-11-11 11:30:47 -06:00
parent 8831bbbe97
commit d07e4f70fe
2 changed files with 28 additions and 30 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# VERS='4.12.120-11102023'
VERS='4.12.126-KYLEUPGRADEv3'
VERS='4.12.127-KYLEUPGRADEv3'
noheader=' service status-check nightlyrephp7.3-fpm,new backup report check checkcerts gitea update-nodes copynpmcerts singleservercheck update-dyndns backup-offsitepfsense gui nightlyreview update '
CERT_DAEMON='/snap/bin/certbot'

View File

@@ -161,6 +161,7 @@ LISTSITES(){
}
NEWSITE(){
NM_AUTHELIA_IP="$(GET_AUTHELIA_IP)"
CERTTEST=0
echo
while [ $# -gt 0 ]; do
@@ -205,6 +206,31 @@ NEWSITE(){
echo
fi
if [[ ${NEW_SITE} == *","* ]]; then
IFS=','; NEW_SITES=(${NEW_SITE}); unset IFS
MAIN_SITE=${NEW_SITES[0]}
NGINX_SERVERNAME=${NEW_SITE//[,]/ }
else
MAIN_SITE=${NEW_SITE}
NGINX_SERVERNAME=${NEW_SITE}
fi
nginxconfig=${NM_NGINXPATH}/sites-enabled/${MAIN_SITE}.conf
if [ -f ${nginxconfig} ]; then
echo -en "${idsCL[LightRed]}This site already exists, overwrite it? (y/N): ${idsCL[Default]}"
read overwrite
echo
if [[ ${overwrite} =~ ^[Nn]$ ]] || [ "${overwrite}" = "" ]; then
exit 0
elif [[ ${overwrite} =~ ^[Yy]$ ]]; then
rm -f ${NM_NGINXPATH}/sites-enabled/${DEL_SITE}* >/dev/null 2>&1
[ "${NM_AUTHELIA_IP}" != "" ] && ssh root@${NM_AUTHELIA_IP} sed -i "/${DEL_SITE}/d" ${NM_DOCKER_COMPOSE_LOC['authelia']}/config/configuration.yml
else
exit 0
fi
fi
if [ -z ${CREATE_SSL+x} ]; then
echo -en "${idsCL[LightCyan]}Create SSL for site? [Y/n] ${idsCL[Default]}"
read CREATE_SSL
@@ -289,7 +315,6 @@ NEWSITE(){
read MFA
showdivide=yes
([[ ${MFA} =~ ^[Yy]$ ]] || [ "${MFA}" = "" ]) && SECURE="2FA" || SECURE="1FA"
NM_AUTHELIA_IP="$(GET_AUTHELIA_IP)"
else
SECURE=no
fi
@@ -314,35 +339,8 @@ NEWSITE(){
echo -en "${idsCL[LightRed]}Is this information correct? [Y/n]${idsCL[Default]} "
read -n 1 response
echo
if [[ $response =~ ^[Yy]$ ]] || [ "${response}" = "" ]; then
if [[ ${NEW_SITE} == *","* ]]; then
IFS=','; NEW_SITES=(${NEW_SITE}); unset IFS
MAIN_SITE=${NEW_SITES[0]}
NGINX_SERVERNAME=${NEW_SITE//[,]/ }
else
MAIN_SITE=${NEW_SITE}
NGINX_SERVERNAME=${NEW_SITE}
fi
nginxconfig=${NM_NGINXPATH}/sites-enabled/${MAIN_SITE}.conf
if [ -f ${nginxconfig} ]; then
echo -en "${idsCL[LightRed]}This site already exists, overwrite it? (y/N): ${idsCL[Default]}"
read EXPLOITS
showdivide=yes
echo
if [[ ${EXPLOITS} =~ ^[Nn]$ ]] || [ "${EXPLOITS}" = "" ]; then
exit 0
elif [[ ${EXPLOITS} =~ ^[Yy]$ ]]; then
rm -f ${NM_NGINXPATH}/sites-enabled/${DEL_SITE}* >/dev/null 2>&1
ssh root@${NM_AUTHELIA_IP} sed -i "/${DEL_SITE}/d" ${NM_DOCKER_COMPOSE_LOC['authelia']}/config/configuration.yml
else
exit 0
fi
fi
if [ "${SITE_TYPE}" = "proxy" ]; then
if [ ! -z ${PROXYSCHEME+x} ] && [ ! -z ${PROXYHOST+x} ] && [ ! -z ${PROXYPORT+x} ]; then GO=true; fi
else GO=true