Repository navigation
feat(traffic): opt-in SOCKS5 CONNECT listener and raw TCP recording (P4.1a) - #431
Merged
Merged
Conversation
…t gate and egress governor
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.1a: opt-in SOCKS5 CONNECT listener and raw TCP recording.
RFC 1928 SOCKS5 inbound listener in the traffic recorder, off by default (
ARTEX_SOCKS5_ENABLED,ARTEX_SOCKS5_ADDR, loopback127.0.0.1:1080). CONNECT only; BIND and UDP ASSOCIATE are refused with0x07(UDP is P4.1c). IPv4, domain and IPv6 addressing; no-auth for loopback peers; RFC 1929 username/password accepted so the pace marker can ride in the username.Before dialing, each connection goes through the same egress governor (
egress.Do) and the same target gate (interceptor.DialSOCKS5, reusingdialTarget,blockRuleandtargetCheck). Bytes are relayed half-close aware with bounded capture (MaxConcurrent 64, 4 MiB per direction, 8 KiB preview, 2m idle, 10s handshake, 30s dial, 30s pace).Each completed stream is recorded in the SQLite traffic index as one
raw_tcp_streamsrow (protocol tcp, host, port, timestamps, c2s/s2c bytes, truncated flag, preview and atomic blob spill withblob_refs). No HTTPexchangesrow is written and no PostgreSQL migration is needed.Flag off: no listener, the HTTP MITM proxy is byte-identical, and agents keep HTTP_PROXY, HTTPS_PROXY and ALL_PROXY. The listener only starts when the traffic recorder is enabled. A non-loopback bind accepts any username/password, so it is an unauthenticated proxy; the docs say so and the default is loopback.
Tests:
go test -race ./traffic(handshake, auth and half-close, no exchange row, target gate and governor refusal before dial, caps, truncation and blob spill, IPv4/IPv6/DNS, concurrency and idle) and the server test on a throwaway Postgres.