Repository navigation
Conversation
…P_SYSLOG Bypass detection previously tailed the kernel ring buffer via dmesg, which requires CAP_SYSLOG in the initial user namespace and therefore silently degrades in user-namespaced pods (hostUsers: false). Bind an nfnetlink_log socket inside the workload netns instead and generate "log group <N>" nftables rules; delivery is netns-scoped and covered by namespaced CAP_NET_ADMIN. The printk + dmesg path remains an automatic fallback for kernels without nfnetlink_log, and CAP_SYSLOG is removed from the Kubernetes, Docker, and Podman driver capability sets. Refs #2382 Signed-off-by: Hai Nguyen <haingu@nvidia.com>
gaveezy
requested review from
a team,
derekwaynecarr,
maxamillion and
mrunalp
as code owners
July 21, 2026 06:57
|
Thank you for your submission! We ask that you sign our Developer Certificate of Origin before we can accept your contribution. You can sign the DCO by adding a comment below using this text: I have read the DCO document and I hereby sign the DCO. You can retrigger this bot by commenting recheck in this Pull Request. Posted by the DCO Assistant Lite bot. |
Author
|
I have read the DCO document and I hereby sign the DCO. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Switch sandbox bypass detection from tailing the kernel ring buffer (
dmesg, requiresCAP_SYSLOGin the initial user namespace) to an nfnetlink_log (NFLOG) socket bound inside the workload netns (covered by namespacedCAP_NET_ADMIN), and dropCAP_SYSLOGfrom the Kubernetes, Docker, and Podman driver capability sets. This makes bypass detection work in user-namespaced pods (hostUsers: false), where a grantedCAP_SYSLOGis a no-op because the kernel checks the ring buffer against the initial user namespace.Related Issue
Closes #2382
Changes
bypass_monitor::nflogmodule inopenshell-supervisor-process: minimal hand-rolled nfnetlink_log client over rawlibc(zero new dependencies) — acked group bind + packet copy-mode config, and parsing of packet messages (prefix attribute,NFULA_UID, raw IPv4/IPv6 + TCP/UDP headers for dst/ports/proto).NetworkNamespace::install_bypass_rulesbinds the NFLOG socket first (on a short-livedsetnsthread, during privileged startup before supervisor seccomp hardening) and generateslog prefix <p> group <N>rules on success; any failure falls back to the previouslog ... flags skuidprintk rules +dmesgmonitor, and only that path enables thenf_log_all_netnssysctl.bypass_monitor::spawntakes the optional socket and prefers it; OCSF dual-emit / denial-aggregator / activity reporting is factored into a sharedBypassReporterso both backends report identically. OCSF ConfigStateChange events record which backend was selected.CAP_SYSLOGremoved from the K8s pod spec, Dockercap_add, and Podmancap_add; driver tests now assert its absence. Sidecar topology is unchanged (it has no bypass log listener).docs/kubernetes/topology.mdxcapability table, Podman driver README capability rationale;e2e/rust/tests/user_namespaces.rscapability assertions updated.Enforcement is unaffected — the nftables REJECT rules do not depend on log delivery; NFLOG only carries the detection/alerting signal. As a side benefit the sandbox no longer reads host-global kernel logs.
Testing
mise run pre-commitpassesmise run cipasses (lint, compile/type checks, tests)cargo clippy(pedantic + nursery) clean for the Linux targetuser_namespaces.rse2e updated; requestingtest:e2e/test:e2e-kuberneteslabels to exercise the live NFLOG path (rule install + packet delivery) on a real kernelChecklist
Notes for reviewers
PF_BIND: group-targetedlog group <N>statements deliver to the bound group directly; protocol-family binding is only required for legacy non-group logging. Called out in a code comment — the e2e run should confirm on a live kernel./ok to test.