fix(sandbox): fall back to /proc/net/tcp for peer identity resolution…#684
Open
davidpeden3 wants to merge 1 commit intoNVIDIA:mainfrom
Open
fix(sandbox): fall back to /proc/net/tcp for peer identity resolution…#684davidpeden3 wants to merge 1 commit intoNVIDIA:mainfrom
davidpeden3 wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
|
All contributors have signed the DCO ✍️ ✅ |
…NVIDIA#681) On Docker Desktop with WSL2 (amd64), iptables REDIRECT/DNAT connections from the sandbox network namespace do not appear in per-PID /proc/<pid>/net/tcp — they only appear in the global /proc/net/tcp. This caused parse_proc_net_tcp() to fail, preventing the proxy from identifying the calling binary. With no binary identity, no network policy matched, and OPA denied all CONNECT and forward proxy requests. Add /proc/net/tcp{,6} as a fallback when the per-PID table does not contain the peer port. The per-PID path is tried first (most accurate), preserving existing behavior on platforms where it works. Signed-off-by: David Peden <davidpeden3@gmail.com>
1b98ad1 to
2099cee
Compare
Author
|
I have read the DCO document and I hereby sign the DCO. |
Author
|
recheck |
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
Fixes #681 — L7 egress proxy denies all CONNECT requests on Docker Desktop + WSL2 (amd64).
parse_proc_net_tcp()now falls back to/proc/net/tcp{,6}(init-namespace global view) when/proc/<pid>/net/tcp{,6}does not contain the peer port. This handles Docker Desktop on WSL2 where iptables REDIRECT/DNAT connections from the sandbox network namespace are only visible in the global table.Related Issue
Changes
crates/openshell-sandbox/src/procfs.rs: Added/proc/net/tcp{,6}as fallback inparse_proc_net_tcp(). Per-PID path is tried first (preserves existing behavior on platforms where it works). Updated error message to mention both lookup paths.Testing
HTTP/1.1 200 Connection Establishedafter pod restart with patched binarycurl -v -p -x http://10.200.0.1:3128 http://<host>:<port>/succeeds on both platformsChecklist
mise run pre-commit