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
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`
echo -e "${NEW_CERT}\n${daterun}" > ${NM_FOLDER}/cert-request.lastrun
yes | cp -rfH ${NM_FOLDER}/cert-request.lastrun ${NM_CERTPATH}/cert-request.lastrun
echo -e "${NEW_CERT}\n${daterun}" > ${NM_LOGFOLDER}/cert-request.lastrun
yes | cp -rfH ${NM_LOGFOLDER}/cert-request.lastrun ${NM_CERTPATH}/cert-request.lastrun
DIVIDER true
if [ "${2}" != "newsite" ] && [ "${NM_HOSTS['LB']}" != "" ]; then
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
sleep 5
$CERT_DAEMON renew --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_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_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_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_LOGFOLDER}/cert-renewal.lastrun
CONCAT_SSL
chown -R root:le ${NM_CERTPATH} 2>&1 | tee -a ${NM_FOLDER}/cert-renewal.lastrun
chmod -R 6775 ${NM_CERTPATH} 2>&1 | tee -a ${NM_FOLDER}/cert-renewal.lastrun
yes | cp -rfH ${NM_FOLDER}/cert-renewal.lastrun ${NM_CERTPATH}/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_LOGFOLDER}/cert-renewal.lastrun
yes | cp -rfH ${NM_LOGFOLDER}/cert-renewal.lastrun ${NM_CERTPATH}/cert-renewal.lastrun
daterun=`date +%Y-%m-%d-%H-%M-%S`
echo -e "${daterun}" >> ${NM_CERTPATH}/cert-renewal.lastrun
DIVIDER true
@@ -146,7 +146,7 @@ CERTRENEW(){
# ssh root@webserver-node2.scity.us service nginx start
# echo -e "${idsCL[LightGreen]} Completed${idsCL[Default]}"
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
if [ -z $action ] || [ "${action}" = "gui" ]; then
@@ -155,18 +155,18 @@ CERTRENEW(){
fi
}
NIGHTLYRENEW(){
# rm -f ${NM_FOLDER}/cert-renewal.lastrun
# rm -f ${NM_LOGFOLDER}/cert-renewal.lastrun
# ssh root@webserver-node2.scity.us service nginx stop
# 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
chown -R root:le ${NM_CERTPATH} &>> ${NM_FOLDER}/cert-renewal.lastrun
chmod -R 6775 ${NM_CERTPATH} &>> ${NM_FOLDER}/cert-renewal.lastrun
yes | cp -rfH ${NM_FOLDER}/cert-renewal.lastrun ${NM_CERTPATH}/cert-renewal.lastrun
chown -R root:le ${NM_CERTPATH} &>> ${NM_LOGFOLDER}/cert-renewal.lastrun
chmod -R 6775 ${NM_CERTPATH} &>> ${NM_LOGFOLDER}/cert-renewal.lastrun
yes | cp -rfH ${NM_LOGFOLDER}/cert-renewal.lastrun ${NM_CERTPATH}/cert-renewal.lastrun
daterun=`date +%Y-%m-%d-%H-%M-%S`
echo -e "${daterun}" >> ${NM_CERTPATH}/cert-renewal.lastrun
# 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(){
@@ -394,9 +394,9 @@ CHECK_NPMCERTS(){
CHECK-CERTS(){
if [ "${1}" == "check" ]; then
rm -f ${NM_FOLDER}/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
SSLLOG="$(cat ${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_LOGFOLDER}/ssl-cert-check.lastrun
SSLLOG="$(cat ${NM_LOGFOLDER}/ssl-cert-check.lastrun)"
SENDNOTICE "SSL Certs Check" "SSL Certs Check\n$SSLLOG"
else
# ${NM_FOLDER}/ssl-cert-check/ssl-cert-check -f ${NM_FOLDER}/conf/ssl-domain-checks.conf