Update certs.inc
This commit is contained in:
@@ -647,9 +647,9 @@ VCENTER-SSL(){
|
||||
if [ "${NM_VC_HOSTNAME}" != "" ] && [ "${NM_VC_USER}" != "" ] && [ "${NM_VC_PASS}" != "" ] && [ "${NM_PDNS_APIKEY}" != "" ]; then
|
||||
VCSERVER="https://${NM_VC_HOSTNAME}"
|
||||
|
||||
VC_CERT="${NM_VC_ACMEFOLDER}/${NM_VC_HOSTNAME}_ecc/${NM_VC_HOSTNAME}.cer"
|
||||
VC_KEY="${NM_VC_ACMEFOLDER}/${NM_VC_HOSTNAME}_ecc/${NM_VC_HOSTNAME}.key"
|
||||
VC_CHAIN="${NM_VC_ACMEFOLDER}/${NM_VC_HOSTNAME}_ecc/fullchain.cer"
|
||||
VC_CERT="${NM_VC_ACMEFOLDER}/${NM_VC_HOSTNAME}/${NM_VC_HOSTNAME}.cer"
|
||||
VC_KEY="${NM_VC_ACMEFOLDER}/${NM_VC_HOSTNAME}/${NM_VC_HOSTNAME}.key"
|
||||
VC_CHAIN="${NM_VC_ACMEFOLDER}/${NM_VC_HOSTNAME}/fullchain.cer"
|
||||
|
||||
echo -en "${idsCL[LightCyan]}Checking days left on vCenter cert... ${idsCL[Default]}"
|
||||
VCCERTDAYS=$(${NM_FOLDER}/ssl-cert-check/ssl-cert-check -p 443 -s ${NM_VC_HOSTNAME} -N)
|
||||
@@ -688,7 +688,7 @@ export PDNS_Ttl=60
|
||||
ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${NM_VC_HOSTNAME} "${NM_VC_ACMEFOLDER}/${NM_VC_ACMESCRIPT} --upgrade"
|
||||
fi
|
||||
|
||||
if [ ! -d ${NM_VC_ACMEFOLDER}/${NM_VC_HOSTNAME}_ecc ];then
|
||||
if [ ! -d ${NM_VC_ACMEFOLDER}/${NM_VC_HOSTNAME} ];then
|
||||
echo -e "\n${idsCL[LightGreen]}Requesting new certificate ...${idsCL[Default]}\n"
|
||||
echo "export PDNS_ServerId='localhost'" >> /tmp/vcenter-update-ssl.sh
|
||||
echo "${NM_VC_ACMEFOLDER}/${NM_VC_ACMESCRIPT} --server letsencrypt -k 4096 --preferred-chain 'ISRG Root X1' --issue --dns dns_pdns -d ${NM_VC_HOSTNAME}" >> /tmp/vcenter-update-ssl.sh
|
||||
@@ -706,10 +706,10 @@ export PDNS_Ttl=60
|
||||
scp -q /tmp/vcenter-update-ssl.sh root@${NM_VC_HOSTNAME}:/tmp/vcenter-update-ssl.sh
|
||||
ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${NM_VC_HOSTNAME} "bash /tmp/vcenter-update-ssl.sh"
|
||||
|
||||
if ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${NM_VC_HOSTNAME} [ ! -f ${NM_VC_ACMEFOLDER}/${NM_VC_HOSTNAME}_ecc/${NM_VC_HOSTNAME}.cer ]; then
|
||||
if ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${NM_VC_HOSTNAME} [ ! -f ${NM_VC_ACMEFOLDER}/${NM_VC_HOSTNAME}/${NM_VC_HOSTNAME}.cer ]; then
|
||||
echo -e "${idsCL[LightYellow]}No certificate was created${idsCL[Default]}\n"
|
||||
exit 0
|
||||
elif ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${NM_VC_HOSTNAME} [ $(expr `date +%s` - $(stat -c %Y ${NM_VC_ACMEFOLDER}/${NM_VC_HOSTNAME}_ecc/${NM_VC_HOSTNAME}.cer)) -ge 600 ]; then
|
||||
elif ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${NM_VC_HOSTNAME} [ $(expr `date +%s` - $(stat -c %Y ${NM_VC_ACMEFOLDER}/${NM_VC_HOSTNAME}/${NM_VC_HOSTNAME}.cer)) -ge 600 ]; then
|
||||
echo -e "${idsCL[LightYellow]}The certificate was unable to be updated${idsCL[Default]}\n"
|
||||
exit 0
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user