Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent users from having access to alien home dirs #1855

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions bin/v-add-user
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ is_package_valid
# Action #
#----------------------------------------------------------#

# create secure group if not exist. Users in the group can not access to alien home directories.
grep -q "^vstsecure:" /etc/group || groupadd --system vstsecure

# Parsing package data
pkg_data=$(cat $VESTA/data/packages/$package.pkg |egrep -v "TIME|DATE")

Expand All @@ -55,7 +58,7 @@ shell_conf=$(echo "$pkg_data" | grep 'SHELL' | cut -f 2 -d \')
shell=$(grep -w "$shell_conf" /etc/shells |head -n1)

# Adding user
/usr/sbin/useradd "$user" -s "$shell" -c "$email" -m -d "$HOMEDIR/$user"
/usr/sbin/useradd "$user" -s "$shell" -c "$email" -G vstsecure -m -d "$HOMEDIR/$user"
check_result $? "user creation failed" $E_INVALID

# Adding password
Expand Down Expand Up @@ -83,7 +86,8 @@ if [ ! -z "$DNS_SYSTEM" ]; then
fi

# Set permissions
chmod a+x $HOMEDIR/$user
chgrp vstsecure $HOMEDIR/$user
chmod a+x,g-rwx $HOMEDIR/$user
chattr +i $HOMEDIR/$user/conf


Expand Down