mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 16:35:02 +01:00
Merge profiles: Add profile for unshare utility
This adds an unshare profile to allow it to function on a system
with user namespace restrictions enabled.
The child task of unshare will enter into a profile without capabilities
thus preventing unshare from being able to be used to
arbitrarily by-pass the user namespace restriction.
This profile does prevent applications launch with privilege (eg.
sudo unshare ...) from functioning so it may break some use cases.
Fixes: https://bugs.launchpad.net/ubuntu/+source/pageedit/+bug/2046844
Signed-off-by: John Johansen <john.johansen@canonical.com>
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1204
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
(cherry picked from commit 2d59dc3d9b
)
Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
parent
4d2a171466
commit
6198edb3d0
1 changed files with 29 additions and 0 deletions
29
profiles/apparmor.d/unshare-userns-restrict
Normal file
29
profiles/apparmor.d/unshare-userns-restrict
Normal file
|
@ -0,0 +1,29 @@
|
|||
# This profile allows almost everything and only exists to allow
|
||||
# unshare to work on a system with user namespace restrictions
|
||||
# being enforced.
|
||||
# unshare is allowed access to user namespaces and capabilities
|
||||
# within the user namespace, but its children do not have
|
||||
# capabilities, blocking unshare from being able to be used to
|
||||
# arbitrarily by-pass the user namespace restrictions.
|
||||
|
||||
profile unshare /usr/bin/unshare flags=(attach_disconnected) {
|
||||
allow capability,
|
||||
allow file rwlkm /{**,},
|
||||
allow network,
|
||||
allow unix,
|
||||
allow ptrace,
|
||||
allow signal,
|
||||
allow mqueue,
|
||||
allow io_uring,
|
||||
allow userns,
|
||||
allow mount,
|
||||
allow umount,
|
||||
allow pivot_root,
|
||||
allow dbus,
|
||||
audit allow cx /** -> unpriv_unshare,
|
||||
|
||||
profile unpriv_unshare flags=(attach_disconnected) {
|
||||
allow all,
|
||||
deny capability,
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue