Renew letsencrypt certs by default
This commit is contained in:
parent
2dc6ccebe9
commit
d2ab7bbe18
|
@ -172,7 +172,7 @@ function add_cert_letsencrypt {
|
||||||
systemctl stop nginx
|
systemctl stop nginx
|
||||||
|
|
||||||
cd ${INSTALL_DIR}/letsencrypt
|
cd ${INSTALL_DIR}/letsencrypt
|
||||||
./letsencrypt-auto certonly --server $LETSENCRYPT_SERVER --standalone -d $LETSENCRYPT_HOSTNAME
|
./letsencrypt-auto certonly --server $LETSENCRYPT_SERVER --standalone -d $LETSENCRYPT_HOSTNAME --renew-by-default
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
echo $"Failed to install letsencrypt for domain $LETSENCRYPT_HOSTNAME"
|
echo $"Failed to install letsencrypt for domain $LETSENCRYPT_HOSTNAME"
|
||||||
systemctl start nginx
|
systemctl start nginx
|
||||||
|
|
|
@ -37,6 +37,7 @@ HOSTNAME=
|
||||||
PROVIDER='startssl'
|
PROVIDER='startssl'
|
||||||
DH_KEYLENGTH=2048
|
DH_KEYLENGTH=2048
|
||||||
LETSENCRYPT_SERVER='https://acme-v01.api.letsencrypt.org/directory'
|
LETSENCRYPT_SERVER='https://acme-v01.api.letsencrypt.org/directory'
|
||||||
|
INSTALL_DIR=/root/build
|
||||||
|
|
||||||
function show_help {
|
function show_help {
|
||||||
echo ''
|
echo ''
|
||||||
|
@ -54,20 +55,14 @@ function show_help {
|
||||||
function renew_letsencrypt {
|
function renew_letsencrypt {
|
||||||
if [ ! -f /etc/letsencrypt/live/${HOSTNAME}/fullchain.pem ]; then
|
if [ ! -f /etc/letsencrypt/live/${HOSTNAME}/fullchain.pem ]; then
|
||||||
echo $"Adding Let's Encrypt certificate"
|
echo $"Adding Let's Encrypt certificate"
|
||||||
${PROJECT_NAME}-addcert -e $HOSTNAME -s $LETSENCRYPT_SERVER --dhkey $DH_KEYLENGTH
|
|
||||||
if [ ! "$?" = "0" ]; then
|
|
||||||
echo $"Unable to add Let's encrypt certificate"
|
|
||||||
exit 6328
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
echo $"Renewing Let's Encrypt certificate"
|
echo $"Renewing Let's Encrypt certificate"
|
||||||
letsencrypt renew \
|
fi
|
||||||
--cert-path /etc/letsencrypt/live/${HOSTNAME}/fullchain.pem \
|
|
||||||
--key-path /etc/letsencrypt/live/${HOSTNAME}/privkey.pem
|
${PROJECT_NAME}-addcert -e $HOSTNAME -s $LETSENCRYPT_SERVER --dhkey $DH_KEYLENGTH
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
echo $"Unable to renew Let's encrypt certificate"
|
echo $"Unable to add Let's encrypt certificate"
|
||||||
exit 2624
|
exit 6328
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure that links are in place
|
# Ensure that links are in place
|
||||||
|
|
Loading…
Reference in New Issue