From 58c6ca95b18948d9d1099ba7fb1300d3b33b0fcc Mon Sep 17 00:00:00 2001 From: dpeca Date: Mon, 10 Dec 2018 14:15:46 +0100 Subject: [PATCH 1/2] Fix for suspended domain checking while LE renewing Logic should be inversed... If you grep for suspended=no, then variable is NOT empty if it's NOT suspended Which means it's empty only if it's suspended. So we must grep for suspended=yes if we consider not-empty result as suspended domain. @skullwritter This bug totally brakes LE renewing :) --- bin/v-update-letsencrypt-ssl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/v-update-letsencrypt-ssl b/bin/v-update-letsencrypt-ssl index 6e26d7e5..dd1f3b7c 100755 --- a/bin/v-update-letsencrypt-ssl +++ b/bin/v-update-letsencrypt-ssl @@ -32,7 +32,7 @@ for user in $users; do lecounter=0 for domain in $(search_objects 'web' 'LETSENCRYPT' 'yes' 'DOMAIN'); do # Working on Web domain check - if is suspended - webSuspended=$(grep "DOMAIN='$domain'" $USER_DATA/web.conf |grep "SUSPENDED='no") + webSuspended=$(grep "DOMAIN='$domain'" $USER_DATA/web.conf |grep "SUSPENDED='yes") if [ ! -z "$webSuspended" ]; then continue; fi; From 3d8b6a87a77ae8c026e90eb45212349585adc5e3 Mon Sep 17 00:00:00 2001 From: dpeca Date: Mon, 10 Dec 2018 14:31:10 +0100 Subject: [PATCH 2/2] Better handling of calm-down routine while LE renewing Sleep is because https://github.com/serghey-rodin/vesta/issues/1193 --- bin/v-update-letsencrypt-ssl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/v-update-letsencrypt-ssl b/bin/v-update-letsencrypt-ssl index dd1f3b7c..17f8f0f6 100755 --- a/bin/v-update-letsencrypt-ssl +++ b/bin/v-update-letsencrypt-ssl @@ -25,11 +25,12 @@ source $VESTA/conf/vesta.conf # Defining user list users=$($BIN/v-list-users | tail -n+3 | awk '{ print $1 }') +lecounter=0 + # Checking users for user in $users; do USER_DATA=$VESTA/data/users/$user # Checking user certificates - lecounter=0 for domain in $(search_objects 'web' 'LETSENCRYPT' 'yes' 'DOMAIN'); do # Working on Web domain check - if is suspended webSuspended=$(grep "DOMAIN='$domain'" $USER_DATA/web.conf |grep "SUSPENDED='yes") @@ -46,6 +47,10 @@ for user in $users; do expire=$((expire / 86400)) domain=$(basename $crt |sed -e "s/.crt$//") if [[ "$expire" -lt 31 ]]; then + if [ $lecounter -gt 0 ]; then + sleep 10 + fi + ((lecounter++)) aliases=$(echo "$crt_data" |grep DNS:) aliases=$(echo "$aliases" |sed -e "s/DNS://g" -e "s/,//") aliases=$(echo "$aliases" |tr ' ' '\n' |sed "/^$/d") @@ -62,10 +67,6 @@ for user in $users; do echo "$domain $msg" fi fi - if [ $lecounter -gt 0 ]; then - sleep 10 - fi - ((lecounter++)) fi done done