Skip to content

Commit 25937dd

Browse files
committed
hestiacp#1913 fix issue where rainloop was unable to get SSL
1 parent a5acdb9 commit 25937dd

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

bin/v-add-letsencrypt-domain

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,31 @@ for auth in $authz; do
315315
chown -R $user:$user $well_known
316316
fi
317317
else
318-
well_known="/var/lib/roundcube/.well-known"
319-
acme_challenge="$well_known/acme-challenge"
320-
mkdir -p $acme_challenge
321-
echo "$token.$THUMB" > $acme_challenge/$token
322-
chown -R $user:$user $well_known
318+
if [ "$WEB_SYSTEM" = 'nginx' ] || [ "$PROXY_SYSTEM" = 'nginx' ]; then
319+
conf="$HOMEDIR/$user/conf/mail/$root_domain/nginx.conf_letsencrypt"
320+
sconf="$HOMEDIR/$user/conf/mail/$root_domain/nginx.ssl.conf_letsencrypt"
321+
echo 'location ~ "^/\.well-known/acme-challenge/([-_A-Za-z0-9]+)$" {' \
322+
> $conf
323+
echo ' default_type text/plain;' >> $conf
324+
echo ' return 200 "$1.'$THUMB'";' >> $conf
325+
echo '}' >> $conf
326+
if [ ! -e "$sconf" ]; then
327+
ln -s "$conf" "$sconf"
328+
fi
329+
if [ ! -z "$PROXY_SYSTEM" ]; then
330+
$BIN/v-restart-proxy
331+
check_result $? "Proxy restart failed" > /dev/null
332+
fi
333+
else
334+
get_object_value 'mail' 'DOMAIN' "$domain" "WEBMAIL"
335+
if [ ! -z "$WEBMAIL" ]; then
336+
well_known="/var/lib/$WEBMAIL/.well-known"
337+
acme_challenge="$well_known/acme-challenge"
338+
mkdir -p $acme_challenge
339+
echo "$token.$THUMB" > $acme_challenge/$token
340+
chown -R $user:$user $well_known
341+
fi
342+
fi
323343
fi
324344
if [ "$WEB_SYSTEM" = 'nginx' ]; then
325345
$BIN/v-restart-web

0 commit comments

Comments
 (0)