From 000346180edb9aea7cf942905952d18e00a3e506 Mon Sep 17 00:00:00 2001 From: Clinton Ebadi Date: Sat, 15 Dec 2018 12:19:07 -0500 Subject: [PATCH] ca-install: support multiple webservers, update for new servers --- ca-install | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/ca-install b/ca-install index 14e66fc..60419ea 100755 --- a/ca-install +++ b/ca-install @@ -31,7 +31,7 @@ else KEY=$4 fi -WEBSERVER=navajos.hcoop.net +WEBSERVERS="shelob.hcoop.net" 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... -if test "$(hostname -s)" != "fritz"; then +if test "$(hostname -s)" != "gibran"; then 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 ..." - < "$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 ..." - 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 -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 @@ -138,7 +144,9 @@ domtool-admin grant $MEMBER cert "$APACHE_DEST" 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 -- 2.20.1