update
This commit is contained in:
@@ -679,29 +679,37 @@ export PDNS_Ttl=60
|
||||
scp -q /tmp/vcenter-update-ssl.sh root@${NM_VC_HOSTNAME}:/tmp/vcenter-update-ssl.sh
|
||||
ssh -q root@${NM_VC_HOSTNAME} "bash /tmp/vcenter-update-ssl.sh"
|
||||
|
||||
LIVEMD5=$(ssh -q root@${NM_VC_HOSTNAME} "md5sum /etc/vmware-rhttpproxy/ssl/rui.crt | cut -d\ -f1")
|
||||
CURRENTMD5=$(ssh -q root@${NM_VC_HOSTNAME} "md5sum ${VC_CERT} | cut -d\ -f1")
|
||||
if [ "$LIVEMD5" == "$CURRENTMD5" ] && [ "${1}" != "force" ]; then
|
||||
echo -e "${idsCL[Yellow]}Certificates remains the same, no newer certificates exist${idsCL[Default]}"
|
||||
echo
|
||||
if [ ! -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 [ $(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
|
||||
LIVEMD5=$(ssh -q root@${NM_VC_HOSTNAME} "md5sum /etc/vmware-rhttpproxy/ssl/rui.crt | cut -d\ -f1")
|
||||
CURRENTMD5=$(ssh -q root@${NM_VC_HOSTNAME} "md5sum ${VC_CERT} | cut -d\ -f1")
|
||||
if [ "$LIVEMD5" == "$CURRENTMD5" ] && [ "${1}" != "force" ]; then
|
||||
echo -e "${idsCL[LightYellow]}Certificates remains the same, no newer certificates exist${idsCL[Default]}\n"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
echo -e "${idsCL[LightGreen]}Updating certificates on vCenter... ${idsCL[Default]}"
|
||||
echo -e "${idsCL[LightCyan]}This process make take up to 10mins${idsCL[Default]}"
|
||||
echo
|
||||
|
||||
ssh -q root@${NM_VC_HOSTNAME} "(printf '1\n%s\n' '${NM_VC_USER}'; sleep 1; printf '%s\n' '${NM_VC_PASS}'; sleep 1; printf '2\n'; sleep 1; printf '%s\n%s\n%s\ny\n\n' '${VC_CERT}' '${VC_KEY}' '${VC_CHAIN}') | setsid /usr/lib/vmware-vmca/bin/certificate-manager"
|
||||
# ssh -q root@${NM_VC_HOSTNAME} "(printf '1\n%s\n' '${NM_VC_USER}'; sleep 1; printf '%s\n' '${NM_VC_PASS}'; sleep 1; printf '2\n'; sleep 1; printf '%s\n%s\n%s\ny\n\n' '${VC_CERT}' '${VC_KEY}' '${VC_CHAIN}') | setsid /usr/lib/vmware-vmca/bin/certificate-manager"
|
||||
|
||||
SENDNOTICE "vCenter SSL Updated" "Refresh/rescan any systems connecting to vcenter like Veeam"
|
||||
SENDNOTICE "vCenter SSL Updated" "Refresh/Reconnect any systems connecting to vCenter, like Veeam Dummy!"
|
||||
echo "$(date +%Y-%m-%d-%H-%M-%S) VCENTER SSL HAS BEEN UPDATED" >> ${NM_LOGFOLDER}/vc-ssl.log
|
||||
|
||||
ssh -q root@${NM_VC_HOSTNAME} "rm -f /tmp/vcenter-update-ssl.sh"
|
||||
rm -f /tmp/vcenter-update-ssl.sh
|
||||
|
||||
echo -e "\n${idsCL[Green]}The vCenter certifcate has been updated${idsCL[Default]}"
|
||||
echo -e "${idsCL[LightCyan]}Don't forget to re-scan the vCenter connection in Veeam${idsCL[Default]}\n"
|
||||
echo -e "${idsCL[LightCyan]}Don't forget to redo the vCenter connection in Veeam${idsCL[Default]}\n"
|
||||
else
|
||||
echo -e "${idsCL[Yellow]}vCenter info not configured in 'defaults.local.inc'${idsCL[Default]}\n"
|
||||
echo -e "${idsCL[LightYellow]}vCenter info not configured in 'defaults.local.inc'${idsCL[Default]}\n"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user