Update sites.inc

This commit is contained in:
2023-12-02 13:50:39 -06:00
parent 5555faf0eb
commit c3ef4e41c4

View File

@@ -566,79 +566,83 @@ SITEINFO(){
sites=$(find ${gosite}/*.conf)
fi
i=1
for sitefile in ${sites[@]}; do
SITENAME=${sitefile##*/}; SITENAME=${SITENAME/.conf/}
siteconfig=$(cat ${sitefile})
if (( i % 12 == 0 )) || [ $i = 1 ]; then
DIVIDER false yellow ${dl}
[ ${EDIT} -eq 1 ] && msg1='##) Site Hostname' || msg1='Site Hostname'
echo -en "${idsCL[Yellow]}"
if [ ${EDIT} -eq 1 ]; then
printf "%-32s %-8s %-6s %-6s %-6s %-6s %-6s %-8s\n" "${msg1}" "Type" "SSL" "HSTS" "WBSKT" "EXPLT" "LOCK" "Proxy Connection"
if [ "${sites}" != "" ]; then
i=1
for sitefile in ${sites[@]}; do
SITENAME=${sitefile##*/}; SITENAME=${SITENAME/.conf/}
siteconfig=$(cat ${sitefile})
if (( i % 12 == 0 )) || [ $i = 1 ]; then
DIVIDER false yellow ${dl}
[ ${EDIT} -eq 1 ] && msg1='##) Site Hostname' || msg1='Site Hostname'
echo -en "${idsCL[Yellow]}"
if [ ${EDIT} -eq 1 ]; then
printf "%-32s %-8s %-6s %-6s %-6s %-6s %-6s %-8s\n" "${msg1}" "Type" "SSL" "HSTS" "WBSKT" "EXPLT" "LOCK" "Proxy Connection"
else
printf "%-28s %-8s %-6s %-6s %-6s %-6s %-6s %-8s\n" "${msg1}" "Type" "SSL" "HSTS" "WBSKT" "EXPLT" "LOCK" "Proxy Connection"
fi
echo -en "${idsCL[Default]}"
DIVIDER false yellow ${dl}
else
printf "%-28s %-8s %-6s %-6s %-6s %-6s %-6s %-8s\n" "${msg1}" "Type" "SSL" "HSTS" "WBSKT" "EXPLT" "LOCK" "Proxy Connection"
DIVIDER false darkGray ${dl}
fi
echo -en "${idsCL[Default]}"
DIVIDER false yellow ${dl}
else
DIVIDER false darkGray ${dl}
fi
#twofacline=$(echo "${autheliaconfig}" | grep -Fn two_factor | sort | tail -n1)
if [ "$(echo "${siteconfig}" | grep include/proxy.conf)" != "" ] || [ "$(echo "${siteconfig}" | grep proxy_pass)" != "" ]; then
SITE_TYPE='Proxy'
if [ "$(echo "${siteconfig}" | grep include/proxy.conf)" != "" ]; then
PROXYHOST=$(echo "${siteconfig}" | grep 'set $server')
PROXYHOST=${PROXYHOST#*\"}; PROXYHOST=${PROXYHOST%\"*}
PROXYSCHEME=$(echo "${siteconfig}" | grep 'set $forward_scheme')
PROXYSCHEME=${PROXYSCHEME##* }; PROXYSCHEME=${PROXYSCHEME%;*}
PROXYPORT=$(echo "${siteconfig}" | grep 'set $port')
PROXYPORT=${PROXYPORT##* }; PROXYPORT=${PROXYPORT%;*}
PROXYHOST_FULL="${PROXYSCHEME}://${PROXYHOST}:${PROXYPORT}"
#twofacline=$(echo "${autheliaconfig}" | grep -Fn two_factor | sort | tail -n1)
if [ "$(echo "${siteconfig}" | grep include/proxy.conf)" != "" ] || [ "$(echo "${siteconfig}" | grep proxy_pass)" != "" ]; then
SITE_TYPE='Proxy'
if [ "$(echo "${siteconfig}" | grep include/proxy.conf)" != "" ]; then
PROXYHOST=$(echo "${siteconfig}" | grep 'set $server')
PROXYHOST=${PROXYHOST#*\"}; PROXYHOST=${PROXYHOST%\"*}
PROXYSCHEME=$(echo "${siteconfig}" | grep 'set $forward_scheme')
PROXYSCHEME=${PROXYSCHEME##* }; PROXYSCHEME=${PROXYSCHEME%;*}
PROXYPORT=$(echo "${siteconfig}" | grep 'set $port')
PROXYPORT=${PROXYPORT##* }; PROXYPORT=${PROXYPORT%;*}
PROXYHOST_FULL="${PROXYSCHEME}://${PROXYHOST}:${PROXYPORT}"
else
PROXYHOST_FULL="[ custom proxy_pass ]"
fi
else
PROXYHOST_FULL="[ custom proxy_pass ]"
SITE_TYPE='HTTP'
PROXYHOST_FULL=''
fi
else
SITE_TYPE='HTTP'
PROXYHOST_FULL=''
fi
server=$(echo "${siteconfig}" | grep 'set $port')
server=$(echo "${siteconfig}" | grep 'set $port')
[ "$(echo "${siteconfig}" | grep \#ssl_certificate)" != "" ] && SSL='' || SSL='Yes'
[ "$(echo "${siteconfig}" | grep '\#include conf.d/include/hsts-support.conf')" != "" ] && HSTS='' || HSTS='Yes'
[ "$(echo "${siteconfig}" | grep '\#include conf.d/include/websocket-support.conf')" != "" ] && WEBSOCKET='' || WEBSOCKET='Yes'
[ "$(echo "${siteconfig}" | grep '\#include conf.d/include/block-exploits.conf')" != "" ] && EXPLOITS='' || EXPLOITS='Yes'
[ "$(echo "${siteconfig}" | grep \#ssl_certificate)" != "" ] && SSL='' || SSL='Yes'
[ "$(echo "${siteconfig}" | grep '\#include conf.d/include/hsts-support.conf')" != "" ] && HSTS='' || HSTS='Yes'
[ "$(echo "${siteconfig}" | grep '\#include conf.d/include/websocket-support.conf')" != "" ] && WEBSOCKET='' || WEBSOCKET='Yes'
[ "$(echo "${siteconfig}" | grep '\#include conf.d/include/block-exploits.conf')" != "" ] && EXPLOITS='' || EXPLOITS='Yes'
if [ "$(echo "${siteconfig}" | grep '\#include conf.d/include/secure-access.conf')" == "" ]; then
sitefacline=$(echo "${autheliaconfig}" | grep -Fn ${SITENAME})
sitefacline=${sitefacline%%:*}
if [ "${sitefacline}" == "" ]; then
SECURE='error'
# ssh root@${NM_AUTHELIA_IP} "sed -ie \"/domain: # Proxies only requiring username and password/a ~~~ - \\\"${SITENAME}\\\"\" ${NM_DOCKER_COMPOSE_LOC['authelia']}/config/configuration.yml"
# ssh root@${NM_AUTHELIA_IP} "sed -i \"s/~~~/ /g\" ${NM_DOCKER_COMPOSE_LOC['authelia']}/config/configuration.yml"
elif [ ${sitefacline} -lt ${onefacline} ]; then
SECURE='1FA'
elif [ ${sitefacline} -lt ${twofacline} ]; then
SECURE='2FA'
if [ "$(echo "${siteconfig}" | grep '\#include conf.d/include/secure-access.conf')" == "" ]; then
sitefacline=$(echo "${autheliaconfig}" | grep -Fn ${SITENAME})
sitefacline=${sitefacline%%:*}
if [ "${sitefacline}" == "" ]; then
SECURE='error'
# ssh root@${NM_AUTHELIA_IP} "sed -ie \"/domain: # Proxies only requiring username and password/a ~~~ - \\\"${SITENAME}\\\"\" ${NM_DOCKER_COMPOSE_LOC['authelia']}/config/configuration.yml"
# ssh root@${NM_AUTHELIA_IP} "sed -i \"s/~~~/ /g\" ${NM_DOCKER_COMPOSE_LOC['authelia']}/config/configuration.yml"
elif [ ${sitefacline} -lt ${onefacline} ]; then
SECURE='1FA'
elif [ ${sitefacline} -lt ${twofacline} ]; then
SECURE='2FA'
fi
else
SECURE=''
fi
else
SECURE=''
fi
[ ${i} -lt 10 ] && ii=" ${i}" || ii=${i}
[ ${EDIT} -eq 1 ] && msg1="${ii}) ${SITENAME}" || msg1="${SITENAME}"
echo -en "${idsCL[White]}"
if [ ${EDIT} -eq 1 ]; then
printf "%-32s %-8s %-6s %-6s %-6s %-6s %-6s %-14s\n" "${msg1}" "${SITE_TYPE}" "${SSL}" "${HSTS}" "${WEBSOCKET}" "${EXPLOITS}" "${SECURE}" "${PROXYHOST_FULL}"
else
printf "%-28s %-8s %-6s %-6s %-6s %-6s %-6s %-14s\n" "${msg1}" "${SITE_TYPE}" "${SSL}" "${HSTS}" "${WEBSOCKET}" "${EXPLOITS}" "${SECURE}" "${PROXYHOST_FULL}"
fi
echo -en "${idsCL[Default]}"
SITELIST[${i}]=${SITENAME}
i=`expr $i + 1`
done
[ ${i} -lt 10 ] && ii=" ${i}" || ii=${i}
[ ${EDIT} -eq 1 ] && msg1="${ii}) ${SITENAME}" || msg1="${SITENAME}"
echo -en "${idsCL[White]}"
if [ ${EDIT} -eq 1 ]; then
printf "%-32s %-8s %-6s %-6s %-6s %-6s %-6s %-14s\n" "${msg1}" "${SITE_TYPE}" "${SSL}" "${HSTS}" "${WEBSOCKET}" "${EXPLOITS}" "${SECURE}" "${PROXYHOST_FULL}"
else
printf "%-28s %-8s %-6s %-6s %-6s %-6s %-6s %-14s\n" "${msg1}" "${SITE_TYPE}" "${SSL}" "${HSTS}" "${WEBSOCKET}" "${EXPLOITS}" "${SECURE}" "${PROXYHOST_FULL}"
fi
echo -en "${idsCL[Default]}"
SITELIST[${i}]=${SITENAME}
i=`expr $i + 1`
done
else
echo -e "\n${idsCL[LightCyan]}No sites were found matching '${SEARCH}'${idsCL[Default]}"
fi
echo