Skip to content

Commit 1b6ff82

Browse files
committed
Reworked the Let's Encrypt renew functionality to skip removed aliases.
This commit resolves hestiacp#856.
1 parent 23ef529 commit 1b6ff82

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file.
1515
- Fixed an issue where malformed JSON output was returned when custom theme files are present. (#967)
1616
- Fixed an error that would occur when running `v-change-user-php-cli` for the first time if .bash_aliases did not exist. (#960)
1717
- Corrected an issue where tooltips were not displayed when hovering over the top level menu items.
18+
- Reworked the Let's Encrypt renew functionality to skip removed aliases.
1819

1920
## [1.2.1] - Service Release
2021
### Features

bin/v-update-letsencrypt-ssl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,27 @@ for user in $($HESTIA/bin/v-list-sys-users plain); do
5858
aliases=$(echo "$aliases" |tr ' ' '\n' |sed "/^$/d")
5959
aliases=$(echo "$aliases" |egrep -v "^$domain,?$")
6060
aliases=$(echo "$aliases" |sed -e ':a;N;$!ba;s/\n/,/g')
61+
62+
# Source domain.conf
63+
source <(cat $HESTIA/data/users/$user/web.conf | grep "DOMAIN='$domain'")
64+
65+
# Split aliases into array
66+
IFS=',' read -r -a ALIASES <<< "$ALIAS"
67+
68+
# Loop trough all crt aliases
69+
for alias in ${aliases//,/ } ; do
70+
# Validate if the alias still exists in web.conf
71+
if [[ " ${ALIASES[@]} " =~ " ${alias} " ]]; then
72+
f_aliases+="$alias,"
73+
fi
74+
done
75+
76+
# Remove leading comma
77+
if [[ ${f_aliases: -1} = ',' ]] ; then f_aliases=${f_aliases::-1}; fi
78+
79+
# Write the filtered alias list to the default var
80+
aliases=$f_aliases
81+
6182
msg=$($BIN/v-add-letsencrypt-domain $user $domain $aliases)
6283
if [ $? -ne 0 ]; then
6384
log_event $E_INVALID "$domain $msg"

0 commit comments

Comments
 (0)