Skip to content

Commit 5d4b0a6

Browse files
author
Kristan Kenney
committed
Update templates for Lets Encrypt support
1 parent 674b559 commit 5d4b0a6

File tree

5 files changed

+19
-11
lines changed

5 files changed

+19
-11
lines changed

bin/v-add-letsencrypt-domain

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ fi
8383
# Action #
8484
#----------------------------------------------------------#
8585

86-
# Rework domain and alieses for mail.
86+
# Generate correct variables for mail domain SSL certificates
8787
if [ ! -z "$mail" ]; then
88-
original_domain=$domain
89-
aliases="webmail.$domain,autodiscover.$domain"
90-
domain="mail.$domain"
88+
root_domain=$domain
89+
domain="mail.$root_domain"
90+
aliases="$WEBMAIL_ALIAS.$root_domain,autodiscover.$root_domain"
9191
fi
9292

9393
# Registering LetsEncrypt user account
@@ -163,12 +163,12 @@ for auth in $authz; do
163163
check_result $? "DNS _acme-challenge record wasn't created"
164164
else
165165
if [ "$WEB_SYSTEM" = 'nginx' ] || [ ! -z "$PROXY_SYSTEM" ]; then
166-
if [ -z "$mail" ]; then
166+
if [ ! -z "$mail" ]; then
167+
conf="$HOMEDIR/$user/conf/mail/$root_domain/$PROXY_SYSTEM.conf_letsencrypt"
168+
sconf="$HOMEDIR/$user/conf/mail/$root_domain/$PROXY_SYSTEM.ssl.conf_letsencrypt"
169+
else
167170
conf="$HOMEDIR/$user/conf/web/$domain/$PROXY_SYSTEM.conf_letsencrypt"
168171
sconf="$HOMEDIR/$user/conf/web/$domain/$PROXY_SYSTEM.ssl.conf_letsencrypt"
169-
else
170-
conf="$HOMEDIR/$user/conf/mail/$original_domain/$PROXY_SYSTEM.conf_letsencryptmail"
171-
sconf="$HOMEDIR/$user/conf/mail/$original_domain/$PROXY_SYSTEM.ssl.conf_letsencryptmail"
172172
fi
173173

174174
if [ ! -e "$conf" ]; then
@@ -295,9 +295,9 @@ if [ -z "$mail" ]; then
295295
update_object_value 'web' 'DOMAIN' "$domain" '$LETSENCRYPT' 'yes'
296296
else
297297
if [ -z "$LETSENCRYPT" ]; then
298-
add_object_key "mail" 'DOMAIN' "$original_domain" 'LETSENCRYPT'
298+
add_object_key "mail" 'DOMAIN' "$root_domain" 'LETSENCRYPT'
299299
fi
300-
update_object_value 'mail' 'DOMAIN' "$original_domain" '$LETSENCRYPT' 'yes'
300+
update_object_value 'mail' 'DOMAIN' "$root_domain" '$LETSENCRYPT' 'yes'
301301
fi
302302

303303
#----------------------------------------------------------#

install/deb/templates/mail/apache2/default.stpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,7 @@
4646
Order allow,deny
4747
Deny from all
4848
</Directory>
49+
50+
IncludeOptional %home%/%user%/conf/mail/%domain%/%web_system%.ssl.conf_*
51+
4952
</VirtualHost>

install/deb/templates/mail/apache2/default.tpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,7 @@
4141
Order allow,deny
4242
Deny from all
4343
</Directory>
44+
45+
IncludeOptional %home%/%user%/conf/mail/%domain%/%web_system%.conf_*
46+
4447
</VirtualHost>

install/deb/templates/mail/nginx/default.stpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ server {
3030
location ~ /\.hg/ {return 404;}
3131
location ~ /\.bzr/ {return 404;}
3232

33-
include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
33+
include %home%/%user%/conf/mail/%domain%/nginx.ssl.conf_*;
3434
}
3535

install/deb/templates/mail/nginx/default.tpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,6 @@ server {
3737
location ~ /\.git/ {return 404;}
3838
location ~ /\.hg/ {return 404;}
3939
location ~ /\.bzr/ {return 404;}
40+
41+
include %home%/%user%/conf/mail/%domain%/nginx.conf_*;
4042
}

0 commit comments

Comments
 (0)