mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 18:49:21 -07:00
Warn admin if LE renewing failed for hostname
This commit is contained in:
parent
a7b209ff3f
commit
74209ee7db
1 changed files with 21 additions and 4 deletions
|
@ -23,6 +23,9 @@ source $VESTA/conf/vesta.conf
|
|||
#----------------------------------------------------------#
|
||||
|
||||
lecounter=0
|
||||
hostname=$(hostname)
|
||||
|
||||
echo "[$(date)] : -----------------------------------------------------------------------------------" >> /usr/local/vesta/log/letsencrypt_cron.log
|
||||
|
||||
# Checking user certificates
|
||||
for user in $($BIN/v-list-users plain |cut -f 1); do
|
||||
|
@ -31,8 +34,20 @@ for user in $($BIN/v-list-users plain |cut -f 1); do
|
|||
for domain in $(search_objects 'web' 'LETSENCRYPT' 'yes' 'DOMAIN'); do
|
||||
|
||||
fail_counter=$(get_web_counter "$user" "$domain" 'LETSENCRYPT_FAIL_COUNT')
|
||||
if [[ "$fail_counter" -ge 7 ]]; then
|
||||
echo "$domain failed $fail_counter times for LetsEncrypt renewing, skipping"
|
||||
|
||||
if [[ "$fail_counter" -ge 8 ]]; then
|
||||
if [ "$hostname" = "$domain" ]; then
|
||||
if [ -z "$SKIP_HOSTNAME_LETSENCRIPT_RENEWING_WARNING" ]; then
|
||||
email=$(grep CONTACT $VESTA/data/users/admin/user.conf)
|
||||
email=$(echo "$email" | cut -f 2 -d "'")
|
||||
echo "hostname $domain failed for LetsEncrypt renewing" | $SENDMAIL -s "LetsEncrypt renewing hostname $hostname" "$email" 'yes'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$fail_counter" -ge 8 ]]; then
|
||||
# echo "$domain failed $fail_counter times for LetsEncrypt renewing, skipping"
|
||||
echo "[$(date)] : $domain failed $fail_counter times for LetsEncrypt renewing, skipping" >> /usr/local/vesta/log/letsencrypt_cron.log
|
||||
continue;
|
||||
fi
|
||||
crt_data=$(openssl x509 -text -in $USER_DATA/ssl/$domain.crt)
|
||||
|
@ -53,11 +68,13 @@ for user in $($BIN/v-list-users plain |cut -f 1); do
|
|||
aliases=$(echo "$aliases" |sed -e ':a;N;$!ba;s/\n/,/g')
|
||||
msg=$($BIN/v-add-letsencrypt-domain $user $domain $aliases)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "$domain $msg"
|
||||
if [[ $msg == *"is suspended" ]]; then
|
||||
echo "OK, it's suspended"
|
||||
echo "[$(date)] : SUSPENDED: $domain $msg" >> /usr/local/vesta/log/letsencrypt_cron.log
|
||||
else
|
||||
echo "[$(date)] : $domain $msg" >> /usr/local/vesta/log/letsencrypt_cron.log
|
||||
echo "$domain $msg"
|
||||
fail_counter=$(alter_web_counter "$user" "$domain" 'LETSENCRYPT_FAIL_COUNT')
|
||||
echo "[$(date)] : fail_counter = $fail_counter" >> /usr/local/vesta/log/letsencrypt_cron.log
|
||||
echo "fail_counter = $fail_counter"
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue