Updating certbot-renewal script
This commit is contained in:
parent
bb6f4fa8cc
commit
f26dff8664
1 changed files with 15 additions and 3 deletions
|
@ -17,7 +17,7 @@ TARFILE_COMPRESS=$TARFILE'.gz'
|
|||
|
||||
if [[ $(hostname -I)[*] =~ $VIRTUAL_IP ]]; then
|
||||
echo "Current master - Processing renewals"
|
||||
certbot renew
|
||||
/usr/local/bin/certbot renew
|
||||
|
||||
# tar the letsencrypt directory for transferring to other members with symlinks
|
||||
tar cfP $TARFILE /etc/letsencrypt/
|
||||
|
@ -36,10 +36,22 @@ if [[ $(hostname -I)[*] =~ $VIRTUAL_IP ]]; then
|
|||
do
|
||||
if [[ ! $(hostname -I)[*] =~ $SERVER ]]; then
|
||||
# Transfer the files to the backup server
|
||||
sudo -u $USER scp -i $PRIVATE_KEY $TARFILE_COMPRESS $USER@$SERVER:~
|
||||
sudo -u $USER scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i $PRIVATE_KEY $TARFILE_COMPRESS $USER@$SERVER:~
|
||||
|
||||
# Deploy the current letsencrypt config/certs
|
||||
sudo -u $USER ssh -i $PRIVATE_KEY $USER@$SERVER "sudo rm -rf /etc/letsencrypt; sudo tar xzfP $TARFILE_COMPRESS && sudo rm $TARFILE_COMPRESS;sudo systemctl reload haproxy"
|
||||
sudo -u $USER ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i $PRIVATE_KEY $USER@$SERVER "sudo rm -rf /etc/letsencrypt; sudo tar xzfP $TARFILE_COMPRESS && sudo rm $TARFILE_COMPRESS;sudo systemctl reload haproxy"
|
||||
fi
|
||||
done
|
||||
|
||||
rm $TARFILE_COMPRESS
|
||||
fi
|
||||
|
||||
if [ -d "/etc/letsencrypt/live/" ]; then
|
||||
for Cert in /etc/letsencrypt/live/*/ ;
|
||||
do
|
||||
echo Processing $Cert
|
||||
cd $Cert
|
||||
cat fullchain.pem privkey.pem | dd status=none of="/etc/haproxy/ssl/$(basename $Cert).pem"
|
||||
done
|
||||
systemctl reload haproxy
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue