Skip to content

Commit ae5ed19

Browse files
author
Kristan Kenney
committed
Merge branch 'main' into staging/docs
2 parents 1a1ee94 + 8dca2d7 commit ae5ed19

File tree

30 files changed

+4512
-133
lines changed

30 files changed

+4512
-133
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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ All notable changes to this project will be documented in this file.
4242
- Fixed an issue with paswords containing "`'`" - [Forum](https://forum.hestiacp.com/t/two-factor-authentication-issue-with-standard-user/1652/)
4343
- Refactored LXD compiler script
4444
- Cleaned up entries used in the Google / Gmail DNS template - thanks **@madito**
45+
- Improved translations (NL, DE, UK, RU, ES, IT, ZH-CN)
4546

4647
## [1.2.4] - Service Release
4748
### Features

bin/v-add-remote-dns-host

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ port=$2
1616
PORT=$port
1717
user=$3
1818
USER=$user
19+
hash=$user
20+
HASH=$user
1921
password=$4; HIDE=4
2022
PASSWORD=$password
2123
type=${5-api}
@@ -33,9 +35,14 @@ source $HESTIA/conf/hestia.conf
3335
# Verifications #
3436
#----------------------------------------------------------#
3537

36-
args_usage='HOST PORT USER PASSWORD [TYPE] [DNS_USER]'
37-
check_args '4' "$#" "$args_usage"
38-
is_format_valid 'host' 'port' 'user' 'type' 'dns_user'
38+
args_usage='HOST PORT USER [PASSWORD] [TYPE] [DNS_USER]'
39+
check_args '3' "$#" "$args_usage"
40+
is_format_valid 'host' 'port' 'type' 'dns_user'
41+
if [ -z "$password" ]; then
42+
is_format_valid 'hash'
43+
else
44+
is_format_valid 'user'
45+
fi
3946
is_system_enabled "$DNS_SYSTEM" 'DNS_SYSTEM'
4047
is_password_valid
4148
is_dnshost_new
@@ -51,10 +58,17 @@ time_n_date=$(date +'%T %F')
5158
time=$(echo "$time_n_date" |cut -f 1 -d \ )
5259
date=$(echo "$time_n_date" |cut -f 2 -d \ )
5360

54-
# Concatentating dns host string
55-
str="HOST='$host' PORT='$port' USER='$user' PASSWORD='$password'"
56-
str="$str DNS_USER='$dns_user' TYPE='$type' SUSPENDED='no'"
57-
str="$str TIME='$time' DATE='$date'"
61+
if [ -z "$password" ]; then
62+
# Concatentating dns host string
63+
str="HOST='$host' PORT='$port' HASH='$hash'"
64+
str="$str DNS_USER='$dns_user' TYPE='$type' SUSPENDED='no'"
65+
str="$str TIME='$time' DATE='$date'"
66+
else
67+
# Concatentating dns host string
68+
str="HOST='$host' PORT='$port' USER='$user' PASSWORD='$password'"
69+
str="$str DNS_USER='$dns_user' TYPE='$type' SUSPENDED='no'"
70+
str="$str TIME='$time' DATE='$date'"
71+
fi
5872

5973
# Adding host to dns-cluster.conf
6074
echo "$str" >> $HESTIA/conf/dns-cluster.conf

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

func/main.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,12 @@ is_service_format_valid() {
921921
fi
922922
}
923923

924+
is_hash_format_valid() {
925+
if ! [[ "$1" =~ ^[_A-Za-z0-9]{1,32}$ ]]; then
926+
check_result $E_INVALID "invalid $2 format :: $1"
927+
fi
928+
}
929+
924930
# Format validation controller
925931
is_format_valid() {
926932
for arg_name in $*; do
@@ -952,6 +958,7 @@ is_format_valid() {
952958
extentions) is_common_format_valid "$arg" 'extentions' ;;
953959
ftp_password) is_password_format_valid "$arg" ;;
954960
ftp_user) is_user_format_valid "$arg" "$arg_name" ;;
961+
hash) is_hash_format_valid "$arg" "$arg_name" ;;
955962
host) is_object_format_valid "$arg" "$arg_name" ;;
956963
hour) is_cron_format_valid "$arg" $arg_name ;;
957964
id) is_int_format_valid "$arg" 'id' ;;

0 commit comments

Comments
 (0)