Update sites.inc

This commit is contained in:
2023-07-20 22:24:24 -05:00
parent 7b27657f5c
commit b353646747

View File

@@ -170,6 +170,30 @@ DELSITES(){
fi
}
LISTSITES(){
echo
echo -e "${idsCL[Red]}NGINX Site Config...${idsCL[Default]}"
DIVIDER true
# filels="( $(ssh root@${LB_HOSTS[0]} ls ${NM_NGINXPATH}/sites-enabled/*) )"
filels="( $(ls ${NM_NGINXPATH}/sites-enabled/*) )"
for siteconf in $filels; do
if [ ${siteconf:0:1} == '/' ]; then
IFS='/'; site_conf=(${siteconf}); unset IFS
[ "${site_conf[3]}" == "sites-enabled" ] && SITENAME=${site_conf[4]/.conf/} || [ "${site_conf[4]}" == "sites-enabled" ] && SITENAME=${site_conf[5]/.conf/}
[ grep -q "secure-access.conf" ${siteconf} ] && SECURE=Yes || SECURE=No
[ grep -q "websocket-support.conf" ${siteconf} ] && WEBSOCKET=Yes || WEBSOCKET=No
[ grep -q "hsts-support.conf" ${siteconf} ] && HSTS=Yes || HSTS=No
[ grep -q "block-exploits.conf" ${siteconf} ] && EXPLOITS=Yes || EXPLOITS=No
echo -e "${SITENAME} - ${SECURE} - ${WEBSOCKET} - ${HSTS} - ${EXPLOITS}"
fi
done
if [ -z $action ] || [ "${action}" = "gui" ]; then
ENTER2CONTINUE
fi
}
NEWSITE(){
echo
while [ $# -gt 0 ]; do
@@ -530,10 +554,9 @@ SITEINFO(){
echo -e "${idsCL[LightGreen]}Local NGINX Sites ${idsCL[Default]}"
fi
gosite=${RUN_NODE_TYPE}_NGINX_SITES
declare -A SITELIST
if [ "${!gosite}" != "" ]; then
sites=$(find ${!gosite}/*); i=0
if [ "${NM_NGINXPATH[${RUN_NODE_TYPE}]}" != "" ]; then
sites=$(find ${NM_NGINXPATH[${RUN_NODE_TYPE}]}/*); i=0
if [ "${1}" == "" ] || ([ "${1}" == "edit" ] && [ "${2}" == "" ]); then
for sitefile in ${sites[@]}; do
site=${sitefile##*/}; site=${site/.conf/}
@@ -594,7 +617,7 @@ SITEINFO(){
siteid=${2}
fi
site=${SITELIST[${siteid}]}
sitefile=${!gosite}/${site}.conf
sitefile=${NM_NGINXPATH[${RUN_NODE_TYPE}]}/${site}.conf
certpath=$(grep ssl_certificate_key ${sitefile})
if [ "${certpath}" != "" ]; then
ssl='Yes'