Browse Source

Merge pull request #1261 from hestiacp/fix/1259-fix-issue-with-pam-restrictions

1259 Fix issue with additional PAM requirements
Raphael Schneeberger 5 years ago
parent
commit
c7a6bf45d7
5 changed files with 28 additions and 0 deletions
  1. 1 0
      .gitignore
  2. 7 0
      bin/v-add-user
  3. 8 0
      bin/v-add-web-domain-ftp
  4. 6 0
      bin/v-change-user-password
  5. 6 0
      bin/v-change-web-domain-ftp-password

+ 1 - 0
.gitignore

@@ -15,3 +15,4 @@ test/node_modules/
 npm-debug.log
 .phpunit.result.cache
 .vs
+.nova

+ 7 - 0
bin/v-add-user

@@ -62,6 +62,13 @@ check_result $? "user creation failed" $E_INVALID
 # Adding password
 echo "$user:$password" | /usr/sbin/chpasswd
 
+if [ $? -ne 0 ]; then 
+    # Delete user on failure
+    /usr/sbin/deluser "$user" > /dev/null 2>&1
+    echo "Error: Password not accepted due to PAM restrictions"
+    exit 2
+fi
+
 # Add a general group for normal users created by Hestia
 if [ -z "$(grep ^hestia-users: /etc/group)" ]; then
     groupadd --system "hestia-users"

+ 8 - 0
bin/v-add-web-domain-ftp

@@ -93,6 +93,14 @@ fi
 
 # Set ftp user password
 echo "$ftp_user:$password" | /usr/sbin/chpasswd
+
+if [ $? -ne 0 ]; then 
+    # Delete user on failure again
+    /usr/sbin/deluser "$ftp_user"  > /dev/null 2>&1
+    echo "Error: Password not accepted due to PAM restrictions"
+    exit 2
+fi
+
 ftp_md5=$(awk -v user=$ftp_user -F : 'user == $1 {print $2}' /etc/shadow)
 
 # Adding jailed sftp env

+ 6 - 0
bin/v-change-user-password

@@ -47,6 +47,12 @@ check_hestia_demo_mode
 
 # Changing user password
 echo "$user:$password" | /usr/sbin/chpasswd
+
+if [ $? -ne 0 ]; then 
+    echo "Error: Password not accepted due to PAM restrictions"
+    exit 2
+fi
+
 md5=$(awk -v user=$user -F : 'user == $1 {print $2}' /etc/shadow)
 
 if [ "$user" = 'admin' ] && [ -e "$HESTIA/web/reset.admin" ]; then

+ 6 - 0
bin/v-change-web-domain-ftp-password

@@ -56,6 +56,12 @@ check_hestia_demo_mode
 
 # Changing ftp user password
 echo "$ftp_user:$password" | /usr/sbin/chpasswd
+
+if [ $? -ne 0 ]; then 
+    echo "Error: Password not accepted due to PAM restrictions"
+    exit 2
+fi
+
 ftp_md5=$(awk -v user=$ftp_user -F : 'user == $1 {print $2}' /etc/shadow)