From d17c2259fffd45c4203ada10a4eb3e44c8763827 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 8 Nov 2022 18:35:02 -0600 Subject: [PATCH] Update nodemgmt-scripts.sh --- nodemgmt-scripts.sh | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index da7efb32..26776c52 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -1941,7 +1941,8 @@ VCENTER-SSL(){ CERTDIR="${BASECERTDIR}/${VCHOSTNAME}" SERVER="https://${VCHOSTNAME}" CRED="administrator@scity.vs:$(pass iDSVC)" - VCUSER="administrator@scity.vs" + VCUSER="administrator@scity.vs" + CURRENTLIVE=/etc/vmware-rhttpproxy/ssl/rui.crt echo -en "${idsCL[LightCyan]}Checking days left on vCenter cert... ${idsCL[Default]}" VCCERTDAYS=$(${FOLDER}/ssl-cert-check/ssl-cert-check -p 443 -s ${VCHOSTNAME} -N) @@ -1959,7 +1960,17 @@ VCENTER-SSL(){ echo fi - echo -en "${idsCL[LightCyan]}Updating certificate on vCenter... ${idsCL[Default]}" + LIVEMD5=$(md5sum $CURRENTLIVE | cut -d\ -f1) + CURRENTMD5=$(md5sum $CERT | cut -d\ -f1) + if [ "$LIVEMD5" == "$CURRENTMD5" ]; then + echo -e "${idsCL[Yellow]}Certificates remains the same, no newer certificates exist${idsCL[Default]}" + echo + exit 0 + fi + + echo -e "${idsCL[Green]}Updating certificates on vCenter... ${idsCL[Default]}" + echo -e "${idsCL[LightCyan]}This process make take up to 10mins${idsCL[Default]}" + echo # eval $(awk '{ print "export " $1 }' /etc/sysconfig/vmware-environment) @@ -1986,18 +1997,18 @@ VCENTER-SSL(){ # -d "$REQUEST_BODY" # curl --insecure -X DELETE "$SERVER/rest/com/vmware/cis/session" -H "vmware-api-session-id: $SESSION_ID" - echo -e "${idsCL[Green]}Done${idsCL[Default]}" - echo + # echo -e "${idsCL[Green]}Done${idsCL[Default]}" + # echo - read -n 1 -s -p "Press any key to continue" + # read -n 1 -s -p "Press any key to continue" - echo -en "${idsCL[LightCyan]}Stopping vCenter services... ${idsCL[Default]}" - ssh -i ~/.ssh/id_rsa root@vcenter.scity.us 'service-control --stop --all' >/dev/null 2>&1 - echo -e "${idsCL[Green]}Done${idsCL[Default]}" - - echo -en "${idsCL[LightCyan]}Starting vCenter services... ${idsCL[Default]}" - ssh -i ~/.ssh/id_rsa root@vcenter.scity.us 'service-control --start --all' >/dev/null 2>&1 - echo -e "${idsCL[Green]}Done${idsCL[Default]}" + # echo -en "${idsCL[LightCyan]}Stopping vCenter services... ${idsCL[Default]}" + # ssh -i ~/.ssh/id_rsa root@vcenter.scity.us 'service-control --stop --all' >/dev/null 2>&1 + # echo -e "${idsCL[Green]}Done${idsCL[Default]}" + # + # echo -en "${idsCL[LightCyan]}Starting vCenter services... ${idsCL[Default]}" + # ssh -i ~/.ssh/id_rsa root@vcenter.scity.us 'service-control --start --all' >/dev/null 2>&1 + # echo -e "${idsCL[Green]}Done${idsCL[Default]}" echo echo -e "${idsCL[Green]}The vCenter certifcate has been updated${idsCL[Default]}"