This commit is contained in:
2023-07-16 21:30:39 -05:00
parent 07608977bf
commit 33901363ab
4 changed files with 39 additions and 39 deletions

View File

@@ -18,7 +18,7 @@ NEWCERT(){
echo -e "${idsCL[LightGreen]}Requesting Certificate for '${idsCL[Yellow]}${NEW_CERT}${idsCL[LightGreen]}'...${idsCL[Default]}"
echo
$CERT_DAEMON certonly --webroot -w /opt/lb-data/letsencrypt-acme-challenge -d ${NEW_CERT}
$CERT_DAEMON certonly --webroot -w ${NM_CERTPATH}/letsencrypt-acme-challenge -d ${NEW_CERT}
# $CERT_DAEMON certonly --dry-run --webroot -w /var/www/html -d ${NEW_CERT}
chown -R root:le ${NM_CERTPATH}
@@ -27,7 +27,7 @@ NEWCERT(){
if [ -d ${NM_CERTPATH}/live/${MAIN_CERT} ]; then
touch ${NM_CERTPATH}/live/${MAIN_CERT}/newcert
if [ -f /opt/lb-data/nginx/sites-enabled/${MAIN_CERT}.conf ]; then
if [ -f ${NM_NGINXPATH}/sites-enabled/${MAIN_CERT}.conf ]; then
rm -f ${NM_FOLDER}/cert-request.lastrun
daterun=`date +%Y-%m-%d-%H-%M-%S`
echo -e "${NEW_CERT}\n${daterun}" > ${NM_FOLDER}/cert-request.lastrun
@@ -120,15 +120,14 @@ DEL-SSL(){
echo -e "${idsCL[Green]}Completed${idsCL[Default]}"
fi
echo
# SERVICE nginx reload
echo -e "${idsCL[LightRed]}The SSL certificate has been removed fromt be nodes.${idsCL[Default]}"
fi
}
CERTRENEW(){
echo -en "${idsCL[LightCyan]}Stopping Webserver-Node2...${idsCL[Default]}"
ssh root@webserver-node2.scity.us service nginx stop
echo -e "${idsCL[LightGreen]} Completed${idsCL[Default]}"
# echo -en "${idsCL[LightCyan]}Stopping Webserver-Node2...${idsCL[Default]}"
# ssh root@webserver-node2.scity.us service nginx stop
# echo -e "${idsCL[LightGreen]} Completed${idsCL[Default]}"
echo
echo -e "${idsCL[LightGreen]}Renewing Certificates...${idsCL[Default]}"
echo
@@ -137,15 +136,15 @@ CERTRENEW(){
# $CERT_DAEMON renew --force-renewal --preferred-chain "ISRG Root X1" --webroot -w /var/www/html 2>&1 | tee ${NM_FOLDER}/cert-renewal.lastrun
# $CERT_DAEMON --dry-run --preferred-chain "ISRG Root X1" renew --webroot -w /var/www/html 2>&1 | tee ${NM_FOLDER}/cert-renewal.lastrun
CONCAT_SSL
chown -R root:letsencrypt ${NM_CERTPATH} 2>&1 | tee -a ${NM_FOLDER}/cert-renewal.lastrun
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
daterun=`date +%Y-%m-%d-%H-%M-%S`
echo -e "${daterun}" >> ${NM_CERTPATH}/cert-renewal.lastrun
DIVIDER true
echo -en "${idsCL[LightCyan]}Starting Webserver-Node2 Back up...${idsCL[Default]}"
ssh root@webserver-node2.scity.us service nginx start
echo -e "${idsCL[LightGreen]} Completed${idsCL[Default]}"
# echo -en "${idsCL[LightCyan]}Starting Webserver-Node2 Back up...${idsCL[Default]}"
# ssh root@webserver-node2.scity.us service nginx start
# echo -e "${idsCL[LightGreen]} Completed${idsCL[Default]}"
echo
SERVICE nginx restart 2>&1 | tee -a ${NM_FOLDER}/cert-renewal.lastrun
echo -e "${idsCL[LightGreen]}The certificates have been renewed.${idsCL[Default]}"
@@ -156,17 +155,17 @@ CERTRENEW(){
fi
}
NIGHTLYRENEW(){
rm -f ${NM_FOLDER}/cert-renewal.lastrun
ssh root@webserver-node2.scity.us service nginx stop
sleep 5
# rm -f ${NM_FOLDER}/cert-renewal.lastrun
# ssh root@webserver-node2.scity.us service nginx stop
# sleep 5
$CERT_DAEMON renew --webroot -w /var/www/html &>> ${NM_FOLDER}/cert-renewal.lastrun
CONCAT_SSL
chown -R root:letsencrypt ${NM_CERTPATH} &>> ${NM_FOLDER}/cert-renewal.lastrun
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
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
# ssh root@webserver-node2.scity.us service nginx start
SERVICE nginx reload web &>> ${NM_FOLDER}/cert-renewal.lastrun
}