-
Notifications
You must be signed in to change notification settings - Fork 10
Description
I think Landlock could benefit to a proper way to restrict namespace creation.
I do not have a UAPI in mind yet, the issue should be edited later in order to clarify it.
Why restricting the use of namespaces ?
- Restrict the creation of namespaces to a selected subset.
Namespace restriction is sometimes achieved through seccomp filters. However,
because seccomp filters cannot dereference pointers, they cannot be used to
restrict namespace creation via clone3(2). As a result, clone3(2) sometimes
is entirely disabled (e.g., Docker's default seccomp profile that denies
CLONE_NEWUSER).
Landlock could provide a way to restrict thoses without requiring a seccomp
filter that completely denies clone3(2).
Unprivileged user namespaces also greatly increase the Linux kernel attack
surface. Landlock could benefit from a mechanism to deny the creation of
unprivileged user namespaces.
Landlock could provide a way to restrict non-user namespaces creation from an
user namespace to a subset of thoses.
- Restrict depth of nested user namespaces.
Similar to user.max_user_namespaces, but enforced at the thread/process level.
What about capabilities restriction ?
- Restrict the capabilities gained through the creation of a user namespace
to a defined capability subset.
This would allow control over capabilities obtained through unprivileged user
namespaces prior to namespace creation.
Also ensuring no capabilities can be gained or inherited from within a
user-namespace.
How to implement those restrictions ?
See current LSM hooks and potentially RFC that introduces LSM hooks for namespaces.