Repository navigation
feat(traffic): opt-in Linux transparent TCP inbound (P4.1b) - #432
Merged
Merged
Conversation
…ables REDIRECT tests
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.
P4.1b: opt-in Linux IPv4 transparent TCP inbound.
A transparent listener that accepts connections redirected by
iptablesornftablesREDIRECTand recovers the original IPv4 destination withgetsockopt(SO_ORIGINAL_DST). Off by default (ARTEX_TRANSPARENT_TCP_ENABLED,ARTEX_TRANSPARENT_TCP_ADDR, loopback127.0.0.1:1081), Linux only, IPv4 only. It never installs, changes or removes a firewall rule itself: the operator owns the REDIRECT rules and the cleanup, with the exact iptables and nftables examples indocs/traffic-transparent.md.It reuses the P4.1a path exactly:
egress.Doplusinterceptor.DialSOCKS5before the dial, the same half-close relay and bounds, and oneraw_tcp_streamsrow with the atomic blob spill. A direct connection to the listener and a redirect that points back at it are refused before any dial. IPv6, short buffers, non-AF_INET families, port 0 and 0.0.0.0 are rejected.The listener only starts when the traffic recorder is enabled. It only knows the destination IP, so hostname-based block or allow rules cannot match; only IP and CIDR rules apply, and the docs say so.
Tests: unit tests for the original-destination parser and the self-redirect check, policy and store tests, a real iptables REDIRECT plus kernel
SO_ORIGINAL_DSTtest insideunshare -rn, and the server wiring test on a throwaway Postgres.