Browse Source

Merge branch 'fix/856_rework_le_renew' into staging/fixes

Kristan Kenney 5 years ago
parent
commit
8116e63224
2 changed files with 25 additions and 3 deletions
  1. 3 2
      CHANGELOG.md
  2. 22 1
      bin/v-update-letsencrypt-ssl

+ 3 - 2
CHANGELOG.md

@@ -16,8 +16,9 @@ All notable changes to this project will be documented in this file.
 - Fixed an error that would occur when running `v-change-user-php-cli` for the first time if .bash_aliases did not exist. (#960)
 - Corrected an issue where tooltips were not displayed when hovering over the top level menu items.
 - Improved handling of APT repository keys during installation.
-
-## [1.2.1] - Service Release 1
+- Reworked the Let's Encrypt renew functionality to skip removed aliases.
+ 
+## [1.2.1] - Service Release
 ### Features
 - Consolidated First and Last Name fields to a singular name field to simply input.
     - v-change-user-name will now accept both "First Last" (single argument) and First Last (two arguments) for backward compatibility.

+ 22 - 1
bin/v-update-letsencrypt-ssl

@@ -58,6 +58,27 @@ for user in $($HESTIA/bin/v-list-sys-users plain); do
             aliases=$(echo "$aliases" |tr ' ' '\n' |sed "/^$/d")
             aliases=$(echo "$aliases" |egrep -v "^$domain,?$")
             aliases=$(echo "$aliases" |sed -e ':a;N;$!ba;s/\n/,/g')
+
+            # Source domain.conf
+            source <(cat $HESTIA/data/users/$user/web.conf | grep "DOMAIN='$domain'")
+
+            # Split aliases into array
+            IFS=',' read -r -a ALIASES <<< "$ALIAS"
+
+            # Loop through all crt aliases
+            for alias in ${aliases//,/ } ; do
+                # Validate if the alias still exists in web.conf
+                if [[ " ${ALIASES[@]} " =~ " ${alias} " ]]; then
+                    f_aliases+="$alias,"
+                fi
+            done
+
+            # Remove leading comma
+            if [[ ${f_aliases: -1} = ',' ]] ; then f_aliases=${f_aliases::-1}; fi
+
+            # Write the filtered alias list to the default var
+            aliases=$f_aliases
+
             msg=$($BIN/v-add-letsencrypt-domain $user $domain $aliases)
             if [ $? -ne 0 ]; then
                 log_event $E_INVALID "$domain $msg"
@@ -114,4 +135,4 @@ done
 # No Logging
 #log_event "$OK" "$EVENT"
 
-exit
+exit