Skip to content

Commit abfc150

Browse files
authored
Merge pull request hestiacp#1643 from hestiacp/release
Merge Changes from Release (v1.3.3) into main
2 parents ebf12f3 + 245accf commit abfc150

File tree

6 files changed

+257
-18
lines changed

6 files changed

+257
-18
lines changed

bin/v-add-letsencrypt-domain

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,11 @@ debug_log() {
109109
# Perform verification if read-only mode is enabled
110110
check_hestia_demo_mode
111111

112+
112113
#----------------------------------------------------------#
113114
# Action #
114115
#----------------------------------------------------------#
115116

116-
117-
118-
119117
# Generate correct variables for mail domain SSL certificates
120118
if [ ! -z "$mail" ]; then
121119
root_domain=$domain

bin/v-check-api-key

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,18 @@
1212
# Variable&Function #
1313
#----------------------------------------------------------#
1414

15-
if [ -z "$1" ]; then
15+
[[ -z $HESTIA ]] && HESTIA="/usr/local/hestia"
16+
17+
source $HESTIA/func/main.sh
18+
19+
new_timestamp
20+
21+
abort_missmatch() {
1622
echo "Error: key missmatch"
17-
exit 9
18-
fi
19-
key=$(basename $1)
23+
echo "$date $time api $ip failed to login" >> $HESTIA/log/auth.log
24+
exit $E_PASSWORD
25+
}
26+
2027
ip=${2-127.0.0.1}
2128
time_n_date=$(date +'%T %F')
2229
time=$(echo "$time_n_date" |cut -f 1 -d \ )
@@ -29,11 +36,20 @@ check_hestia_demo_mode
2936
# Action #
3037
#----------------------------------------------------------#
3138

32-
if [ ! -e $HESTIA/data/keys/$key ]; then
33-
echo "Error: key missmatch"
34-
echo "$date $time api $ip failed to login" >> $HESTIA/log/auth.log
35-
exit 9
36-
fi
39+
key="$(basename "$1")"
40+
41+
# Exit if Key is unset or to short
42+
[[ -z $key || ${#key} -lt 16 ]] && abort_missmatch
43+
44+
# Key file must exist
45+
maybe_key_path="$(readlink -e "${HESTIA}/data/keys/${key}")"
46+
[[ -z $maybe_key_path ]] && abort_missmatch
47+
48+
# Key file cannot be the key store
49+
[[ $maybe_key_path == "${HESTIA}/data/keys" ]] && abort_missmatch
50+
51+
# Key file must be in the key store
52+
[[ $maybe_key_path == "${HESTIA}/data/keys/"* ]] || abort_missmatch
3753

3854

3955
#----------------------------------------------------------#

bin/v-generate-api-key

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ check_hestia_demo_mode
2727
#----------------------------------------------------------#
2828

2929
if [ ! -d ${KEYS} ]; then
30-
mkdir -p ${KEYS}
30+
mkdir -p ${KEYS}
31+
chown admin:root ${KEYS}
32+
chmod 750 ${KEYS}
3133
fi
3234

3335
if [[ -e ${KEYS}${HASH} ]] ; then

install/upgrade/upgrade.conf

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
# Update default templates when performing an upgrade
2222
# These flags should be set to true if any changes are made to the template files
2323
# to ensure that they are properly updated on the end-user's system.
24-
UPGRADE_UPDATE_WEB_TEMPLATES='true'
25-
UPGRADE_UPDATE_MAIL_TEMPLATES='true'
26-
UPGRADE_UPDATE_DNS_TEMPLATES='true'
24+
UPGRADE_UPDATE_WEB_TEMPLATES='false'
25+
UPGRADE_UPDATE_MAIL_TEMPLATES='false'
26+
UPGRADE_UPDATE_DNS_TEMPLATES='false'
2727

2828
# Update phpMyAdmin to the latest version during upgrade
29-
UPGRADE_UPDATE_PHPMYADMIN='true'
29+
UPGRADE_UPDATE_PHPMYADMIN='false'
3030

3131
# Update roundcube to the latest version during upgrade
3232
UPGRADE_UPDATE_ROUNDCUBE='true'
@@ -38,7 +38,7 @@ UPGRADE_UPDATE_RAINLOOP='true'
3838
# UPGRADE_UPDATE_FILEMANAGER: Performs an upgrade/repair install of the File Manager
3939
# UPGRADE_UPDATE_FILEMANAGER: Updates only the configuration file
4040
UPGRADE_UPDATE_FILEMANAGER='false'
41-
UPGRADE_UPDATE_FILEMANAGER_CONFIG='true'
41+
UPGRADE_UPDATE_FILEMANAGER_CONFIG='false'
4242

4343
# Post installation clean-up
4444
UPGRADE_REBUILD_USERS='true'
@@ -50,8 +50,10 @@ UPGRADE_RESTART_SERVICES='true'
5050

5151
# Set version of phpMyAdmin to install during upgrade if not already installed
5252
pma_v='5.0.4'
53+
5354
# Set version of RoundCube (Webmail) to update during upgrade if not already installed
5455
# Note: only aplies to "non-apt installs >= 1.4.0 or manualy phased out"
5556
rc_v="1.4.10"
57+
5658
# Set version of Rainloop (Webmail) to update during upgrade if not already installed
5759
rl_v="1.14.0"

install/upgrade/versions/1.3.3.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
# Hestia Control Panel upgrade script for target version 1.3.3
4+
5+
#######################################################################################
6+
####### Place additional commands below. #######
7+
#######################################################################################
8+
9+
10+
# Check if keys folder exists and adjust permissions
11+
if [ -d "$HESTIA/data/keys" ]; then
12+
echo '[ * ] Update permissions'
13+
chmod 750 "$HESTIA/data/keys"
14+
chown admin:root "$HESTIA/data/keys"
15+
fi
16+
17+
if [[ ! -e /etc/hestiacp/hestia.conf ]]; then
18+
echo '[ * ] Create global Hestia config'
19+
20+
mkdir -p /etc/hestiacp
21+
echo -e "# Do not edit this file, will get overwritten on next upgrade, use /etc/hestiacp/local.conf instead\n\nexport HESTIA='/usr/local/hestia'\n\n[[ -f /etc/hestiacp/local.conf ]] && source /etc/hestiacp/local.conf" > /etc/hestiacp/hestia.conf
22+
fi

test/test.bats

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,205 @@ function validate_database(){
838838
refute_output
839839
}
840840

841+
#----------------------------------------------------------#
842+
# MULTIPHP #
843+
#----------------------------------------------------------#
844+
845+
@test "Multiphp: Default php Backend version" {
846+
def_phpver=$(multiphp_default_version)
847+
multi_domain="multiphp.${domain}"
848+
849+
run v-add-web-domain $user $multi_domain 198.18.0.125
850+
assert_success
851+
refute_output
852+
853+
echo -e "<?php\necho PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;" > "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
854+
validate_web_domain $user $multi_domain "$def_phpver" 'php-test.php'
855+
rm "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
856+
857+
}
858+
859+
@test "Multiphp: Change backend version - PHP v5.6" {
860+
test_phpver='5.6'
861+
multi_domain="multiphp.${domain}"
862+
863+
if [ ! -d "/etc/php/${test_phpver}/fpm/pool.d/" ]; then
864+
skip "PHP ${test_phpver} not installed"
865+
fi
866+
867+
run v-change-web-domain-backend-tpl $user $multi_domain 'PHP-5_6' 'yes'
868+
assert_success
869+
refute_output
870+
871+
# Changing web backend will create a php-fpm pool config in the corresponding php folder
872+
assert_file_exist "/etc/php/${test_phpver}/fpm/pool.d/${multi_domain}.conf"
873+
874+
# A single php-fpm pool config file must be present
875+
num_fpm_config_files="$(find -L /etc/php/ -name "${multi_domain}.conf" | wc -l)"
876+
assert_equal "$num_fpm_config_files" '1'
877+
878+
echo -e "<?php\necho 'hestia-multiphptest:'.PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;" > "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
879+
validate_web_domain $user $multi_domain "hestia-multiphptest:$test_phpver" 'php-test.php'
880+
rm "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
881+
}
882+
883+
@test "Multiphp: Change backend version - PHP v7.0" {
884+
test_phpver='7.0'
885+
multi_domain="multiphp.${domain}"
886+
887+
if [ ! -d "/etc/php/${test_phpver}/fpm/pool.d/" ]; then
888+
skip "PHP ${test_phpver} not installed"
889+
fi
890+
891+
run v-change-web-domain-backend-tpl $user $multi_domain 'PHP-7_0' 'yes'
892+
assert_success
893+
refute_output
894+
895+
# Changing web backend will create a php-fpm pool config in the corresponding php folder
896+
assert_file_exist "/etc/php/${test_phpver}/fpm/pool.d/${multi_domain}.conf"
897+
898+
# A single php-fpm pool config file must be present
899+
num_fpm_config_files="$(find -L /etc/php/ -name "${multi_domain}.conf" | wc -l)"
900+
assert_equal "$num_fpm_config_files" '1'
901+
902+
echo -e "<?php\necho 'hestia-multiphptest:'.PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;" > "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
903+
validate_web_domain $user $multi_domain "hestia-multiphptest:$test_phpver" 'php-test.php'
904+
rm "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
905+
}
906+
907+
@test "Multiphp: Change backend version - PHP v7.1" {
908+
test_phpver='7.1'
909+
multi_domain="multiphp.${domain}"
910+
911+
if [ ! -d "/etc/php/${test_phpver}/fpm/pool.d/" ]; then
912+
skip "PHP ${test_phpver} not installed"
913+
fi
914+
915+
run v-change-web-domain-backend-tpl $user $multi_domain 'PHP-7_1' 'yes'
916+
assert_success
917+
refute_output
918+
919+
# Changing web backend will create a php-fpm pool config in the corresponding php folder
920+
assert_file_exist "/etc/php/${test_phpver}/fpm/pool.d/${multi_domain}.conf"
921+
922+
# A single php-fpm pool config file must be present
923+
num_fpm_config_files="$(find -L /etc/php/ -name "${multi_domain}.conf" | wc -l)"
924+
assert_equal "$num_fpm_config_files" '1'
925+
926+
echo -e "<?php\necho 'hestia-multiphptest:'.PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;" > "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
927+
validate_web_domain $user $multi_domain "hestia-multiphptest:$test_phpver" 'php-test.php'
928+
rm "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
929+
}
930+
931+
@test "Multiphp: Change backend version - PHP v7.2" {
932+
test_phpver='7.2'
933+
multi_domain="multiphp.${domain}"
934+
935+
if [ ! -d "/etc/php/${test_phpver}/fpm/pool.d/" ]; then
936+
skip "PHP ${test_phpver} not installed"
937+
fi
938+
939+
run v-change-web-domain-backend-tpl $user $multi_domain 'PHP-7_2' 'yes'
940+
assert_success
941+
refute_output
942+
943+
# Changing web backend will create a php-fpm pool config in the corresponding php folder
944+
assert_file_exist "/etc/php/${test_phpver}/fpm/pool.d/${multi_domain}.conf"
945+
946+
# A single php-fpm pool config file must be present
947+
num_fpm_config_files="$(find -L /etc/php/ -name "${multi_domain}.conf" | wc -l)"
948+
assert_equal "$num_fpm_config_files" '1'
949+
950+
echo -e "<?php\necho 'hestia-multiphptest:'.PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;" > "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
951+
validate_web_domain $user $multi_domain "hestia-multiphptest:$test_phpver" 'php-test.php'
952+
rm "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
953+
}
954+
955+
@test "Multiphp: Change backend version - PHP v7.3" {
956+
test_phpver='7.3'
957+
multi_domain="multiphp.${domain}"
958+
959+
if [ ! -d "/etc/php/${test_phpver}/fpm/pool.d/" ]; then
960+
skip "PHP ${test_phpver} not installed"
961+
fi
962+
963+
run v-change-web-domain-backend-tpl $user $multi_domain 'PHP-7_3' 'yes'
964+
assert_success
965+
refute_output
966+
967+
# Changing web backend will create a php-fpm pool config in the corresponding php folder
968+
assert_file_exist "/etc/php/${test_phpver}/fpm/pool.d/${multi_domain}.conf"
969+
970+
# A single php-fpm pool config file must be present
971+
num_fpm_config_files="$(find -L /etc/php/ -name "${multi_domain}.conf" | wc -l)"
972+
assert_equal "$num_fpm_config_files" '1'
973+
974+
echo -e "<?php\necho 'hestia-multiphptest:'.PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;" > "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
975+
validate_web_domain $user $multi_domain "hestia-multiphptest:$test_phpver" 'php-test.php'
976+
rm "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
977+
}
978+
979+
@test "Multiphp: Change backend version - PHP v7.4" {
980+
test_phpver='7.4'
981+
multi_domain="multiphp.${domain}"
982+
983+
if [ ! -d "/etc/php/${test_phpver}/fpm/pool.d/" ]; then
984+
skip "PHP ${test_phpver} not installed"
985+
fi
986+
987+
run v-change-web-domain-backend-tpl $user $multi_domain 'PHP-7_4' 'yes'
988+
assert_success
989+
refute_output
990+
991+
# Changing web backend will create a php-fpm pool config in the corresponding php folder
992+
assert_file_exist "/etc/php/${test_phpver}/fpm/pool.d/${multi_domain}.conf"
993+
994+
# A single php-fpm pool config file must be present
995+
num_fpm_config_files="$(find -L /etc/php/ -name "${multi_domain}.conf" | wc -l)"
996+
assert_equal "$num_fpm_config_files" '1'
997+
998+
echo -e "<?php\necho 'hestia-multiphptest:'.PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;" > "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
999+
validate_web_domain $user $multi_domain "hestia-multiphptest:$test_phpver" 'php-test.php'
1000+
rm "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
1001+
}
1002+
1003+
@test "Multiphp: Change backend version - PHP v8.0" {
1004+
test_phpver='8.0'
1005+
multi_domain="multiphp.${domain}"
1006+
1007+
if [ ! -d "/etc/php/${test_phpver}/fpm/pool.d/" ]; then
1008+
skip "PHP ${test_phpver} not installed"
1009+
fi
1010+
1011+
run v-change-web-domain-backend-tpl $user $multi_domain 'PHP-8_0' 'yes'
1012+
assert_success
1013+
refute_output
1014+
1015+
# Changing web backend will create a php-fpm pool config in the corresponding php folder
1016+
assert_file_exist "/etc/php/${test_phpver}/fpm/pool.d/${multi_domain}.conf"
1017+
1018+
# A single php-fpm pool config file must be present
1019+
num_fpm_config_files="$(find -L /etc/php/ -name "${multi_domain}.conf" | wc -l)"
1020+
assert_equal "$num_fpm_config_files" '1'
1021+
1022+
echo -e "<?php\necho 'hestia-multiphptest:'.PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;" > "$HOMEDIR/$user/web/$multi_domain/public_html/php-test.php"
1023+
validate_web_domain $user $multi_domain "hestia-multiphptest:$test_phpver" 'php-test.php'
1024+
rm $HOMEDIR/$user/web/$multi_domain/public_html/php-test.php
1025+
}
1026+
1027+
@test "Multiphp: Cleanup" {
1028+
multi_domain="multiphp.${domain}"
1029+
1030+
run v-delete-web-domain $user $multi_domain 'yes'
1031+
assert_success
1032+
refute_output
1033+
1034+
# No php-fpm pool config file must be present
1035+
num_fpm_config_files="$(find -L /etc/php/ -name "${multi_domain}.conf" | wc -l)"
1036+
assert_equal "$num_fpm_config_files" '0'
1037+
}
1038+
1039+
8411040
#----------------------------------------------------------#
8421041
# DNS #
8431042
#----------------------------------------------------------#

0 commit comments

Comments
 (0)