Repository navigation
feat(traffic): opt-in SOCKS5 UDP ASSOCIATE and raw UDP recording (P4.1c) - #433
Merged
Merged
Conversation
…r-datagram policy
P4.1c widened addrTarget to udp, which let PinnedDialer accept a non-TCP network and broke TestPinnedDialScopeUnreadableFailsClosed/network. Split addrTarget (TCP) from addrTargetUDP (UDP relay) so the TCP gate stays fail-closed while the UDP resolver keeps its parser.
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.1c: opt-in SOCKS5 UDP ASSOCIATE and raw UDP recording.
RFC 1928 UDP ASSOCIATE in the SOCKS5 listener, off by default (
ARTEX_SOCKS5_UDP_ENABLED), only when the SOCKS5 listener itself is enabled and the traffic recorder is active. With the UDP flag off, CONNECT-only SOCKS5 still refuses ASSOCIATE with0x07and opens no UDP socket.IPv4 and domain destinations (resolved to IPv4); IPv6 is rejected with
0x08.FRAG != 0is dropped, no reassembly. The client UDP source is pinned to the request or to the first datagram. Each datagram is checked before forwarding against the same target gate (ResolveUDP4/PinnedUDP4Resolver, domain, IP and CIDR rules before and after fresh DNS) and the same egress governor (egress.Do); a denied or unresolved destination drops that datagram and the association stays usable. Upstream replies are accepted only from destinations the association sent an allowed datagram to.Bounds: 1000 datagrams, 4 MiB per association, 2m idle, shared MaxConcurrent, and close on the TCP control connection or server stop.
Each datagram is recorded in SQLite
raw_udp_datagrams(association, protocol udp, host, port, direction, timestamp, size, preview, atomic blob spill withblob_refs). No HTTP exchange row is written and no PostgreSQL migration is needed. The docs warn that a non-loopback SOCKS5 bind is an unauthenticated proxy.Tests:
./traffic -race(parsing and RFC 1928, FRAG drop, flags off and0x07/0x08, IPv4 and domain relay, close on control close, no exchange row, per-datagram gate and governor, atomic spill and blob refs, datagram and byte caps, idle) and the server test on a throwaway Postgres (anexact_iprule drops 127.0.0.2 while 127.0.0.1 passes and is recorded).