mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
security: Enforce permissions on /home/ so that they can't sneak in each other home
This commit is contained in:
parent
750f1c13fe
commit
0db4b80e13
2 changed files with 10 additions and 0 deletions
|
@ -123,6 +123,11 @@ do_post_regen() {
|
||||||
setfacl -m g:all_users:--- /etc/yunohost
|
setfacl -m g:all_users:--- /etc/yunohost
|
||||||
setfacl -m g:all_users:--- /etc/ssowat
|
setfacl -m g:all_users:--- /etc/ssowat
|
||||||
|
|
||||||
|
for USER in $(yunohost user list --quiet --output-as json | jq -r '.users | .[] | .username')
|
||||||
|
do
|
||||||
|
[ ! -e "/home/$USER" ] || setfacl -m g:all_users:--- /home/$USER
|
||||||
|
done
|
||||||
|
|
||||||
# Misc configuration / state files
|
# Misc configuration / state files
|
||||||
chown root:root $(ls /etc/yunohost/{*.yml,*.yaml,*.json,mysql,psql} 2>/dev/null)
|
chown root:root $(ls /etc/yunohost/{*.yml,*.yaml,*.json,mysql,psql} 2>/dev/null)
|
||||||
chmod 600 $(ls /etc/yunohost/{*.yml,*.yaml,*.json,mysql,psql} 2>/dev/null)
|
chmod 600 $(ls /etc/yunohost/{*.yml,*.yaml,*.json,mysql,psql} 2>/dev/null)
|
||||||
|
|
|
@ -215,6 +215,11 @@ def user_create(operation_logger, username, firstname, lastname, mail, password,
|
||||||
logger.warning(m18n.n('user_home_creation_failed'),
|
logger.warning(m18n.n('user_home_creation_failed'),
|
||||||
exc_info=1)
|
exc_info=1)
|
||||||
|
|
||||||
|
try:
|
||||||
|
subprocess.check_call(["setfacl", "-m", "g:all_users:---", "/home/%s" % username])
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
logger.warning("Failed to protect /home/%s" % username, exc_info=1)
|
||||||
|
|
||||||
# Create group for user and add to group 'all_users'
|
# Create group for user and add to group 'all_users'
|
||||||
user_group_create(groupname=username, gid=uid, primary_group=True, sync_perm=False)
|
user_group_create(groupname=username, gid=uid, primary_group=True, sync_perm=False)
|
||||||
user_group_update(groupname='all_users', add=username, force=True, sync_perm=True)
|
user_group_update(groupname='all_users', add=username, force=True, sync_perm=True)
|
||||||
|
|
Loading…
Add table
Reference in a new issue