Skip to content

Commit c33c8ae

Browse files
authored
Fix 1930 Add template when webmail is disabled (hestiacp#1934)
* Fixed issue where ssl was not possible when webmail is disabled Also fix the issue when importing from 1.3.5 or older / VestaCP * Update change log
1 parent bbe3bc5 commit c33c8ae

File tree

11 files changed

+186
-6
lines changed

11 files changed

+186
-6
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [1.4.4] - Service release
5+
6+
### Features
7+
8+
9+
### Bugfixes
10+
11+
- Add template for when webmail is disabled allowing to generate SSL.
12+
413
## [1.4.3] - Service release
514

615
### Features

bin/v-add-mail-domain-webmail

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ check_args '2' "$#" 'USER DOMAIN [WEBMAIL] [RESTART]'
6060
is_format_valid 'user' 'domain'
6161
is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM'
6262
is_system_enabled "$IMAP_SYSTEM" 'IMAP_SYSTEM'
63-
is_type_valid "$WEBMAIL_SYSTEM" "$webmail"
63+
is_type_valid "$WEBMAIL_SYSTEM disabled" "$webmail"
6464
is_object_valid 'user' 'USER' "$user"
6565
is_object_unsuspended 'user' 'USER' "$user"
6666
is_object_valid 'mail' 'DOMAIN' "$domain"
@@ -126,11 +126,16 @@ else
126126
if [ "$WEB_SYSTEM" = "nginx" ]; then
127127
WEBMAIL_TEMPLATE="web_system"
128128
fi
129-
else
129+
elif [ "$webmail" == "rainloop" ]; then
130130
WEBMAIL_TEMPLATE="rainloop"
131131
if [ ! -z "$PROXY_SYSTEM" ]; then
132132
PROXY_TEMPLATE="default_rainloop"
133133
fi
134+
else
135+
WEBMAIL_TEMPLATE="disabled"
136+
if [ ! -z "$PROXY_SYSTEM" ]; then
137+
PROXY_TEMPLATE="disabled"
138+
fi
134139
fi
135140

136141
add_webmail_config "$WEB_SYSTEM" "${WEBMAIL_TEMPLATE}.tpl"

func/rebuild.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,11 @@ rebuild_mail_domain_conf() {
588588
if [ ! -e $HOMEDIR/$user/mail/$domain_idn ]; then
589589
mkdir "$HOMEDIR/$user/mail/$domain_idn"
590590
fi
591+
592+
# Webamil client
593+
if [ "$WEBAMIL" = '' ]; then
594+
$HESTIA/bin/v-add-mail-domain-webmail $user $domain 'roundcube' 'no'
595+
fi
591596

592597
# Adding catchall email
593598
dom_aliases=$HOMEDIR/$user/conf/mail/$domain/aliases
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<VirtualHost %ip%:%web_ssl_port%>
2+
ServerName %domain_idn%
3+
ServerAlias %alias%
4+
Alias / /var/lib/roundcube/
5+
Alias /error/ %home%/%user%/web/%root_domain%/document_errors/
6+
#SuexecUserGroup %user% %group%
7+
8+
SSLEngine on
9+
SSLVerifyClient none
10+
SSLCertificateFile %home%/%user%/conf/mail/%root_domain%/ssl/%root_domain%.crt
11+
SSLCertificateKeyFile %home%/%user%/conf/mail/%root_domain%/ssl/%root_domain%.key
12+
13+
<Directory /var/www/html>
14+
Options +FollowSymLinks
15+
AllowOverride All
16+
order allow,deny
17+
allow from all
18+
</Directory>
19+
20+
IncludeOptional %home%/%user%/conf/mail/%root_domain%/%web_system%.ssl.conf_*
21+
22+
</VirtualHost>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<VirtualHost %ip%:%web_port%>
2+
ServerName %domain_idn%
3+
ServerAlias %alias%
4+
Alias / /var/lib/roundcube/
5+
Alias /error/ %home%/%user%/web/%root_domain%/document_errors/
6+
#SuexecUserGroup %user% %group%
7+
8+
SSLEngine on
9+
SSLVerifyClient none
10+
11+
<Directory /var/www/html>
12+
Options +FollowSymLinks
13+
AllowOverride All
14+
order allow,deny
15+
allow from all
16+
</Directory>
17+
</VirtualHost>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
server {
2+
listen %ip%:%proxy_ssl_port% ssl http2;
3+
server_name %domain_idn% %alias_idn%;
4+
root /var/lib/roundcube;
5+
index index.php index.html index.htm;
6+
access_log /var/log/nginx/domains/%domain%.log combined;
7+
error_log /var/log/nginx/domains/%domain%.error.log error;
8+
9+
ssl_certificate %ssl_pem%;
10+
ssl_certificate_key %ssl_key%;
11+
ssl_stapling on;
12+
ssl_stapling_verify on;
13+
14+
location ~ /\.(?!well-known\/) {
15+
deny all;
16+
return 404;
17+
}
18+
19+
location / {
20+
try_files $uri $uri/ =404;
21+
alias /var/www/html;
22+
}
23+
24+
location /error/ {
25+
alias /var/www/document_errors/;
26+
}
27+
28+
location @fallback {
29+
proxy_pass https://%ip%:%web_ssl_port%;
30+
}
31+
32+
include %home%/%user%/conf/mail/%root_domain%/%proxy_system%.conf_*;
33+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
server {
2+
listen %ip%:%proxy_ssl_port% ssl http2;
3+
server_name %domain_idn% %alias_idn%;
4+
root /var/lib/roundcube;
5+
index index.php index.html index.htm;
6+
access_log /var/log/nginx/domains/%domain%.log combined;
7+
error_log /var/log/nginx/domains/%domain%.error.log error;
8+
9+
ssl_certificate %ssl_pem%;
10+
ssl_certificate_key %ssl_key%;
11+
ssl_stapling on;
12+
ssl_stapling_verify on;
13+
14+
location ~ /\.(?!well-known\/) {
15+
deny all;
16+
return 404;
17+
}
18+
19+
location / {
20+
try_files $uri $uri/ =404;
21+
alias /var/www/html;
22+
}
23+
24+
location /error/ {
25+
alias /var/www/document_errors/;
26+
}
27+
28+
location @fallback {
29+
proxy_pass https://%ip%:%web_ssl_port%;
30+
}
31+
32+
include %home%/%user%/conf/mail/%root_domain%/%proxy_system%.conf_*;
33+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
server {
2+
listen %ip%:%web_ssl_port% ssl http2;
3+
server_name %domain_idn% %alias_idn%;
4+
root /var/www/html;
5+
index index.php index.html index.htm;
6+
access_log /var/log/nginx/domains/%domain%.log combined;
7+
error_log /var/log/nginx/domains/%domain%.error.log error;
8+
9+
ssl_certificate %ssl_pem%;
10+
ssl_certificate_key %ssl_key%;
11+
ssl_stapling on;
12+
ssl_stapling_verify on;
13+
14+
location ~ /\.(?!well-known\/) {
15+
deny all;
16+
return 404;
17+
}
18+
19+
20+
location / {
21+
try_files $uri $uri/ =404;
22+
}
23+
24+
location /error/ {
25+
alias /var/www/document_errors/;
26+
}
27+
28+
29+
include %home%/%user%/conf/mail/%root_domain%/%web_system%.conf_*;
30+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
server {
2+
listen %ip%:%web_port%;
3+
server_name %domain_idn% %alias_idn%;
4+
root /var/www/html;
5+
index index.php index.html index.htm;
6+
access_log /var/log/nginx/domains/%domain%.log combined;
7+
error_log /var/log/nginx/domains/%domain%.error.log error;
8+
9+
include %home%/%user%/conf/mail/%root_domain%/nginx.forcessl.conf*;
10+
11+
location ~ /\.(?!well-known\/) {
12+
deny all;
13+
return 404;
14+
}
15+
16+
17+
location / {
18+
try_files $uri $uri/ =404;
19+
}
20+
21+
location /error/ {
22+
alias /var/www/document_errors/;
23+
}
24+
25+
include %home%/%user%/conf/mail/%root_domain%/%web_system%.conf_*;
26+
}

web/templates/pages/add_mail.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@
9393
<select class="vst-list" name="v_webmail" tabindex="6">
9494
<?php foreach ($webmail_clients as $client){
9595
echo "\t\t\t\t<option value=\"".htmlentities($client)."\"";
96-
if ((!empty($v_webmail)) && ( $v_webmail == $client )) {
96+
if (( $v_webmail == $client )) {
9797
echo ' selected' ;
9898
}
9999
echo ">".htmlentities(ucfirst($client))."</option>\n";
100100
}
101101
?>
102-
<option value="" <?php if(empty($v_webmail)){ echo "selected";}?>><?=_('Disabled');?></option>
102+
<option value="" <?php if (empty($v_webmail) || $v_webmail == 'disabled' ){ echo "selected";}?>><?=_('Disabled');?></option>
103103
</select>
104104
</td>
105105
</tr>

0 commit comments

Comments
 (0)