This commit is contained in:
2023-11-12 14:04:15 -06:00
parent bf2b54a802
commit aff13a0daf
2 changed files with 85 additions and 85 deletions

View File

@@ -7,7 +7,7 @@ NEWCERT(){
else else
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case "${1}" in case "${1}" in
-test) CERTTEST=1;; -test|-t) CERTTEST=1;;
*) NEW_CERT=${1};; *) NEW_CERT=${1};;
esac esac
shift shift

View File

@@ -165,7 +165,7 @@ NEWSITE(){
echo echo
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case "$1" in case "$1" in
-test) CERTTEST=1;; -test|-t) CERTTEST=1;;
-site) NEW_SITE=${2};; -site) NEW_SITE=${2};;
-type) SITE_TYPE=${2};; -type) SITE_TYPE=${2};;
-ssl) CREATE_SSL=${2};; -ssl) CREATE_SSL=${2};;
@@ -616,6 +616,14 @@ NEWPROXYSITE_CREATE(){
SITEINFO(){ SITEINFO(){
# start=`date +%s` # start=`date +%s`
dl=105 dl=105
EDIT=0; SEARCH=0
while [ $# -gt 0 ]; do
case "${1}" in
-edit|-e) EDIT=1;;
-search|-s) SEARCH=${2};;
esac
shift
done
if [ "${onefacline}" == "" ]; then if [ "${onefacline}" == "" ]; then
[ "$($NCMD /sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)" != "${NM_AUTHELIA_IP}" ] && ACMD="ssh root@${NM_AUTHELIA_IP}" || ACMD="" [ "$($NCMD /sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)" != "${NM_AUTHELIA_IP}" ] && ACMD="ssh root@${NM_AUTHELIA_IP}" || ACMD=""
@@ -626,7 +634,7 @@ SITEINFO(){
twofacline=${twofacline%%:*} twofacline=${twofacline%%:*}
fi fi
if [ "${1}" == "edit" ]; then if [ ${EDIT} -eq 1 ]; then
[ "${2}" == "" ] && echo -e "${idsCL[LightGreen]}Choose a site from the list below to edit: ${idsCL[Default]}" [ "${2}" == "" ] && echo -e "${idsCL[LightGreen]}Choose a site from the list below to edit: ${idsCL[Default]}"
else else
echo -e "${idsCL[LightGreen]}Local NGINX Sites ${idsCL[Default]}" echo -e "${idsCL[LightGreen]}Local NGINX Sites ${idsCL[Default]}"
@@ -634,20 +642,20 @@ SITEINFO(){
gosite=${NM_NGINXPATH[${RUN_NODE_TYPE}]}/sites-enabled gosite=${NM_NGINXPATH[${RUN_NODE_TYPE}]}/sites-enabled
declare -A SITELIST declare -A SITELIST
if [ "${gosite}" != "" ]; then if [ "${gosite}" != "" ]; then
if [ "${1}" != "" ] && [ "${1}" != "edit" ]; then if [ ${SEARCH} -ne 0 ]; then
sites=$(find ${gosite}/*${1,,}*.conf) sites=$(find ${gosite}/*${SEARCH,,}*.conf)
else else
sites=$(find ${gosite}/*.conf) sites=$(find ${gosite}/*.conf)
fi fi
i=0 i=0
# if [ "${1}" == "" ] || ([ "${1}" == "edit" ] && [ "${2}" == "" ]); then
for sitefile in ${sites[@]}; do for sitefile in ${sites[@]}; do
site=${sitefile##*/}; site=${site/.conf/} site=${sitefile##*/}; site=${site/.conf/}
if (( i % 12 == 0 )) || [ $i = 0 ]; then if (( i % 12 == 0 )) || [ $i = 0 ]; then
DIVIDER false yellow ${dl} DIVIDER false yellow ${dl}
[ "${1}" == "edit" ] && msg1='##) Site Address' || msg1='Site Address' [ ${EDIT} -eq 1 ] && msg1='##) Site Address' || msg1='Site Address'
echo -en "${idsST[Bold]}${idsCL[LightCyan]}" echo -en "${idsST[Bold]}${idsCL[LightCyan]}"
if [ "${1}" == "edit" ]; then if [ ${EDIT} -eq 1 ]; then
printf "%-32s %-8s %-6s %-6s %-6s %-6s %-6s %-8s\n" "${msg1}" "Type" "SSL" "HSTS" "WBSKT" "EXPLT" "LOCK" "Proxy Connection" printf "%-32s %-8s %-6s %-6s %-6s %-6s %-6s %-8s\n" "${msg1}" "Type" "SSL" "HSTS" "WBSKT" "EXPLT" "LOCK" "Proxy Connection"
else else
printf "%-28s %-8s %-6s %-6s %-6s %-6s %-6s %-8s\n" "${msg1}" "Type" "SSL" "HSTS" "WBSKT" "EXPLT" "LOCK" "Proxy Connection" printf "%-28s %-8s %-6s %-6s %-6s %-6s %-6s %-8s\n" "${msg1}" "Type" "SSL" "HSTS" "WBSKT" "EXPLT" "LOCK" "Proxy Connection"
@@ -700,8 +708,8 @@ SITEINFO(){
[ ${i} -lt 10 ] && ii=" ${i}" || ii=${i} [ ${i} -lt 10 ] && ii=" ${i}" || ii=${i}
[ "${1}" == "edit" ] && msg1="${ii}) ${site}" || msg1="${site}" [ ${EDIT} -eq 1 ] && msg1="${ii}) ${site}" || msg1="${site}"
if [ "${1}" == "edit" ]; then if [ ${EDIT} -eq 1 ]; then
printf "%-32s %-8s %-6s %-6s %-6s %-6s %-6s %-14s\n" "${msg1}" "${type}" "${ssl}" "${hsts}" "${wbskt}" "${explt}" "${lock}" "${proxyhost}" printf "%-32s %-8s %-6s %-6s %-6s %-6s %-6s %-14s\n" "${msg1}" "${type}" "${ssl}" "${hsts}" "${wbskt}" "${explt}" "${lock}" "${proxyhost}"
else else
printf "%-28s %-8s %-6s %-6s %-6s %-6s %-6s %-14s\n" "${msg1}" "${type}" "${ssl}" "${hsts}" "${wbskt}" "${explt}" "${lock}" "${proxyhost}" printf "%-28s %-8s %-6s %-6s %-6s %-6s %-6s %-14s\n" "${msg1}" "${type}" "${ssl}" "${hsts}" "${wbskt}" "${explt}" "${lock}" "${proxyhost}"
@@ -710,16 +718,8 @@ SITEINFO(){
SITELIST[${i}]=${site} SITELIST[${i}]=${site}
i=`expr $i + 1` i=`expr $i + 1`
done done
# else
# i=0
# for sitefile in ${sites[@]}; do
# site=${sitefile##*/}; site=${site/.conf/}
# SITELIST[${i}]=${site}
# i=`expr $i + 1`
# done
# fi
if [ "${1}" == "edit" ]; then if [ ${EDIT} -eq 1 ]; then
function exitspacing { function exitspacing {
echo -e "\n\033[K\n\033[K" echo -e "\n\033[K\n\033[K"