This commit is contained in:
2023-08-11 16:04:46 -05:00
parent fef03b66ac
commit c2c669b852
3 changed files with 31 additions and 31 deletions

View File

@@ -28,10 +28,10 @@ NEWCERT(){
touch ${NM_CERTPATH}/live/${MAIN_CERT}/newcert touch ${NM_CERTPATH}/live/${MAIN_CERT}/newcert
if [ -f ${NM_NGINXPATH}/sites-enabled/${MAIN_CERT}.conf ]; then if [ -f ${NM_NGINXPATH}/sites-enabled/${MAIN_CERT}.conf ]; then
rm -f ${NM_FOLDER}/cert-request.lastrun rm -f ${NM_LOGFOLDER}/cert-request.lastrun
daterun=`date +%Y-%m-%d-%H-%M-%S` daterun=`date +%Y-%m-%d-%H-%M-%S`
echo -e "${NEW_CERT}\n${daterun}" > ${NM_FOLDER}/cert-request.lastrun echo -e "${NEW_CERT}\n${daterun}" > ${NM_LOGFOLDER}/cert-request.lastrun
yes | cp -rfH ${NM_FOLDER}/cert-request.lastrun ${NM_CERTPATH}/cert-request.lastrun yes | cp -rfH ${NM_LOGFOLDER}/cert-request.lastrun ${NM_CERTPATH}/cert-request.lastrun
DIVIDER true DIVIDER true
if [ "${2}" != "newsite" ] && [ "${NM_HOSTS['LB']}" != "" ]; then if [ "${2}" != "newsite" ] && [ "${NM_HOSTS['LB']}" != "" ]; then
echo -e -n "${idsCL[LightCyan]}Reload NGINX on LB Nodes (Y/n): ${idsCL[Default]}" echo -e -n "${idsCL[LightCyan]}Reload NGINX on LB Nodes (Y/n): ${idsCL[Default]}"
@@ -132,13 +132,13 @@ CERTRENEW(){
echo -e "${idsCL[LightGreen]}Renewing Certificates...${idsCL[Default]}" echo -e "${idsCL[LightGreen]}Renewing Certificates...${idsCL[Default]}"
echo echo
sleep 5 sleep 5
$CERT_DAEMON renew --webroot -w ${NM_CERTPATH}/letsencrypt-acme-challenge 2>&1 | tee ${NM_FOLDER}/cert-renewal.lastrun $CERT_DAEMON renew --webroot -w ${NM_CERTPATH}/letsencrypt-acme-challenge 2>&1 | tee ${NM_LOGFOLDER}/cert-renewal.lastrun
# $CERT_DAEMON renew --force-renewal --preferred-chain "ISRG Root X1" --webroot -w ${NM_CERTPATH}/letsencrypt-acme-challenge 2>&1 | tee ${NM_FOLDER}/cert-renewal.lastrun # $CERT_DAEMON renew --force-renewal --preferred-chain "ISRG Root X1" --webroot -w ${NM_CERTPATH}/letsencrypt-acme-challenge 2>&1 | tee ${NM_LOGFOLDER}/cert-renewal.lastrun
# $CERT_DAEMON --dry-run --preferred-chain "ISRG Root X1" renew --webroot -w ${NM_CERTPATH}/letsencrypt-acme-challenge 2>&1 | tee ${NM_FOLDER}/cert-renewal.lastrun # $CERT_DAEMON --dry-run --preferred-chain "ISRG Root X1" renew --webroot -w ${NM_CERTPATH}/letsencrypt-acme-challenge 2>&1 | tee ${NM_LOGFOLDER}/cert-renewal.lastrun
CONCAT_SSL CONCAT_SSL
chown -R root:le ${NM_CERTPATH} 2>&1 | tee -a ${NM_FOLDER}/cert-renewal.lastrun chown -R root:le ${NM_CERTPATH} 2>&1 | tee -a ${NM_LOGFOLDER}/cert-renewal.lastrun
chmod -R 6775 ${NM_CERTPATH} 2>&1 | tee -a ${NM_FOLDER}/cert-renewal.lastrun chmod -R 6775 ${NM_CERTPATH} 2>&1 | tee -a ${NM_LOGFOLDER}/cert-renewal.lastrun
yes | cp -rfH ${NM_FOLDER}/cert-renewal.lastrun ${NM_CERTPATH}/cert-renewal.lastrun yes | cp -rfH ${NM_LOGFOLDER}/cert-renewal.lastrun ${NM_CERTPATH}/cert-renewal.lastrun
daterun=`date +%Y-%m-%d-%H-%M-%S` daterun=`date +%Y-%m-%d-%H-%M-%S`
echo -e "${daterun}" >> ${NM_CERTPATH}/cert-renewal.lastrun echo -e "${daterun}" >> ${NM_CERTPATH}/cert-renewal.lastrun
DIVIDER true DIVIDER true
@@ -146,7 +146,7 @@ CERTRENEW(){
# ssh root@webserver-node2.scity.us service nginx start # ssh root@webserver-node2.scity.us service nginx start
# echo -e "${idsCL[LightGreen]} Completed${idsCL[Default]}" # echo -e "${idsCL[LightGreen]} Completed${idsCL[Default]}"
echo echo
SERVICE nginx reload 2>&1 | tee -a ${NM_FOLDER}/cert-renewal.lastrun SERVICE nginx reload 2>&1 | tee -a ${NM_LOGFOLDER}/cert-renewal.lastrun
echo -e "${idsCL[LightGreen]}The certificates have been renewed.${idsCL[Default]}" echo -e "${idsCL[LightGreen]}The certificates have been renewed.${idsCL[Default]}"
echo echo
if [ -z $action ] || [ "${action}" = "gui" ]; then if [ -z $action ] || [ "${action}" = "gui" ]; then
@@ -155,18 +155,18 @@ CERTRENEW(){
fi fi
} }
NIGHTLYRENEW(){ NIGHTLYRENEW(){
# rm -f ${NM_FOLDER}/cert-renewal.lastrun # rm -f ${NM_LOGFOLDER}/cert-renewal.lastrun
# ssh root@webserver-node2.scity.us service nginx stop # ssh root@webserver-node2.scity.us service nginx stop
# sleep 5 # sleep 5
$CERT_DAEMON renew --webroot -w ${NM_CERTPATH}/letsencrypt-acme-challenge &>> ${NM_FOLDER}/cert-renewal.lastrun $CERT_DAEMON renew --webroot -w ${NM_CERTPATH}/letsencrypt-acme-challenge &>> ${NM_LOGFOLDER}/cert-renewal.lastrun
CONCAT_SSL CONCAT_SSL
chown -R root:le ${NM_CERTPATH} &>> ${NM_FOLDER}/cert-renewal.lastrun chown -R root:le ${NM_CERTPATH} &>> ${NM_LOGFOLDER}/cert-renewal.lastrun
chmod -R 6775 ${NM_CERTPATH} &>> ${NM_FOLDER}/cert-renewal.lastrun chmod -R 6775 ${NM_CERTPATH} &>> ${NM_LOGFOLDER}/cert-renewal.lastrun
yes | cp -rfH ${NM_FOLDER}/cert-renewal.lastrun ${NM_CERTPATH}/cert-renewal.lastrun yes | cp -rfH ${NM_LOGFOLDER}/cert-renewal.lastrun ${NM_CERTPATH}/cert-renewal.lastrun
daterun=`date +%Y-%m-%d-%H-%M-%S` daterun=`date +%Y-%m-%d-%H-%M-%S`
echo -e "${daterun}" >> ${NM_CERTPATH}/cert-renewal.lastrun echo -e "${daterun}" >> ${NM_CERTPATH}/cert-renewal.lastrun
# ssh root@webserver-node2.scity.us service nginx start # ssh root@webserver-node2.scity.us service nginx start
SERVICE nginx reload web &>> ${NM_FOLDER}/cert-renewal.lastrun SERVICE nginx reload web &>> ${NM_LOGFOLDER}/cert-renewal.lastrun
} }
CONCAT_SSL(){ CONCAT_SSL(){
@@ -394,9 +394,9 @@ CHECK_NPMCERTS(){
CHECK-CERTS(){ CHECK-CERTS(){
if [ "${1}" == "check" ]; then if [ "${1}" == "check" ]; then
rm -f ${NM_FOLDER}/ssl-cert-check.lastrun rm -f ${NM_LOGFOLDER}/ssl-cert-check.lastrun
${NM_FOLDER}/ssl-cert-check/ssl-cert-check -f ${NM_FOLDER}/conf/ssl-domain-checks.conf > ${NM_FOLDER}/ssl-cert-check.lastrun ${NM_FOLDER}/ssl-cert-check/ssl-cert-check -f ${NM_FOLDER}/conf/ssl-domain-checks.conf > ${NM_LOGFOLDER}/ssl-cert-check.lastrun
SSLLOG="$(cat ${NM_FOLDER}/ssl-cert-check.lastrun)" SSLLOG="$(cat ${NM_LOGFOLDER}/ssl-cert-check.lastrun)"
SENDNOTICE "SSL Certs Check" "SSL Certs Check\n$SSLLOG" SENDNOTICE "SSL Certs Check" "SSL Certs Check\n$SSLLOG"
else else
# ${NM_FOLDER}/ssl-cert-check/ssl-cert-check -f ${NM_FOLDER}/conf/ssl-domain-checks.conf # ${NM_FOLDER}/ssl-cert-check/ssl-cert-check -f ${NM_FOLDER}/conf/ssl-domain-checks.conf

View File

@@ -460,11 +460,11 @@ NEWSITE(){
# fi # fi
fi fi
rm -f ${NM_FOLDER}/new-site.lastrun rm -f ${NM_LOGFOLDER}/new-site.lastrun
daterun=`date +%Y-%m-%d-%H-%M-%S` daterun=`date +%Y-%m-%d-%H-%M-%S`
echo -e "${NEW_SITE}\n${daterun}" > ${NM_FOLDER}/new-site.lastrun echo -e "${NEW_SITE}\n${daterun}" > ${NM_LOGFOLDER}/new-site.lastrun
# yes | cp -rfH ${NM_FOLDER}/new-site.lastrun ${NM_NGINXPATH}/new-site.lastrun # yes | cp -rfH ${NM_LOGFOLDER}/new-site.lastrun ${NM_NGINXPATH}/new-site.lastrun
# yes | cp -rfH ${NM_FOLDER}/new-site.lastrun /var/www/new-site.lastrun # yes | cp -rfH ${NM_LOGFOLDER}/new-site.lastrun /var/www/new-site.lastrun
# daterun=`date +%Y-%m-%d-%H-%M-%S` # daterun=`date +%Y-%m-%d-%H-%M-%S`
# echo -e "${daterun}" >> ${NM_NGINXPATH}/new-site.lastrun # echo -e "${daterun}" >> ${NM_NGINXPATH}/new-site.lastrun
DIVIDER true DIVIDER true

View File

@@ -38,7 +38,7 @@ BACKUP(){
echo -e "${idsCL[Yellow]}Not found${idsCL[Default]}" echo -e "${idsCL[Yellow]}Not found${idsCL[Default]}"
fi fi
done done
touch ${NM_FOLDER}/backup.lastrun touch ${NM_LOGFOLDER}/backup.lastrun
# if [ "${action}" != "backup" ]; then # if [ "${action}" != "backup" ]; then
echo echo
DIVIDER true DIVIDER true
@@ -822,17 +822,17 @@ GUI(){
echo -e "\n\n$(date) - Finished status check #############################\n" >> ${NM_TMPFOLDER}/status-check.running echo -e "\n\n$(date) - Finished status check #############################\n" >> ${NM_TMPFOLDER}/status-check.running
echo "$(date) - LOCAL - ${NODE_HOSTNAME} - Completed Status Check" >> ${NM_LOGFILE} echo "$(date) - LOCAL - ${NODE_HOSTNAME} - Completed Status Check" >> ${NM_LOGFILE}
rm -f ${NM_FOLDER}/status-check.lastrun rm -f ${NM_LOGFOLDER}/status-check.lastrun
mv ${NM_TMPFOLDER}/status-check.running ${NM_FOLDER}/status-check.lastrun mv ${NM_TMPFOLDER}/status-check.running ${NM_LOGFOLDER}/status-check.lastrun
# end_status=`date +%s` # end_status=`date +%s`
# runtime_status=$((end_status-start_status)) # runtime_status=$((end_status-start_status))
# echo -e "\nRuntime: ${runtime_status}" >> ${NM_FOLDER}/status-check.lastrun # echo -e "\nRuntime: ${runtime_status}" >> ${NM_LOGFOLDER}/status-check.lastrun
if [ "${3}" == "email" ]; then if [ "${3}" == "email" ]; then
echo -e "\n\n" >> ${NM_FOLDER}/status-check.lastrun echo -e "\n\n" >> ${NM_LOGFOLDER}/status-check.lastrun
DOWNLIST report >> ${NM_FOLDER}/status-check.lastrun DOWNLIST report >> ${NM_LOGFOLDER}/status-check.lastrun
STATUSLOG="$(cat ${NM_FOLDER}/status-check.lastrun)" STATUSLOG="$(cat ${NM_LOGFOLDER}/status-check.lastrun)"
SENDNOTICE "Status Report" "Status Report\n${STATUSLOG}" SENDNOTICE "Status Report" "Status Report\n${STATUSLOG}"
fi fi
else else
@@ -846,7 +846,7 @@ GUI(){
read -n1 choice read -n1 choice
case $choice in case $choice in
[Ll]) watch -n1 tail -n35 ${NM_TMPFOLDER}/status-check.running; echo;; [Ll]) watch -n1 tail -n35 ${NM_TMPFOLDER}/status-check.running; echo;;
[Pp]) echo; cat ${NM_FOLDER}/status-check.lastrun;; [Pp]) echo; cat ${NM_LOGFOLDER}/status-check.lastrun;;
esac esac
echo echo
fi;; fi;;