Update sites.inc

This commit is contained in:
2023-05-25 19:15:43 -05:00
parent eff679ea52
commit cc750142a9

View File

@@ -347,7 +347,7 @@ NEWSITE(){
if [ "${CREATE_SSL}" = "yes" ]; then
echo -e "
ssl_certificate /etc/letsencrypt/live/${MAIN_SITE}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/${MAIN_SITE}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/${MAIN_SITE}/privkey.pem;
include conf.d/include/ssl-ciphers.conf;" >> /etc/nginx/sites-available/${MAIN_SITE}
fi
@@ -502,7 +502,7 @@ SITEINFO(){
proxyhost=''
fi
[ "$(grep ssl_certificate ${sitefile})" != "" ] && ssl='Yes' || ssl=''
[ "$(grep ssl_certificate_key ${sitefile})" != "" ] && ssl='Yes' || ssl=''
[ "$(grep include/hsts-support.conf ${sitefile})" != "" ] && hsts='Yes' || hsts=''
[ "$(grep include/websocket-support.conf ${sitefile})" != "" ] && wbskt='Yes' || wbskt=''
[ "$(grep include/secure-access.conf ${sitefile})" != "" ] && lock='Yes' || lock=''
@@ -541,10 +541,23 @@ SITEINFO(){
fi
site=${SITELIST[${siteid}]}
sitefile=${!gosite}/${site}.conf
echo $sitefile
if [ "$(grep ssl_certificate ${sitefile})" != "" ]; then
certpath=$(grep ssl_certificate_key ${sitefile})
if [ "${certpath}" != "" ]; then
ssl='Yes'
certpath=${certpath%/*}; certpath=${certpath#* }
SUBJECT=$(openssl x509 -in ${certpath}/cert.pem -noout -subject|grep -oP '(?<=CN = )[^,]+'|sort -uV)
SUBJECTNAMES=$(openssl x509 -in ${certpath}/cert.pem -noout -text|grep -oP '(?<=DNS:|IP Address:)[^,]+'|sort -uV)
CERTEXPIRE=$(date -d "$(: | openssl x509 -in ${certpath}/cert.pem -text | grep 'Not After' |awk '{print $4,$5,$7}')" '+%s');
if [ "${SUBJECTNAMES}" != "" ]; then
SUBJECTNAMES=${SUBJECTNAMES//$'\n'/, }
# SUBJECTNAMES=$(echo $${SUBJECTNAMES} | sed "s/\n/, /g")
SUBJECTNAMES=$(echo ${SUBJECTNAMES} | sed "s/${SUBJECT}, //g")
SUBJECTNAMES=$(echo ${SUBJECTNAMES} | sed "s/, ${SUBJECT}//g")
SUBJECTNAMES=$(echo ${SUBJECTNAMES} | sed "s/${SUBJECT}//g")
SSLNAMES="${SUBJECT}, ${SUBJECTNAMES}"
else
SSLNAMES="${SUBJECT}"
fi
else
ssl='-'
fi
@@ -552,11 +565,11 @@ SITEINFO(){
[ "$(grep include/websocket-support.conf ${sitefile})" != "" ] && wbskt='Yes' || wbskt='-'
[ "$(grep include/secure-access.conf ${sitefile})" != "" ] && lock='Yes' || lock='-'
echo -e "${idsCL[Cyan]}!) Site: ${idsST[Bold]}${site}${idsST[Reset]}${idsCL[LightCyan]}"
echo -e "${idsCL[Cyan]}!) SSL: ${idsST[Bold]}${ssl}${idsST[Reset]}${idsCL[LightCyan]}"
echo -e "${idsCL[Cyan]}3) HSTS ${idsST[Bold]}${hsts}${idsST[Reset]}${idsCL[LightCyan]}"
echo -e "${idsCL[Cyan]}4) WbSkt: ${idsST[Bold]}${wbskt}${idsST[Reset]}${idsCL[LightCyan]}"
echo -e "${idsCL[Cyan]}5) Lock: ${idsST[Bold]}${lock}${idsST[Reset]}${idsCL[LightCyan]}"
echo -e "${idsCL[Cyan]}!) Site: ${idsST[Bold]}${site}${idsST[Reset]}"
echo -e "${idsCL[Cyan]}!) SSL: ${idsST[Bold]}${ssl}${idsST[Reset]} - ${idsCL[LightCyan]}${SSLNAMES}"
echo -e "${idsCL[Cyan]}3) HSTS ${idsST[Bold]}${hsts}${idsST[Reset]}"
echo -e "${idsCL[Cyan]}4) WbSkt: ${idsST[Bold]}${wbskt}${idsST[Reset]}"
echo -e "${idsCL[Cyan]}5) Lock: ${idsST[Bold]}${lock}${idsST[Reset]}"
echo -en "\n${idsCL[LightCyan]}Enter the line number to edit: ${idsCL[Default]}"
read edit
echo