hcoop-kprop: invert grep exit status to shut cron up
[hcoop/scripts.git] / ca-install
index 3eb2d5c..14e66fc 100755 (executable)
@@ -102,7 +102,7 @@ fi
 echo
 
 # Determine whether we need to concatenate a private key
-if grep "^-----BEGIN PRIVATE KEY-----" "$CERT" > /dev/null; then
+if openssl rsa -noout -check -in "$CERT" > /dev/null; then
     KEY=
 else
     if test -z "$KEY"; then
@@ -128,8 +128,8 @@ if test -z "$KEY"; then
 else
     echo "Installing certificate and key to Apache SSL directory ..."
     cat "$CERT" "$KEY" | ssh $WEBSERVER sudo tee "$APACHE_DEST" > /dev/null
-    ssh $WEBSERVER sudo chmod 400 "$APACHE_DEST" > /dev/null
 fi
+ssh $WEBSERVER sudo chmod 400 "$APACHE_DEST" > /dev/null
 echo
 
 # Grant Domtool permissions