From: Christian Heller Date: Thu, 6 Dec 2018 01:39:30 +0000 (+0100) Subject: Add script for copying over LetsEncrypt certificates in migrations. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bprefix%7D%7D/balance?a=commitdiff_plain;h=c63f58ca5f80064da6ac82a92770ebd791e1c171;p=config Add script for copying over LetsEncrypt certificates in migrations. --- diff --git a/all_new_2018/letsencrypt_get.sh b/all_new_2018/letsencrypt_get.sh new file mode 100644 index 0000000..c2b3e9f --- /dev/null +++ b/all_new_2018/letsencrypt_get.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# Copy over LetsEncrypt certificates from another server. +set -e + +# Ensure we have a server name as argument. +if [ $# -lt 1 ]; then + echo "Need server as argument." + false +fi +server="$1" + +# Copy over. +ssh -t plom@${server} 'su -c "cd /etc/ && tar cf letsencrypt.tar letsencrypt && chown plom:plom letsencrypt.tar && mv letsencrypt.tar /home/plom/"' +scp plom@${server}:~/letsencrypt.tar . +apt -y install certbot +rmdir /etc/letsencrypt +mv letsencrypt.tar /etc/ +cd /etc/ +tar xf letsencrypt.tar +rm letsencrypt.tar