All projects

Secure systems · Maintained

compartment

Linux process isolation with rootless Landlock/seccomp, a root namespace container, and an optional BPF-LSM sealing layer.

At a glance

Evidence and scope

Repository measurements and recorded project results. Test and benchmark claims were inspected, not rerun during this catalog refresh. Physical line counts use the stated file scopes.

BPF core
11,341 linesFive top-level C/header files for sealing, observation, userspace control, and the ABI; tools excluded.
BPF tests
22,322 lines145 tracked C, header, Python, and shell files under compartment-bpf/tests; physical lines include comments and blanks.
Enforcement matrix
3,284 trialsActor × operation × flag combinations, plus 44 documented bypass scenarios in BPF v0.8.0.
Robustness
10,000 iterationsReproducible fuzz/soak, 1,024 pin/unpin churn cycles, and a measured overhead gate.
Reviewed sources · 2026-10-15 · 2332b818f208

324 tracked files · 28 documentation files · 1 workflow files. Inventory includes data and vendored or generated files; workflow presence does not establish a passing run.

Download inventory and line-count file scopes

Executive summary

compartment is a Linux process-isolation toolkit organized around two small C executables and one profile format. The rootless path combines Landlock, seccomp, environment cleanup, and audit logging. The root path adds Linux namespaces, pivot_root, capability handling, and a minimal container view. An optional BPF-LSM module can seal individual inodes at the kernel layer. The repository is unusually direct about its limits: it is a defense-in-depth tool, not a professionally evaluated security product or a complete boundary against every bypass class.

Problem and context

Running an AI agent, network client, or other complex process often gives one program access to both sensitive files and network egress. compartment makes those authorities explicit and supports splitting them between processes. Its worked SSH example gives one component read access to keys without filesystem writes and gives a second component network access without access to those keys.

What was built

ComponentRole
compartment-userRootless Landlock and seccomp sandbox with environment and audit controls
compartment-rootNamespace container with pivot_root, capability drop, and the same policy surface
sandbox.shUser and network namespace wrapper with a constrained proxy bridge
compartment-bpfOptional BPF-LSM inode sealing for advanced deployments

The repository also includes profiles for AI agents, SSH, proxy helpers, containers, and relaxed development, plus a syscall profiler that can observe a program and draft a starting policy.

How it works

The rootless tool applies no_new_privs, filesystem rules, syscall filtering, environment sanitization, and logging before replacing itself with the target process. Child processes inherit restrictions and cannot remove them. The root tool builds a separate namespace environment and replaces the visible root filesystem rather than relying on chroot alone.

The optional BPF module is intentionally separate because it changes kernel, toolchain, and privilege requirements. It complements rather than replaces the zero-dependency core.

Evidence and validation

The v1.4.1 core separates unprivileged integration suites from real-root container and limited-root SSH suites. Their counts come from the runner; the documentation does not promise one fixed total. Profile loading now checks source trust, applies changes transactionally, and allows security switches to tighten policy only. Per-file and TCP-port Landlock rules extend the policy surface.

The BPF v0.8.0 documentation records 3,284 enforcement trials, 44 bypass scenarios, 17 strict-launch witnesses, and stress gates on kernels 6.8.0-139 and 7.0.0-31. Mount, ACL, and ioctl coverage were extended; timestamp writes are now in the no-chmod class. Opt-in self-protection has explicit operational costs and residual limits. These are recorded project results, not fresh kernel test runs from this portfolio review.

Boundaries

The repository does not claim formal verification, penetration testing, or complete bypass coverage. Kernel configuration and Landlock ABI support affect the protection available. Direct network-egress bypass coverage remains incomplete. The v1.4.1 documentation makes clear that allowing the dynamic loader can bypass an exec-target allowlist; even a closed exec-target boundary does not prevent an allowed program from interpreting or loading other code. The login-shell replacement is an opinionated deployment with documented compatibility and bypass caveats.

Repository map and first run

make
make test
./compartment-user --dry-run -- /bin/sh
./compartment-user -- /bin/sh

Read HOWTO.md for profiles and operational modes, DESIGN.md for the architecture and review log, and SECURITY.md for disclosure scope and known limitations. The optional BPF component has its own on-ramp and requirements.