Skip to content

Commit 23c904a

Browse files
authored
Merge branch 'main' into nginx-agents
2 parents ac4cb2a + c33c8ae commit 23c904a

25 files changed

+230
-44
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ All notable changes to this project will be documented in this file.
44
## [1.4.4] - Service release
55

66
### Features
7+
78
- Add nginx user_agent separation to desktop/mobile (e.g. for fastcgi cache)
89

910
### Bugfixes
1011

12+
- Add template for when webmail is disabled allowing to generate SSL.
13+
1114
## [1.4.3] - Service release
1215

1316
### 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"

bin/v-delete-web-php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,11 @@ done
8181
# Do a blank echo to get the \n back
8282
echo
8383

84-
# Check if installation was sucessfully
84+
# Check if installation was successfully
8585
if [ -f "$php_fpm" ]; then
8686
echo "ERROR: Uninstallation failed, please run the following command manually for debugging:"
8787
echo "apt-get purge $mph"
88+
exit 1;
8889
fi
8990

9091
# Cleanup php folder

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

install/deb/phpmyadmin/hestia-sso.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,35 +74,39 @@ function delete_temp_user ($database, $user, $dbuser, $host){
7474

7575
function get_user_ip(){
7676
// Saving user IPs to the session for preventing session hijacking
77-
$user_combined_ip = $_SERVER['REMOTE_ADDR'];
77+
$user_combined_ip = array();
78+
if($_SERVER['REMOTE_ADDR'] != $_SERVER['SERVER_ADDR']){
79+
$user_combined_ip[] = $_SERVER['REMOTE_ADDR'];
80+
}
7881
if(isset($_SERVER['HTTP_CLIENT_IP'])){
7982
$user_combined_ip .= '|'. $_SERVER['HTTP_CLIENT_IP'];
8083
}
8184
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])){
8285
if($_SERVER['REMOTE_ADDR'] != $_SERVER['HTTP_X_FORWARDED_FOR']){
83-
$user_combined_ip .= '|'. $_SERVER['HTTP_X_FORWARDED_FOR'];
86+
$user_combined_ip[] = $_SERVER['HTTP_X_FORWARDED_FOR'];
8487
}
8588
}
8689
if(isset($_SERVER['HTTP_FORWARDED_FOR'])){
8790
if($_SERVER['REMOTE_ADDR'] != $_SERVER['HTTP_FORWARDED_FOR']){
88-
$user_combined_ip .= '|'. $_SERVER['HTTP_FORWARDED_FOR'];
91+
$user_combined_ip[] = $_SERVER['HTTP_FORWARDED_FOR'];
8992
}
9093
}
9194
if(isset($_SERVER['HTTP_X_FORWARDED'])){
9295
if($_SERVER['REMOTE_ADDR'] != $_SERVER['HTTP_X_FORWARDED']){
93-
$user_combined_ip .= '|'. $_SERVER['HTTP_X_FORWARDED'];
96+
$user_combined_ip[] = $_SERVER['HTTP_X_FORWARDED'];
9497
}
95-
} if(isset($_SERVER['HTTP_FORWARDED'])){
98+
}
99+
if(isset($_SERVER['HTTP_FORWARDED'])){
96100
if($_SERVER['REMOTE_ADDR'] != $_SERVER['HTTP_FORWARDED']){
97-
$user_combined_ip .= '|'. $_SERVER['HTTP_FORWARDED'];
101+
$user_combined_ip[] = '|'. $_SERVER['HTTP_FORWARDED'];
98102
}
99103
}
100104
if(isset($_SERVER['HTTP_CF_CONNECTING_IP'])){
101105
if(!empty($_SERVER['HTTP_CF_CONNECTING_IP'])){
102-
$user_combined_ip = $_SERVER['HTTP_CF_CONNECTING_IP'];
106+
$user_combined_ip[] = $_SERVER['HTTP_CF_CONNECTING_IP'];
103107
}
104108
}
105-
return $user_combined_ip;
109+
return implode($user_combined_ip,'|');
106110
}
107111
}
108112

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+
}

0 commit comments

Comments
 (0)