|
|
@@ -0,0 +1,78 @@
|
|
|
+#!/bin/bash
|
|
|
+#Cert replacement script
|
|
|
+
|
|
|
+orig_cert_loc=/etc/pki/tls/certs/6628673501320294007.crt
|
|
|
+orig_key_loc=/etc/pki/tls/private/6628673501320294007.key
|
|
|
+orig_mellon_file1=/etc/httpd/mellon/monitoring-rp_idp_metadata.xml
|
|
|
+orig_mellon_file2=/etc/httpd/mellon/monitoring-rp_sp.xml
|
|
|
+new_cert_loc=/home/recovery/csiwildcard2022.crt
|
|
|
+new_key_loc=/home/recovery/csiltd2022.key.new
|
|
|
+new_mellon_file1=/home/recovery/monitoring-rp_idp_metadata.xml.new
|
|
|
+new_mellon_file2=/home/recovery/monitoring-rp_sp.xml.new
|
|
|
+
|
|
|
+timestamp=$(date +%Y%m%d-%k%M%S)
|
|
|
+
|
|
|
+
|
|
|
+if [ "$EUID" -ne 0 ]
|
|
|
+ then echo "Please run as root"
|
|
|
+ exit
|
|
|
+fi
|
|
|
+
|
|
|
+echo "Backing up old keys and certificate"
|
|
|
+
|
|
|
+cp $orig_cert_loc $orig_cert_loc.$timestamp
|
|
|
+echo "Saved "$orig_cert_loc" to "$orig_cert_loc.$timestamp
|
|
|
+
|
|
|
+cp $orig_key_loc $orig_key_loc.$timestamp
|
|
|
+echo "Saved "$orig_cert_loc" to "$orig_cert_loc.$timestamp
|
|
|
+
|
|
|
+echo "Putting new Keys/certs in place"
|
|
|
+cp -f $new_cert_loc $orig_cert_loc
|
|
|
+chmod 644 $orig_cert_loc
|
|
|
+cp -f $new_key_loc $orig_key_loc
|
|
|
+chmod 600 $orig_key_loc
|
|
|
+
|
|
|
+echo Apache keys/cert updated
|
|
|
+echo "Do you want to restart Apache (Y/N)"
|
|
|
+read reply
|
|
|
+answer=$(echo $reply|tr "[:lower:]" "[:upper:]")
|
|
|
+
|
|
|
+if [ $answer = 'Y' ] || [ $answer = 'YES' ]
|
|
|
+ then systemctl restart httpd
|
|
|
+ if [ $? <> 0 ]
|
|
|
+ then echo 'Error restarting Apache please investigate'
|
|
|
+ #exit
|
|
|
+ fi
|
|
|
+else
|
|
|
+ exit
|
|
|
+fi
|
|
|
+
|
|
|
+echo "Backing up and applying mod_auth_merllon changes"
|
|
|
+
|
|
|
+
|
|
|
+cp $orig_cert_loc $orig_cert_loc.$timestamp
|
|
|
+echo "Saved "$orig_mellon_file1" to "$orig_mellon_file1.$timestamp
|
|
|
+
|
|
|
+cp $orig_mellon_file1 $orig_mellon_file1.$timestamp
|
|
|
+echo "Saved "$orig_mellon_file2" to "$orig_mellon_file2.$timestamp
|
|
|
+
|
|
|
+echo "Putting new Keys/certs in place"
|
|
|
+cp -f $new_mellon_file1 $orig_mellon_file1
|
|
|
+chmod 644 $orig_mellon_file1
|
|
|
+cp -f $new_mellon_file2 $orig_mellon_file2
|
|
|
+chmod 644 $orig_mellon_file2
|
|
|
+
|
|
|
+echo "mod_auth_merllon files updated"
|
|
|
+echo "Do you want to restart Apache (Y/N) (Only do this once Wintel have replaced the cert in Pingfederate)"
|
|
|
+read reply
|
|
|
+answer=$(echo $reply|tr "[:lower:]" "[:upper:]")
|
|
|
+
|
|
|
+if [ $answer = 'Y' ] || [ $answer = 'YES' ]
|
|
|
+ then systemctl restart httpd
|
|
|
+ if [ $? <> 0 ]
|
|
|
+ then echo 'Error restarting Apache please investigate'
|
|
|
+ #exit
|
|
|
+ fi
|
|
|
+else
|
|
|
+ exit
|
|
|
+fi
|