The Art of Userspace Sandboxing on Linux
Raunak Ramakrishnan
Why Sandboxing Matters
Namespaces
Namespace type | Separate View Of |
User | User and group IDs, capabilities |
Mount | Mount points |
PID | Process IDs |
Network | Network interfaces, routes, firewalls, ports |
Time | Boot and monotonic clocks |
User Namespaces - Least Privilege Identity
Capabilities
cgroups
Seccomp: System Call Filtering
Seccomp Filtering - common pitfalls
Landlock: User-Space Policy Enforcement
ABI | Added |
1 | File execute, read, write, read-dir, remove, make-* |
2 | REFER: link or rename across directories |
3 | TRUNCATE |
4 | TCP bind and connect by port |
5 | ioctl on devices |
6 | Scoping of abstract UNIX sockets and signals |
7 | Audit logging flags for landlock_restrict_self |
8 | enforce on all threads of the process |
9 | connect to pathname UNIX sockets |
Filesystem Views: Reducing What a Process Can See
Userspace Networking - Why is it not straightforward
Other Approaches
Demo
Demo Phase 0: An Unsafe Script
Demo Phase 1: Using Namespaces and seccomp
Demo Phase 2 - Using Landlock
Demo Phase 3: Using delegated cgroups
Interesting Rootless Sandboxing Projects
References
Let’s talk sandboxing