Skip to content

Commit 48289e8

Browse files
authored
Merge pull request hestiacp#1273 from hestiacp/staging/fixes
Staging/fixes
2 parents 8faf69d + 2d4c788 commit 48289e8

File tree

26 files changed

+4434
-102
lines changed

26 files changed

+4434
-102
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ test/node_modules/
1515
npm-debug.log
1616
.phpunit.result.cache
1717
.vs
18+
.nova

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file.
1515
- Updated translations system with the use of Gettext. Modified / Updated all translated strings.
1616
- Use php7.4 as default version.
1717
- Updated MariaDB to 10.5 (Manual upgrade required install/upgrade/manual/upgrade_mariadb.sh).
18+
- Added support for Turkish (emrahk [Forum](https://forum.hestiacp.com/t/how-to-contribute-with-translations/1664/4?u=eris) )
1819

1920
## Bugfixes
2021
- Removed root login (root / root password )
@@ -43,7 +44,7 @@ All notable changes to this project will be documented in this file.
4344
- Refactor LXD Complier script
4445
- Set default theme to "Dark"
4546
- Clean up gmail.tpl (DNS) (@madito)
46-
47+
- Improved translations (NL, DE, UK, RU, ES, IT, ZH-CN)
4748

4849
## [1.2.3] - Service Release
4950
### Features

bin/v-add-user

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ check_result $? "user creation failed" $E_INVALID
6262
# Adding password
6363
echo "$user:$password" | /usr/sbin/chpasswd
6464

65+
if [ $? -ne 0 ]; then
66+
# Delete user on failure
67+
/usr/sbin/deluser "$user" > /dev/null 2>&1
68+
echo "Error: Password not accepted due to PAM restrictions"
69+
exit 2
70+
fi
71+
6572
# Add a general group for normal users created by Hestia
6673
if [ -z "$(grep ^hestia-users: /etc/group)" ]; then
6774
groupadd --system "hestia-users"

bin/v-add-web-domain-ftp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,14 @@ fi
9393

9494
# Set ftp user password
9595
echo "$ftp_user:$password" | /usr/sbin/chpasswd
96+
97+
if [ $? -ne 0 ]; then
98+
# Delete user on failure again
99+
/usr/sbin/deluser "$ftp_user" > /dev/null 2>&1
100+
echo "Error: Password not accepted due to PAM restrictions"
101+
exit 2
102+
fi
103+
96104
ftp_md5=$(awk -v user=$ftp_user -F : 'user == $1 {print $2}' /etc/shadow)
97105

98106
# Adding jailed sftp env

bin/v-change-user-password

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ check_hestia_demo_mode
4747

4848
# Changing user password
4949
echo "$user:$password" | /usr/sbin/chpasswd
50+
51+
if [ $? -ne 0 ]; then
52+
echo "Error: Password not accepted due to PAM restrictions"
53+
exit 2
54+
fi
55+
5056
md5=$(awk -v user=$user -F : 'user == $1 {print $2}' /etc/shadow)
5157

5258
if [ "$user" = 'admin' ] && [ -e "$HESTIA/web/reset.admin" ]; then

bin/v-change-web-domain-ftp-password

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ check_hestia_demo_mode
5656

5757
# Changing ftp user password
5858
echo "$ftp_user:$password" | /usr/sbin/chpasswd
59+
60+
if [ $? -ne 0 ]; then
61+
echo "Error: Password not accepted due to PAM restrictions"
62+
exit 2
63+
fi
64+
5965
ftp_md5=$(awk -v user=$ftp_user -F : 'user == $1 {print $2}' /etc/shadow)
6066

6167

bin/v-restore-user

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,11 @@ fi
133133

134134
# Restoring user account
135135
if [ "$create_user" = 'yes' ]; then
136+
137+
# Add check if user already exists as Linux User
138+
getent passwd $user > /dev/null 2&>1
139+
check_result "$E_EXISTS" "User already exists"
140+
136141
echo "-- USER --" |tee $tmpdir/restore.log
137142
echo -e "$(date "+%F %T") $user" |tee -a $tmpdir/restore.log
138143

bin/v-update-sys-hestia-git

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ timestamp() {
9696

9797
# Set install flags
9898
if [ ! -z "$1" ]; then
99-
fork_check=$(curl -s --head -w %{http_code} https://raw.githubusercontent.com/$fork/hestiacp/release/src/deb/hestia/control -o /dev/null)
99+
fork_check=$(curl -s --head -w %{http_code} https://raw.githubusercontent.com/$fork/hestiacp/main/src/deb/hestia/control -o /dev/null)
100100
if [ $fork_check -ne "200" ]; then
101101
echo "ERROR: invalid repository name specified."
102102
exit 1
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
#=======================================================================#
2+
# Default Web Domain Template #
3+
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
4+
#=======================================================================#
5+
6+
server {
7+
listen %ip%:%web_ssl_port% ssl http2;
8+
server_name %domain_idn% %alias_idn%;
9+
root %docroot%;
10+
index index.php index.html index.htm;
11+
access_log /var/log/nginx/domains/%domain%.log combined;
12+
access_log /var/log/nginx/domains/%domain%.bytes bytes;
13+
error_log /var/log/nginx/domains/%domain%.error.log error;
14+
15+
ssl_certificate %ssl_pem%;
16+
ssl_certificate_key %ssl_key%;
17+
ssl_stapling on;
18+
ssl_stapling_verify on;
19+
20+
include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;
21+
22+
location = /favicon.ico {
23+
log_not_found off;
24+
access_log off;
25+
}
26+
27+
location = /robots.txt {
28+
allow all;
29+
log_not_found off;
30+
access_log off;
31+
}
32+
33+
location ~ /\.(?!well-known\/) {
34+
deny all;
35+
return 404;
36+
}
37+
38+
# Force pdf files to be downloaded
39+
location ~* \.pdf$ {
40+
add_header Content-Disposition Attachment;
41+
add_header X-Content-Type-Options nosniff;
42+
}
43+
44+
# Force files in upload directory to be downloaded
45+
location ~ ^/upload/ {
46+
add_header Content-Disposition Attachment;
47+
add_header X-Content-Type-Options nosniff;
48+
}
49+
50+
# [REQUIRED EDIT IF MULTILANG]
51+
# rewrite ^/fr$ /fr/ redirect;
52+
# rewrite ^/fr/(.*) /$1;
53+
54+
# Images
55+
rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$1$2$3.jpg last;
56+
rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last;
57+
rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last;
58+
rewrite ^/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last;
59+
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last;
60+
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg last;
61+
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg last;
62+
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg last;
63+
rewrite ^/c/([0-9]+)(-[.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+.jpg$ /img/c/$1$2$3.jpg last;
64+
rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+.jpg$ /img/c/$1$2.jpg last;
65+
66+
# AlphaImageLoader for IE and fancybox
67+
rewrite ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 last;
68+
69+
# Web service API
70+
rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;
71+
72+
# Installation sandbox
73+
rewrite ^(/install(?:-dev)?/sandbox)/(.*) /$1/test.php last;
74+
75+
# Source code directories
76+
location ~ ^/(app|bin|cache|classes|config|controllers|docs|localization|override|src|tests|tools|translations|travis-scripts|vendor|var)/ {
77+
deny all;
78+
return 404;
79+
}
80+
81+
# vendor in modules directory
82+
location ~ ^/modules/.*/vendor/ {
83+
deny all;
84+
return 404;
85+
}
86+
87+
# Prevent exposing other sensitive files
88+
location ~ \.(yml|log|tpl|twig|sass)$ {
89+
deny all;
90+
return 404;
91+
}
92+
93+
# Prevent injection of php files
94+
location /upload {
95+
location ~ \.php$ {
96+
deny all;
97+
return 404;
98+
}
99+
}
100+
location /img {
101+
location ~ \.php$ {
102+
deny all;
103+
return 404;
104+
}
105+
}
106+
107+
location / {
108+
try_files $uri $uri/ /index.php?$args;
109+
110+
location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
111+
expires 30d;
112+
fastcgi_hide_header "Set-Cookie";
113+
}
114+
115+
location ~ [^/]\.php(/|$) {
116+
try_files $fastcgi_script_name /index.php$uri&$args =404;
117+
fastcgi_split_path_info ^(.+\.php)(/.+)$;
118+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
119+
120+
fastcgi_pass %backend_lsnr%;
121+
fastcgi_index index.php;
122+
include /etc/nginx/fastcgi_params;
123+
}
124+
}
125+
126+
error_page 403 /error/404.html;
127+
error_page 404 /index.php?controller=404;
128+
error_page 500 502 503 504 /error/50x.html;
129+
130+
location /error/ {
131+
alias %home%/%user%/web/%domain%/document_errors/;
132+
}
133+
134+
location /vstats/ {
135+
alias %home%/%user%/web/%domain%/stats/;
136+
include %home%/%user%/web/%domain%/stats/auth.conf*;
137+
}
138+
139+
include /etc/nginx/conf.d/phpmyadmin.inc*;
140+
include /etc/nginx/conf.d/phppgadmin.inc*;
141+
include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
142+
}
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
#=======================================================================#
2+
# Default Web Domain Template #
3+
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
4+
#=======================================================================#
5+
6+
server {
7+
listen %ip%:%web_port%;
8+
server_name %domain_idn% %alias_idn%;
9+
root %docroot%;
10+
index index.php index.html index.htm;
11+
access_log /var/log/nginx/domains/%domain%.log combined;
12+
access_log /var/log/nginx/domains/%domain%.bytes bytes;
13+
error_log /var/log/nginx/domains/%domain%.error.log error;
14+
15+
include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
16+
17+
location = /favicon.ico {
18+
log_not_found off;
19+
access_log off;
20+
}
21+
22+
location = /robots.txt {
23+
allow all;
24+
log_not_found off;
25+
access_log off;
26+
}
27+
28+
location ~ /\.(?!well-known\/) {
29+
deny all;
30+
return 404;
31+
}
32+
33+
# Force pdf files to be downloaded
34+
location ~* \.pdf$ {
35+
add_header Content-Disposition Attachment;
36+
add_header X-Content-Type-Options nosniff;
37+
}
38+
39+
# Force files in upload directory to be downloaded
40+
location ~ ^/upload/ {
41+
add_header Content-Disposition Attachment;
42+
add_header X-Content-Type-Options nosniff;
43+
}
44+
45+
# [REQUIRED EDIT IF MULTILANG]
46+
# rewrite ^/fr$ /fr/ redirect;
47+
# rewrite ^/fr/(.*) /$1;
48+
49+
# Images
50+
rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$1$2$3.jpg last;
51+
rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last;
52+
rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last;
53+
rewrite ^/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last;
54+
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last;
55+
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg last;
56+
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg last;
57+
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg last;
58+
rewrite ^/c/([0-9]+)(-[.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+.jpg$ /img/c/$1$2$3.jpg last;
59+
rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+.jpg$ /img/c/$1$2.jpg last;
60+
61+
# AlphaImageLoader for IE and fancybox
62+
rewrite ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 last;
63+
64+
# Web service API
65+
rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;
66+
67+
# Installation sandbox
68+
rewrite ^(/install(?:-dev)?/sandbox)/(.*) /$1/test.php last;
69+
70+
# Source code directories
71+
location ~ ^/(app|bin|cache|classes|config|controllers|docs|localization|override|src|tests|tools|translations|travis-scripts|vendor|var)/ {
72+
deny all;
73+
return 404;
74+
}
75+
76+
# vendor in modules directory
77+
location ~ ^/modules/.*/vendor/ {
78+
deny all;
79+
return 404;
80+
}
81+
82+
# Prevent exposing other sensitive files
83+
location ~ \.(yml|log|tpl|twig|sass)$ {
84+
deny all;
85+
return 404;
86+
}
87+
88+
# Prevent injection of php files
89+
location /upload {
90+
location ~ \.php$ {
91+
deny all;
92+
return 404;
93+
}
94+
}
95+
location /img {
96+
location ~ \.php$ {
97+
deny all;
98+
return 404;
99+
}
100+
}
101+
102+
location / {
103+
try_files $uri $uri/ /index.php?$args;
104+
105+
location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
106+
expires 30d;
107+
fastcgi_hide_header "Set-Cookie";
108+
}
109+
110+
location ~ [^/]\.php(/|$) {
111+
try_files $fastcgi_script_name /index.php$uri&$args =404;
112+
fastcgi_split_path_info ^(.+\.php)(/.+)$;
113+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
114+
115+
fastcgi_pass %backend_lsnr%;
116+
fastcgi_index index.php;
117+
include /etc/nginx/fastcgi_params;
118+
}
119+
}
120+
121+
error_page 403 /error/404.html;
122+
error_page 404 /index.php?controller=404;
123+
error_page 500 502 503 504 /error/50x.html;
124+
125+
location /error/ {
126+
alias %home%/%user%/web/%domain%/document_errors/;
127+
}
128+
129+
location /vstats/ {
130+
alias %home%/%user%/web/%domain%/stats/;
131+
include %home%/%user%/web/%domain%/stats/auth.conf*;
132+
}
133+
134+
include /etc/nginx/conf.d/phpmyadmin.inc*;
135+
include /etc/nginx/conf.d/phppgadmin.inc*;
136+
include %home%/%user%/conf/web/%domain%/nginx.conf_*;
137+
}

0 commit comments

Comments
 (0)