This commit is contained in:
2023-11-11 13:51:53 -06:00
parent 8fe45fedf0
commit ed76907a66
2 changed files with 37 additions and 36 deletions

View File

@@ -479,14 +479,16 @@ NEWPROXYSITE_CREATE(){
EXPLOITS=${7}
SECURE=${8}
# if [[ ${SITENAME} == *","* ]]; then
# IFS=','; ${SITENAMES}=(${SITENAME}); unset IFS
# MAIN_SITE=${SITENAMES[0]}
# NGINX_SERVERNAME=${SITENAMES//[,]/ }
# else
# MAIN_SITE=${SITENAME}
# NGINX_SERVERNAME=${SITENAME}
# fi
if [[ ${SITENAME} == *","* ]]; then
IFS=','; ${SITENAMES}=(${SITENAME}); unset IFS
MAIN_SITE=${SITENAMES[0]}
NGINX_SERVERNAME=${SITENAMES//[,]/ }
else
MAIN_SITE=${SITENAME}
NGINX_SERVERNAME=${SITENAME}
fi
echo "${SITENAME} ${PROXYHOST} ${PROXYPORT} ${PROXYSCHEME} ${WEBSOCKET} ${HSTS} ${EXPLOITS} ${SECURE} "
# cp ${NM_FOLDER}/templates/nginx.proxy.site ${nginxconfig}
# sed -i "s/<<SERVER_NAME>>/${NGINX_SERVERNAME}/g" ${nginxconfig}
@@ -520,7 +522,7 @@ SITEINFO(){
gosite=${NM_NGINXPATH[${RUN_NODE_TYPE}]}/sites-enabled
declare -A SITELIST
if [ "${gosite}" != "" ]; then
sites=$(find ${gosite}/*); i=0
sites=$(find ${gosite}/w*); i=0
if [ "${1}" == "" ] || ([ "${1}" == "edit" ] && [ "${2}" == "" ]); then
for sitefile in ${sites[@]}; do
site=${sitefile##*/}; site=${site/.conf/}
@@ -594,12 +596,19 @@ SITEINFO(){
SUBJECTNAMES=${SUBJECTNAMES//$'\n'/, }
else
ssl='-'
SUBJECTNAMES=""
fi
if [ "$(grep include/proxy.conf ${sitefile})" != "" ]; then
type='Proxy'
server=$(grep 'set $server' ${sitefile})
server=${server#*\"}; server=${server%\"*}
servernames=$(grep 'server_name' ${sitefile}/;//)
servernames=${servernames//;/}
servernames=${servernames#* }
servernames=${servernames// /,}
scheme=$(grep 'set $forward_scheme' ${sitefile})
scheme=${scheme##* }; scheme=${scheme%;*}
port=$(grep 'set $port' ${sitefile})
@@ -616,17 +625,18 @@ SITEINFO(){
[ "$(grep include/secure-access.conf ${sitefile})" != "" ] && lock='Yes' || lock='-'
f=0
until [ "${edit}" = "c" ]; do
echo -e "\033[K${idsCL[White]}0) Site Address: ${idsCL[Cyan]}${idsST[Bold]}${site}${idsST[Reset]}"
echo -e "\033[K${idsCL[White]}1) Site Type: ${idsCL[Cyan]}${idsST[Bold]}${type}${idsST[Reset]}"
echo -e "\033[K${idsCL[White]}2) SSL Secure: ${idsCL[Cyan]}${idsST[Bold]}${ssl}${idsST[Reset]} - ${idsCL[LightCyan]}(${SUBJECTNAMES})"
echo -e "\033[K${idsCL[White]}3) HSTS Enabled ${idsCL[Cyan]}${idsST[Bold]}${hsts}${idsST[Reset]}"
echo -e "\033[K${idsCL[White]}4) Web Sockets: ${idsCL[Cyan]}${idsST[Bold]}${wbskt}${idsST[Reset]}"
echo -e "\033[K${idsCL[White]}5) Exploits Block: ${idsCL[Cyan]}${idsST[Bold]}${explt}${idsST[Reset]}"
echo -e "\033[K${idsCL[White]}6) Secured Access: ${idsCL[Cyan]}${idsST[Bold]}${lock}${idsST[Reset]}"
echo -e "\033[K${idsCL[White]}0) Site Address(es): ${idsCL[Cyan]}${idsST[Bold]}${servernames}${idsST[Reset]}"
echo -e "\033[K${idsCL[White]}1) Site Type: ${idsCL[Cyan]}${idsST[Bold]}${type}${idsST[Reset]}"
echo -en "\033[K${idsCL[White]}2) SSL Secure: ${idsCL[Cyan]}${idsST[Bold]}${ssl}${idsST[Reset]}"
[ "${SUBJECTNAMES}" != "" ] && echo " - ${idsCL[LightCyan]}(${SUBJECTNAMES})" || echo
echo -e "\033[K${idsCL[White]}3) HSTS Enabled ${idsCL[Cyan]}${idsST[Bold]}${hsts}${idsST[Reset]}"
echo -e "\033[K${idsCL[White]}4) Web Sockets: ${idsCL[Cyan]}${idsST[Bold]}${wbskt}${idsST[Reset]}"
echo -e "\033[K${idsCL[White]}5) Exploits Block: ${idsCL[Cyan]}${idsST[Bold]}${explt}${idsST[Reset]}"
echo -e "\033[K${idsCL[White]}6) Secured Access: ${idsCL[Cyan]}${idsST[Bold]}${lock}${idsST[Reset]}"
if [ "${type}" == "Proxy" ]; then
echo -e "\033[K${idsCL[White]}7) Proxy Address: ${idsCL[Cyan]}${idsST[Bold]}${server}${idsST[Reset]}"
echo -e "\033[K${idsCL[White]}8) Proxy Scheme: ${idsCL[Cyan]}${idsST[Bold]}${scheme}${idsST[Reset]}"
echo -e "\033[K${idsCL[White]}9) Proxy Port: ${idsCL[Cyan]}${idsST[Bold]}${port}${idsST[Reset]}"
echo -e "\033[K${idsCL[White]}7) Proxy Address: ${idsCL[Cyan]}${idsST[Bold]}${server}${idsST[Reset]}"
echo -e "\033[K${idsCL[White]}8) Proxy Scheme: ${idsCL[Cyan]}${idsST[Bold]}${scheme}${idsST[Reset]}"
echo -e "\033[K${idsCL[White]}9) Proxy Port: ${idsCL[Cyan]}${idsST[Bold]}${port}${idsST[Reset]}"
else
echo -e "\033[K"
echo -e "\033[K"
@@ -636,8 +646,8 @@ SITEINFO(){
# if [ $f -eq 0 ]; then
echo -e "\033[K"
echo -e "\033[K"
echo -e "\033[K (${idsCL[Green]}s${idsCL[Default]})ave, (${idsCL[Red]}c${idsCL[Default]})ancel, (${idsCL[Green]}e${idsCL[Default]})xit"
echo -e "\033[K"
echo -e "\033[K (${idsCL[Green]}s${idsCL[Default]})ave, (${idsCL[Red]}c${idsCL[Default]})ancel, (${idsCL[Green]}e${idsCL[Default]})xit"
echo -e "\033[K"
echo -e "\033[K"
echo -e "\033[7A"
@@ -699,16 +709,7 @@ SITEINFO(){
;;
*)
echo -e "\n\n\n"
# NEWPROXYSITE_CREATE ${site} ${server} ${port} ${scheme} ${wbskt} ${hsts} ${explt} ${lock}
# SITENAME=${1}
# PROXYHOST=${2}
# PROXYPORT=${3}
# PROXYSCHEME=${4}
# WEBSOCKET=${5}
# HSTS=${6}
# EXPLOITS=${7}
# SECURE=${8}
NEWPROXYSITE_CREATE ${site} ${server} ${port} ${scheme} ${wbskt} ${hsts} ${explt} ${lock}
edit=c
;;

View File

@@ -8,7 +8,7 @@ server {
server_name <<SERVER_NAME>>;
<<SECURE>>
#include conf.d/include/secure-access.conf;
include conf.d/include/letsencrypt-acme-challenge.conf;
include conf.d/include/ssl-ciphers.conf;
@@ -18,13 +18,13 @@ server {
access_log /var/log/nginx/<<MAIN_SITE>>.proxy.log proxy;
error_log /var/log/nginx/<<MAIN_SITE>>.error.log warn;
<<EXPLOITS>>
<<WEBSOCKET>>
<<HSTS>>
#include conf.d/include/block-exploits.conf;
#include conf.d/include/websocket-support.conf;
#include conf.d/include/hsts-support.conf;
location / {
<<WEBSOCKET>>
<<HSTS>>
#include conf.d/include/websocket-support.conf;
#include conf.d/include/hsts-support.conf;
include conf.d/include/force-ssl.conf;
include conf.d/include/proxy.conf;
}