Skip to content

feat(traffic): opt-in Linux transparent TCP inbound (P4.1b) - #432

Merged
BaaRai merged 4 commits into
mainfrom
feat/proxy-transparent-tcp
Nov 20, 2026
Merged

BaaRai merged 4 commits into
mainfrom
feat/proxy-transparent-tcp

Conversation

@BaaRai

@BaaRai BaaRai commented Nov 20, 2026

Copy link
Copy Markdown
Owner

P4.1b: opt-in Linux IPv4 transparent TCP inbound.

A transparent listener that accepts connections redirected by iptables or nftables REDIRECT and recovers the original IPv4 destination with getsockopt(SO_ORIGINAL_DST). Off by default (ARTEX_TRANSPARENT_TCP_ENABLED, ARTEX_TRANSPARENT_TCP_ADDR, loopback 127.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 in docs/traffic-transparent.md.

It reuses the P4.1a path exactly: egress.Do plus interceptor.DialSOCKS5 before the dial, the same half-close relay and bounds, and one raw_tcp_streams row 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_DST test inside unshare -rn, and the server wiring test on a throwaway Postgres.

@BaaRai
BaaRai merged commit 82d8fa2 into main Nov 20, 2026
6 checks passed
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.

1 participant