Created
July 28, 2017 15:01
-
-
Save mrksdiehl/4be12c7a6337b908518bfe6ff1169c37 to your computer and use it in GitHub Desktop.
Script to automatically check and renew vesta ssl certificate if outdated
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# first run | |
# v-add-letsencrypt-domain or add them from control panel | |
# vi /etc/cron.daily/vesta_ssl | |
# chmod +x /etc/cron.daily/vesta_ssl | |
cert_src="/home/[USER]/conf/web/ssl.[DOMAIN].pem" | |
key_src="/home/[USER]/conf/web/ssl.[DOMAIN].key" | |
cert_dst="/usr/local/vesta/ssl/certificate.crt" | |
key_dst="/usr/local/vesta/ssl/certificate.key" | |
if ! cmp -s $cert_dst $cert_src | |
then | |
# Copy Certificate | |
cp $cert_src $cert_dst | |
# Copy Keyfile | |
cp $key_src $key_dst | |
# Change Permission | |
chown root:mail $cert_dst | |
chown root:mail $key_dst | |
# Restart Services | |
service vesta restart &> /dev/null | |
service exim4 restart &> /dev/null | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From: https://forum.vestacp.com/viewtopic.php?f=19&t=13057