Remove any previous private key when adding letsencrypt cert

This commit is contained in:
Bob Mottram 2015-12-12 09:54:04 +00:00
parent 1951eafc40
commit 0a72fa029f
1 changed files with 4 additions and 0 deletions

View File

@ -192,6 +192,8 @@ if [ $LETSENCRYPT_HOSTNAME ]; then
if [ -f /etc/ssl/private/${LETSENCRYPT_HOSTNAME}.key ]; then
if [ ! -f /etc/ssl/private/${LETSENCRYPT_HOSTNAME}.key.old ]; then
mv /etc/ssl/private/${LETSENCRYPT_HOSTNAME}.key /etc/ssl/private/${LETSENCRYPT_HOSTNAME}.key.old
else
rm -f /etc/ssl/private/${LETSENCRYPT_HOSTNAME}.key
fi
fi
ln -s /etc/letsencrypt/live/${LETSENCRYPT_HOSTNAME}/privkey.pem /etc/ssl/private/${LETSENCRYPT_HOSTNAME}.key
@ -200,6 +202,8 @@ if [ $LETSENCRYPT_HOSTNAME ]; then
if [ -f /etc/ssl/certs/${LETSENCRYPT_HOSTNAME}.pem ]; then
if [ ! -f /etc/ssl/certs/${LETSENCRYPT_HOSTNAME}.pem.old ]; then
mv /etc/ssl/certs/${LETSENCRYPT_HOSTNAME}.pem /etc/ssl/certs/${LETSENCRYPT_HOSTNAME}.pem.old
else
rm -f /etc/ssl/certs/${LETSENCRYPT_HOSTNAME}.pem
fi
fi
ln -s /etc/letsencrypt/live/${LETSENCRYPT_HOSTNAME}/fullchain.pem /etc/ssl/certs/${LETSENCRYPT_HOSTNAME}.pem