]> git.giorgioravera.it Git - scripts.git/commitdiff
Added Xenserver
authorGiorgio Ravera <giorgio.ravera@gmail.com>
Wed, 11 Mar 2020 21:42:59 +0000 (22:42 +0100)
committerGiorgio Ravera <giorgio.ravera@gmail.com>
Wed, 11 Mar 2020 21:42:59 +0000 (22:42 +0100)
update_certificate
update_certificate_xenserver [new file with mode: 0755]

index e5e0759600d0997f216957d03b8303b9e2660833..00f47064ab4c14adff7029082a2c17f537b63b67 100755 (executable)
@@ -16,17 +16,18 @@ else
 fi
 echo ""
 
-# XOA
+# Docker
 echo " ------------------------------- "
-echo "| Updating XOA Certificate      |"
+echo "| Updating Docker Certificate   |"
 echo " ------------------------------- "
-host="xoa.giorgioravera.it"
+host="docker.giorgioravera.it"
 user="root"
 ALIVE=$(ping -c 1 $host |grep ttl)
 if [ ! -z "$ALIVE" ]; then
        rsync -rlptDv /etc/letsencrypt/archive $user@$host:/etc/letsencrypt/
        rsync -rlptDv /etc/letsencrypt/live $user@$host:/etc/letsencrypt/
-       ssh $user@$host systemctl restart xo-server.service
+#      ssh $user@$host systemctl restart xo-server.service
+       ssh $user@$host docker container restart traefik
 else
        echo "Host $host not alive, skipped"
 fi
@@ -83,3 +84,17 @@ else
        echo "Host $host not alive, skipped"
 fi
 echo ""
+
+# Xenserver
+echo " ------------------------------- "
+echo "| Updating Xenserver Certificate |"
+echo " ------------------------------- "
+host="xenserver.giorgioravera.it"
+user="root"
+ALIVE=$(ping -c 1 $host |grep ttl)
+if [ ! -z "$ALIVE" ]; then
+       update_certificate_xenserver
+else
+       echo "Host $host not alive, skipped"
+fi
+echo ""
diff --git a/update_certificate_xenserver b/update_certificate_xenserver
new file mode 100755 (executable)
index 0000000..34cb8f8
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+# Parameters
+host='xenserver.giorgioravera.it'
+username="root"
+cert_path="/etc/letsencrypt/live/server.giorgioravera.it"
+keyname="letsencrypt"
+certificate="cert.pem"
+privatekey="privkey.pem"
+
+# Moving into temp dir
+cd /tmp
+
+# Replace old cert & key
+cat $cert_path/$privatekey > xapi-ssl.pem
+cat $cert_path/$certificate >> xapi-ssl.pem
+scp xapi-ssl.pem $username@$host:/etc/xensource
+ssh $username@$host chmod 400 /etc/xensource/xapi-ssl.pem
+ssh $username@$host systemctl restart xapi.service
+
+# Clean directory
+rm xapi-ssl.pem