Skip to content

Commit b65ac4a

Browse files
authored
Merge pull request hestiacp#1127 from hestiacp/staging/fixes
Staging/fixes
2 parents 7803316 + 8ad50fc commit b65ac4a

File tree

20 files changed

+377
-254
lines changed

20 files changed

+377
-254
lines changed

CHANGELOG.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,27 @@ All notable changes to this project will be documented in this file.
99
- `UPGRADE_SEND_EMAIL` = Sends an email notification to admin email address
1010
- `UPGRADE_SEND_EMAIL_LOG` = Sends installation log output to admin email address
1111
- Upgrade process will now save logs to the `hst_backups` directory.
12+
- Support for removing backup remote location (#1083)
1213
- Add support Proftpd TLS Support
1314
- Add the possibility to assign user "Administrators" rights on login. Replaces "root" login. Notifications are only send towards the "admin" account email
1415

1516
## Buggfixes
1617
- Removed root login (root / root password )
17-
18-
## Bugfixes
18+
- Update apache2.conf replace Include with IncludeOptional (#1072)
19+
- Add ca-certificates, software-properties-common to the dependencies (#1073 + [Forum](https://forum.hestiacp.com/t/hestiscp-fails-on-new-debian-9-vps/1623/8) ) @daniel-eder
20+
- Fixed issues with database port during backup when port was missing (#1068)
21+
- Postqresql: forbid the use of upper case (#1084) causing issues with backup / creating database or user
22+
- Fixed permissions email account during restore (#1114)
23+
- Create .npm on creating new user (#1113) @hahagu
24+
- Fixed Access to a website without a ssl certificate on https shows the content of the first, valid ssl website (#1103)
25+
- Fixed an issue when installing --with-debs and version check (#1110)
26+
- Improved Translations Chinese @myrevery
27+
- File manager create directory with proper permissions
28+
- Removed loop ad v-rebuild-all (#1096)
29+
- Add $restart flag to v-add-web-domain-backend call (#1094) (#797) @bright-soft
30+
- Fixed an issue with Restore Failed on Domains with Mail Setups using SSL (#1069)
31+
- Fixed an issue with PHPMyAdmin button (#1078)
32+
- Changed WordPress name in Webapp installer (#1074)
1933

2034
## [1.2.3] - Service Release
2135
### Features

bin/v-add-database

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ source $HESTIA/func/main.sh
3030
source $HESTIA/func/db.sh
3131
source $HESTIA/conf/hestia.conf
3232

33+
if [ "$type" = "pgsql" ]; then
34+
database=$(echo "$user"_"$2" | tr '[:upper:]' '[:lower:]');
35+
dbuser=$(echo "$user"_"$3" | tr '[:upper:]' '[:lower:]');
36+
fi
37+
3338
#----------------------------------------------------------#
3439
# Verifications #
3540
#----------------------------------------------------------#

bin/v-add-sys-ip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ if [ ! -z "$PROXY_SYSTEM" ]; then
147147
sed -e "s/%ip%/$ip/g" \
148148
-e "s/%web_port%/$WEB_PORT/g" \
149149
-e "s/%proxy_port%/$PROXY_PORT/g" \
150+
-e "s/%proxy_ssl_port%/$PROXY_SSL_PORT/g" \
150151
> /etc/$PROXY_SYSTEM/conf.d/$ip.conf
151152

152153
# mod_extract_forwarded

bin/v-add-user

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,16 @@ mkdir $HOMEDIR/$user/.config \
102102
$HOMEDIR/$user/.cache \
103103
$HOMEDIR/$user/.local \
104104
$HOMEDIR/$user/.composer \
105-
$HOMEDIR/$user/.ssh
105+
$HOMEDIR/$user/.ssh \
106+
$HOMEDIR/$user/.npm
106107

107108
chown $user:$user \
108109
$HOMEDIR/$user/.config \
109110
$HOMEDIR/$user/.cache \
110111
$HOMEDIR/$user/.local \
111112
$HOMEDIR/$user/.composer \
112-
$HOMEDIR/$user/.ssh
113+
$HOMEDIR/$user/.ssh \
114+
$HOMEDIR/$user/.npm
113115

114116
# Set permissions
115117
chmod a+x $HOMEDIR/$user

bin/v-change-database-owner

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
database=$1
1414
user=$2
1515

16+
1617
# Includes
1718
source $HESTIA/func/main.sh
1819
source $HESTIA/func/db.sh
@@ -51,8 +52,15 @@ if [ -z "$db_data" ]; then
5152
exit $E_NOTEXIST
5253
fi
5354

54-
# Check if datbase name is uniq
55-
new_db=$(echo $database | sed "s/^${owner}_/${user}_/")
55+
#Fix issue #1084 with "Upper case not allowed with PGSQL"
56+
if [ "$TYPE" == "pgsql" ]; then
57+
usersmall=$(echo "$user" | tr '[:upper:]' '[:lower:]');
58+
else
59+
usersmall=$user
60+
fi
61+
62+
# Check if database name is uniqe
63+
new_db=$(echo $database | sed "s/^${owner}_/${usersmall}_/")
5664
check_db=$(grep "DB='$new_db'" $HESTIA/data/users/$user/db.conf)
5765
if [ ! -z "$check_db" ]; then
5866
echo "Error: $new_db database exists"
@@ -84,7 +92,7 @@ case $TYPE in
8492
esac
8593

8694
# Import configuration
87-
db_data=$(echo "$db_data" | sed "s/'${owner}_/'${user}_/g")
95+
db_data=$(echo "$db_data" | sed "s/'${owner}_/'${usersmall}_/g")
8896
echo "$db_data" >> $HESTIA/data/users/$user/db.conf
8997
parse_object_kv_list "$db_data"
9098

bin/v-change-database-user

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ database=$2
1515
dbuser="$user"_"$3"
1616
password=$4; HIDE=4
1717

18+
if [ "$type" = "pgsql" ]; then
19+
dbuser=$(echo "$user"_"$3" | tr '[:upper:]' '[:lower:]');
20+
fi
21+
1822
# Includes
1923
source $HESTIA/func/main.sh
2024
source $HESTIA/func/db.sh

bin/v-restore-user

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -584,17 +584,15 @@ if [ "$mail" != 'no' ] && [ ! -z "$MAIL_SYSTEM" ]; then
584584
check_result "$E_PARSING" "$error"
585585
fi
586586

587-
# Re-chowning files if uid differs
588-
if [ "$old_uid" -ne "$new_uid" ]; then
589-
find $HOMEDIR/$user/mail/$domain_idn -user $old_uid \
590-
-exec chown -h $user:mail {} \;
591-
fi
587+
# Chowning as owner needs to be user:mail instead of user:user
588+
find $HOMEDIR/$user/mail/$domain_idn -user $user \
589+
-exec chown -h $user:mail {} \;
592590
fi
593591

594592
# Chowning mail conf files to exim user
595593
find $HOMEDIR/$user/conf/mail/$domain_idn -user root \
596594
-exec chown $exim_user {} \;
597-
595+
598596
done
599597

600598
# Restarting web server

func/main.sh

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -724,9 +724,14 @@ is_common_format_valid() {
724724

725725
# Database format validator
726726
is_database_format_valid() {
727-
exclude="[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|<|>|?|/|\|\"|'|;|%|\`| ]"
728-
if [[ "$1" =~ $exclude ]] || [ 65 -le ${#1} ]; then
729-
check_result $E_INVALID "invalid $2 format :: $1"
727+
if [ "$3" == "pgsql" ]; then
728+
if ! [[ "$1" =~ ^[0-9a-z_]{1,63}$ ]]; then
729+
check_result $E_INVALID "invalid $2 format :: $1"
730+
fi
731+
else
732+
if ! [[ "$1" =~ ^[0-9a-zA-Z_]{1,64}$ ]]; then
733+
check_result $E_INVALID "invalid $2 format :: $1"
734+
fi
730735
fi
731736
}
732737

@@ -739,12 +744,17 @@ is_date_format_valid() {
739744

740745
# Database user validator
741746
is_dbuser_format_valid() {
742-
exclude="[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|<|>|?|/|\|\"|'|;|%|\`| ]"
743-
if [ 31 -le ${#1} ]; then
744-
check_result $E_INVALID "mysql username can be up to 30 characters long"
745-
fi
746-
if [[ "$1" =~ $exclude ]]; then
747-
check_result $E_INVALID "invalid $2 format :: $1"
747+
if [ "$3" == "pgsql" ]; then
748+
if ! [[ "$1" =~ ^[0-9a-z_]{1,63}$ ]]; then
749+
check_result $E_INVALID "invalid $2 format :: $1"
750+
fi
751+
else
752+
if [ 33 -le ${#1} ]; then
753+
check_result $E_INVALID "mysql username can be up to 32 characters long"
754+
fi
755+
if ! [[ "$1" =~ ^[0-9a-zA-Z_]{1,64}$ ]]; then
756+
check_result $E_INVALID "invalid $2 format :: $1"
757+
fi
748758
fi
749759
}
750760

@@ -938,10 +948,10 @@ is_format_valid() {
938948
charset) is_object_format_valid "$arg" "$arg_name" ;;
939949
charsets) is_common_format_valid "$arg" 'charsets' ;;
940950
comment) is_object_format_valid "$arg" 'comment' ;;
941-
database) is_database_format_valid "$arg" 'database';;
951+
database) is_database_format_valid "$arg" 'database' $type;;
942952
day) is_cron_format_valid "$arg" $arg_name ;;
943953
dbpass) is_password_format_valid "$arg" ;;
944-
dbuser) is_dbuser_format_valid "$arg" 'dbuser';;
954+
dbuser) is_dbuser_format_valid "$arg" 'dbuser' $type;;
945955
dkim) is_boolean_format_valid "$arg" 'dkim' ;;
946956
dkim_size) is_int_format_valid "$arg" ;;
947957
domain) is_domain_format_valid "$arg" ;;

install/deb/apache2/apache2.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ LogFormat "%{Referer}i -> %U" referer
8080
LogFormat "%{User-agent}i" agent
8181
LogFormat "%b" bytes
8282

83-
Include conf.d/*.conf
83+
IncludeOptional conf.d/*.conf
8484
IncludeOptional conf.d/domains/*.conf
8585

8686
# Include the virtual host configurations:

install/deb/templates/web/nginx/proxy_ip.tpl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,19 @@ server {
1212
}
1313
}
1414

15+
server {
16+
listen %ip%:%proxy_ssl_port% ssl http2;
17+
server_name _;
18+
ssl_certificate /usr/local/hestia/ssl/certificate.crt;
19+
ssl_certificate_key /usr/local/hestia/ssl/certificate.key;
20+
21+
return 301 http://$host$request_uri;
22+
23+
location / {
24+
root /var/www/document_errors/;
25+
}
26+
27+
location /error/ {
28+
alias /var/www/document_errors/;
29+
}
30+
}

0 commit comments

Comments
 (0)