Browse Source

Enable Jail on user creation (#4669)

* Enable jail when user is created

* Do the same with disk quota and resource limits
Jaap Marcus 1 year ago
parent
commit
a51f41f3e5
1 changed files with 6 additions and 3 deletions
  1. 6 3
      bin/v-add-user

+ 6 - 3
bin/v-add-user

@@ -75,6 +75,9 @@ pkg_data=$(cat $HESTIA/data/packages/$package.pkg | egrep -v "TIME|DATE")
 
 # Checking shell
 shell_conf=$(echo "$pkg_data" | grep -m1 'SHELL' | cut -f 2 -d \')
+jail_enabled=$(echo "$pkg_data" | grep -m1 'SHELL_JAIL_ENABLED' | cut -f 2 -d \')
+resource_enaled=$(echo "$pkg_data" | grep -m1 'RESOURCES_LIMIT' | cut -f 2 -d \')
+disk_quota_enabled=$(echo "$pkg_data" | grep -m1 'DISK_QUOTA' | cut -f 2 -d \')
 shell=$(grep -w "$shell_conf" /etc/shells | head -n1)
 
 # Adding user
@@ -264,12 +267,12 @@ DATE='$date'" > $USER_DATA/user.conf
 chmod 660 $USER_DATA/user.conf
 
 # Updating quota
-if [ "$DISK_QUOTA" = 'yes' ]; then
+if [ "$disk_quota_enabled" = 'yes' ]; then
 	$BIN/v-update-user-quota "$user"
 fi
 
 # Update resource limitation (cgroup)
-if [ "$RESOURCES_LIMIT" = 'yes' ]; then
+if [ "$resource_enaled" = 'yes' ]; then
 	$BIN/v-update-user-cgroup "$user"
 fi
 
@@ -287,7 +290,7 @@ fi
 $BIN/v-add-user-sftp-jail $user
 
 # Adding jailed ssh env
-if [ "$SHELL_JAIL_ENABLED" = 'yes' ]; then
+if [ "$jail_enabled" = 'yes' ]; then
 	$BIN/v-add-user-ssh-jail $user
 fi