Skip to content

Commit 825c0a9

Browse files
author
Kristan Kenney
committed
Merge branch 'mail-ssl' into mail-stack
2 parents 8fe19e2 + abbdf4f commit 825c0a9

File tree

7 files changed

+99
-15
lines changed

7 files changed

+99
-15
lines changed

bin/v-add-letsencrypt-domain

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ fi
8585

8686
# Rework domain and alieses for mail.
8787
if [ ! -z "$mail" ]; then
88-
original_domain="mail.$domain"
89-
domain="mail.$domain"
88+
original_domain=$domain
9089
aliases="webmail.$domain,autodiscover.$domain"
90+
domain="mail.$domain"
9191
fi
9292

9393
# Registering LetsEncrypt user account

bin/v-change-dns-domain-tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ fi
137137
update_object_value 'dns' 'DOMAIN' "$domain" '$TPL' "$template"
138138
update_object_value 'dns' 'DOMAIN' "$domain" '$RECORDS' "$records"
139139

140+
# Rebuild DNS zone and update counters to ensure that it has updated correctly
141+
$BIN/v-rebuild-dns-domain $user $domain no
142+
$BIN/v-update-user-stats $user
143+
$BIN/v-update-user-counters $user
144+
140145
# Restarting named
141146
$BIN/v-restart-dns $restart
142147
check_result $? "DNS restart failed" >/dev/null

bin/v-change-web-domain-dirlist

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/bin/bash
2+
# info: enable/disable directory listing
3+
# options: USER DOMAIN MODE
4+
#
5+
# The call is used for changing the directory list mode.
6+
7+
8+
#----------------------------------------------------------#
9+
# Variable&Function #
10+
#----------------------------------------------------------#
11+
12+
# Argument defenition
13+
user=$1
14+
domain=$2
15+
mode=$3
16+
17+
# Includes
18+
source $HESTIA/func/main.sh
19+
source $HESTIA/func/domain.sh
20+
source $HESTIA/conf/hestia.conf
21+
22+
# Additional argument formatting
23+
format_domain
24+
format_domain_idn
25+
26+
27+
#----------------------------------------------------------#
28+
# Verifications #
29+
#----------------------------------------------------------#
30+
31+
check_args '3' "$#" 'USER DOMAIN MODE'
32+
is_format_valid 'user' 'domain'
33+
is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM'
34+
is_object_valid 'user' 'USER' "$user"
35+
is_object_unsuspended 'user' 'USER' "$user"
36+
is_object_valid 'web' 'DOMAIN' "$domain"
37+
is_object_unsuspended 'web' 'DOMAIN' "$domain"
38+
39+
40+
#----------------------------------------------------------#
41+
# Action #
42+
#----------------------------------------------------------#
43+
44+
# Fetching domain variables
45+
get_domain_values 'web'
46+
47+
if [ "$mode" = "on" ]; then
48+
# Enable directory listing
49+
sed -i "s/-Index/+Index/g" $HOMEDIR/$user/conf/web/$WEB_SYSTEM.$domain.conf
50+
if [ -e "$ssl_dir/$domain.ca" ]; then
51+
# Enable directory listing for SSL-enforced domains
52+
sed -i "s/-Index/+Index/g" $HOMEDIR/$user/conf/web/s$WEB_SYSTEM.$domain.conf
53+
fi
54+
echo "INFO: Enabled directory browsing for $domain."
55+
else
56+
# Disable directory listing
57+
sed -i "s/+Index/-Index/g" $HOMEDIR/$user/conf/web/$WEB_SYSTEM.$domain.conf
58+
if [ -e "$ssl_dir/$domain.ca" ]; then
59+
# Enable directory listing for SSL-enforced domains
60+
sed -i "s/+Index/-Index/g" $HOMEDIR/$user/conf/web/s$WEB_SYSTEM.$domain.conf
61+
fi
62+
echo "INFO: Disabled directory browsing for $domain."
63+
fi
64+
65+
66+
#----------------------------------------------------------#
67+
# Hestia #
68+
#----------------------------------------------------------#
69+
70+
# Rebuilding vhosts
71+
$BIN/v-restart-web
72+
73+
# Logging
74+
log_history "turned directory browsing $mode for $domain."
75+
log_event "$OK" "$EVENT"
76+
77+
exit

install/deb/templates/dns/child-ns.tpl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ ID='9' RECORD='smtp' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%tim
1010
ID='10' RECORD='pop' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
1111
ID='11' RECORD='imap' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
1212
ID='12' RECORD='autodiscover' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
13-
ID='13' RECORD='@' TYPE='MX' PRIORITY='0' VALUE='mail.%domain%.' SUSPENDED='no' TIME='%time%' DATE='%date%'
14-
ID='14' RECORD='@' TYPE='TXT' PRIORITY='' VALUE='"v=spf1 a mx ip4:%ip% -all"' SUSPENDED='no' TIME='%time%' DATE='%date%'
15-
ID='15' RECORD='_dmarc' TYPE='TXT' PRIORITY='' VALUE='"v=DMARC1; p=quarantine; pct=100"' SUSPENDED='no' TIME='%time%' DATE='%date%'
13+
ID='13' RECORD='webmail' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
14+
ID='14' RECORD='@' TYPE='MX' PRIORITY='0' VALUE='mail.%domain%.' SUSPENDED='no' TIME='%time%' DATE='%date%'
15+
ID='15' RECORD='@' TYPE='TXT' PRIORITY='' VALUE='"v=spf1 a mx ip4:%ip% -all"' SUSPENDED='no' TIME='%time%' DATE='%date%'
16+
ID='16' RECORD='_dmarc' TYPE='TXT' PRIORITY='' VALUE='"v=DMARC1; p=quarantine; pct=100"' SUSPENDED='no' TIME='%time%' DATE='%date%'

install/deb/templates/dns/default.tpl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ ID='13' RECORD='smtp' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%ti
1414
ID='14' RECORD='pop' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
1515
ID='15' RECORD='imap' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
1616
ID='16' RECORD='autodiscover' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
17-
ID='17' RECORD='@' TYPE='MX' PRIORITY='0' VALUE='mail.%domain%.' SUSPENDED='no' TIME='%time%' DATE='%date%'
18-
ID='18' RECORD='@' TYPE='TXT' PRIORITY='' VALUE='"v=spf1 a mx ip4:%ip% -all"' SUSPENDED='no' TIME='%time%' DATE='%date%'
19-
ID='19' RECORD='_dmarc' TYPE='TXT' PRIORITY='' VALUE='"v=DMARC1; p=quarantine; pct=100"' SUSPENDED='no' TIME='%time%' DATE='%date%'
17+
ID='17' RECORD='webmail' TYPE='A' PRIORITY='' VALUE='%ip%' SUSPENDED='no' TIME='%time%' DATE='%date%'
18+
ID='18' RECORD='@' TYPE='MX' PRIORITY='0' VALUE='mail.%domain%.' SUSPENDED='no' TIME='%time%' DATE='%date%'
19+
ID='19' RECORD='@' TYPE='TXT' PRIORITY='' VALUE='"v=spf1 a mx ip4:%ip% -all"' SUSPENDED='no' TIME='%time%' DATE='%date%'
20+
ID='20' RECORD='_dmarc' TYPE='TXT' PRIORITY='' VALUE='"v=DMARC1; p=quarantine; pct=100"' SUSPENDED='no' TIME='%time%' DATE='%date%'

install/upgrade/0.9.8-29.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# define vars
44
HESTIA="/usr/local/hestia"
5+
HESTIA_BACKUP="/root/hst_upgrade/$(date +%d%m%Y%H%M)"
56
hestiacp="$HESTIA/install/deb"
67

78
# load hestia.conf
@@ -100,9 +101,7 @@ chmod 751 $HESTIA/data/templates/web/unassigned/js
100101
chmod 751 $HESTIA/data/templates/web/unassigned/webfonts
101102

102103
# Add unassigned hosts configuration to nginx and apache2
103-
if [ "$WEB_BACKEND" = "php-fpm" ]; then
104-
echo "(!) Unassigned hosts configuration for Apache not necessary on PHP-FPM installations."
105-
elif [ "$WEB_BACKEND" = "apache2" ]; then
104+
if [ "$WEB_SYSTEM" = "apache2" ]; then
106105
echo "(*) Adding unassigned hosts configuration to apache2..."
107106
if [ -f /usr/local/hestia/data/ips/* ]; then
108107
for ip in /usr/local/hestia/data/ips/*; do
@@ -112,7 +111,8 @@ elif [ "$WEB_BACKEND" = "apache2" ]; then
112111
sed -i 's/directIP/'$ipaddr'/g' /etc/apache2/conf.d/$ipaddr.conf
113112
done
114113
fi
115-
elif [ "$PROXY_SYSTEM" = "nginx" ]; then
114+
fi
115+
if [ "$PROXY_SYSTEM" = "nginx" ]; then
116116
echo "(*) Adding unassigned hosts configuration to nginx..."
117117
if [ -f /usr/local/hestia/data/ips/* ]; then
118118
for ip in /usr/local/hestia/data/ips/*; do

web/edit/mail/index.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@
244244

245245
// Delete Lets Encrypt support
246246
if (( $v_letsencrypt == 'yes' ) && (empty($_POST['v_letsencrypt'])) && (empty($_SESSION['error_msg']))) {
247-
exec (HESTIA_CMD."v-delete-letsencrypt-domain ".$user." ".$v_domain." 'no'", $output, $return_var);
247+
exec (HESTIA_CMD."v-delete-letsencrypt-domain ".$user." ".$v_domain." 'no' 'yes'", $output, $return_var);
248248
check_return_code($return_var,$output);
249249
unset($output);
250250
$v_ssl_crt = '';
@@ -258,7 +258,7 @@
258258

259259
// Delete SSL certificate
260260
if (( $v_ssl == 'yes' ) && (empty($_POST['v_ssl'])) && (empty($_SESSION['error_msg']))) {
261-
exec (HESTIA_CMD."v-delete-domain-ssl ".$v_username." ".$v_domain." 'no' 'yes'", $output, $return_var);
261+
exec (HESTIA_CMD."v-delete-mail-domain-ssl ".$v_username." ".$v_domain, $output, $return_var);
262262
check_return_code($return_var,$output);
263263
unset($output);
264264
$v_ssl_crt = '';
@@ -270,7 +270,7 @@
270270

271271
// Add Lets Encrypt support
272272
if ((!empty($_POST['v_ssl'])) && ( $v_letsencrypt == 'no' ) && (!empty($_POST['v_letsencrypt'])) && empty($_SESSION['error_msg'])) {
273-
exec (HESTIA_CMD."v-add-letsencrypt-domain ".$user." ".$v_domain." '' 'yes'", $output, $return_var);
273+
exec (HESTIA_CMD."v-add-letsencrypt-domain ".$user." ".$v_domain." ' ' 'yes'", $output, $return_var);
274274
check_return_code($return_var,$output);
275275
unset($output);
276276
$v_letsencrypt = 'yes';

0 commit comments

Comments
 (0)