Skip to content

Commit c7a6bf4

Browse files
authored
Merge pull request hestiacp#1261 from hestiacp/fix/1259-fix-issue-with-pam-restrictions
1259 Fix issue with additional PAM requirements
2 parents 60a1a96 + 2035aff commit c7a6bf4

File tree

5 files changed

+28
-0
lines changed

5 files changed

+28
-0
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

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

0 commit comments

Comments
 (0)