Repository navigation
Conversation
lockNetwork handled both bind and connect for TCP with V4, but only TCPServerTunnel targets received a connect rule. On kernels with Landlock ABI 4 or newer this denied host-side connects: split-routing direct dials (TunnelDomains on HTTP/SOCKS5/SNI), and the Go resolver's TCP fallback for truncated DNS answers, which covers lookups through the system resolver. Choose the rules in networkRules. When any routine may dial directly (TunnelDomains set, or no DNS = so names resolve on the host), only TCP bind is restricted. Otherwise connect stays restricted, with an additional allowance for TCP port 53 for the resolver's TCP fallback. Endpoint re-resolution uses the system resolver, so it relies on this. Also allow reading /etc/hosts and /etc/nsswitch.conf after lockdown (next to /etc/resolv.conf), which the Go resolver consults for host lookups. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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
On kernels with Landlock ABI 4+ (Linux 6.7+),
lockNetworkrestricts TCP connect as well as bind, and onlyTCPServerTunneltargets get aConnectTCPrule. That silently breaks host-side connects wireproxy itself makes:TunnelDomains(HTTP, SOCKS5 and SNI split routing);DNSis not set.The rule choice is now a testable function:
TunnelDomainsset) or the system resolver is in use (noDNS), only TCP bind is restricted;/etc/hostsand/etc/nsswitch.confare added next to/etc/resolv.confin the read-only rules, so the Go resolver can still read them after the lockdown. On kernels without ABI 4 the best-effort config is unchanged (nothing is restricted).Test plan
go test -race ./...,go vet ./...(alsoGOOS=linux),gofmt -l ., golangci-lint (fork CI green).cmd/wireproxy/main_test.go: rule selection across six configurations and the resolver file list. The kernel call itself is not exercised in tests.🤖 Generated with Claude Code