feat(sandbox): Landlock TCP port restriction for mandatory proxy enforcement#13
Closed
Ladas wants to merge 1 commit into
Closed
feat(sandbox): Landlock TCP port restriction for mandatory proxy enforcement#13Ladas wants to merge 1 commit into
Ladas wants to merge 1 commit into
Conversation
When Platform mode is active, apply Landlock ABI v4 network rules to restrict TCP connect to only the proxy port (default 3128). This makes the loopback CONNECT proxy mandatory at the kernel level -- a process calling connect() to any other port gets EACCES. This closes the cooperative proxy gap identified in the enforcement analysis: without this, processes ignoring HTTP_PROXY could bypass the proxy and connect directly (caught only by Tier 3 NetworkPolicy). With this, enforcement is at Tier 1 (kernel LSM). Graceful degradation: if the kernel does not support Landlock ABI v4 (e.g. RHEL 9.5 or earlier), the network rules are silently skipped and enforcement falls back to the cooperative proxy + NetworkPolicy (same as Issue NVIDIA#899 base behavior). Ref: NVIDIA#899
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
Add Landlock ABI v4 TCP port restriction to Platform mode. When active,
the kernel restricts
connect()to only the proxy port (default 3128).Any
connect()to another port returns EACCES at the kernel level.This closes the cooperative proxy gap: without this, a process ignoring
HTTP_PROXYcan connect directly (caught only by K8s NetworkPolicy atthe CNI level). With this, enforcement is at the kernel LSM layer -- no
userspace bypass possible.
Depends on: #12 (Platform mode base)
What changes
AccessNet,NetPortfrom thelandlockcrate (already v0.4, supports network rules)prepare(): handleAccessNet::ConnectTcpand addNetPortrule for the proxy port when Platform modeHow it works
Related
docs/research/openshell-network-enforcement-analysis.mdAssisted-By: Claude Code