Skip to content

fix(sandbox): fall back to /proc/net/tcp for peer identity resolution…#684

Open
davidpeden3 wants to merge 1 commit intoNVIDIA:mainfrom
davidpeden3:fix/procfs-net-tcp-global-fallback
Open

fix(sandbox): fall back to /proc/net/tcp for peer identity resolution…#684
davidpeden3 wants to merge 1 commit intoNVIDIA:mainfrom
davidpeden3:fix/procfs-net-tcp-global-fallback

Conversation

@davidpeden3
Copy link
Copy Markdown

@davidpeden3 davidpeden3 commented Mar 30, 2026

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 in parse_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

  • Built patched binary on amd64 (Docker Desktop + WSL2, Windows 11)
  • Fresh sandbox provisioning: 10/10 steps pass
  • Idempotent re-run: 10/10 steps pass (previously failed at step 8 — CONNECT 403 Forbidden)
  • Verified CONNECT tunnel returns HTTP/1.1 200 Connection Established after pod restart with patched binary
  • Verified macOS arm64 (Docker Desktop + Apple Hypervisor) still works — no regression
  • Verified curl -v -p -x http://10.200.0.1:3128 http://<host>:<port>/ succeeds on both platforms

Checklist

  • I have read CONTRIBUTING.md
  • I have run mise run pre-commit
  • I have added/updated tests as appropriate
  • I have updated documentation as appropriate

@davidpeden3 davidpeden3 requested a review from a team as a code owner March 30, 2026 17:30
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 30, 2026

All contributors have signed the DCO ✍️ ✅
Posted by the DCO Assistant Lite bot.

…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>
@davidpeden3 davidpeden3 force-pushed the fix/procfs-net-tcp-global-fallback branch from 1b98ad1 to 2099cee Compare March 30, 2026 17:32
@davidpeden3
Copy link
Copy Markdown
Author

I have read the DCO document and I hereby sign the DCO.

@davidpeden3
Copy link
Copy Markdown
Author

recheck

@johntmyers johntmyers self-assigned this Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] L7 egress proxy denies all CONNECT requests on Docker Desktop + WSL2 (amd64)

2 participants