ca-install: support multiple webservers, update for new servers
authorClinton Ebadi <clinton@unknownlamer.org>
Sat, 15 Dec 2018 17:19:07 +0000 (12:19 -0500)
committerClinton Ebadi <clinton@unknownlamer.org>
Sat, 15 Dec 2018 17:19:07 +0000 (12:19 -0500)
ca-install

index 14e66fc..60419ea 100755 (executable)
@@ -31,7 +31,7 @@ else
     KEY=$4
 fi
 
     KEY=$4
 fi
 
-WEBSERVER=navajos.hcoop.net
+WEBSERVERS="shelob.hcoop.net"
 
 function verify_cert () {
     if test -z "$2" || test -n "$3"; then
 
 function verify_cert () {
     if test -z "$2" || test -n "$3"; then
@@ -57,7 +57,7 @@ function verify_cert () {
 }
 
 # Make sure we run this from an admin host...
 }
 
 # Make sure we run this from an admin host...
-if test "$(hostname -s)" != "fritz"; then
+if test "$(hostname -s)" != "gibran"; then
     echo "Error: This script must be run from fritz."
     exit 1
 fi
     echo "Error: This script must be run from fritz."
     exit 1
 fi
@@ -124,12 +124,18 @@ echo
 # Copy complete certificate to webserver
 if test -z "$KEY"; then
     echo "Installing certificate to Apache SSL directory ..."
 # Copy complete certificate to webserver
 if test -z "$KEY"; then
     echo "Installing certificate to Apache SSL directory ..."
-    < "$CERT" ssh $WEBSERVER sudo tee "$APACHE_DEST" > /dev/null
+    for WEBSERVER in $WEBSERVERS; do
+       < "$CERT" ssh $WEBSERVER sudo tee "$APACHE_DEST" > /dev/null
+    done
 else
     echo "Installing certificate and key to Apache SSL directory ..."
 else
     echo "Installing certificate and key to Apache SSL directory ..."
-    cat "$CERT" "$KEY" | ssh $WEBSERVER sudo tee "$APACHE_DEST" > /dev/null
+    for WEBSERVER in $WEBSERVERS; do
+       cat "$CERT" "$KEY" | ssh $WEBSERVER sudo tee "$APACHE_DEST" > /dev/null
+    done
 fi
 fi
-ssh $WEBSERVER sudo chmod 400 "$APACHE_DEST" > /dev/null
+for WEBSERVER in $WEBSERVERS; do
+    ssh $WEBSERVER sudo chmod 400 "$APACHE_DEST" > /dev/null
+done
 echo
 
 # Grant Domtool permissions
 echo
 
 # Grant Domtool permissions
@@ -138,7 +144,9 @@ domtool-admin grant $MEMBER cert "$APACHE_DEST"
 echo
 
 echo "Restarting apache ..."
 echo
 
 echo "Restarting apache ..."
-ssh $WEBSERVER sudo apache2ctl restart
+for WEBSERVER in $WEBSERVERS; do
+    ssh $WEBSERVER sudo apache2ctl graceful
+done
 echo
 
 # Tell admin what to do
 echo
 
 # Tell admin what to do