socat
$ socat Community High Risksocat is a versatile multi-protocol relay transferring bidirectional byte streams between two independent address specifications (socat TCP-LISTEN:8080,fork TCP:host:80). Indispensable for bridging UNIX domain sockets (/var/run/docker.sock), OpenSSL/TLS endpoints, and virtual PTYs, though EXEC:/SYSTEM: addresses and wildcard binds require strict guardrails.
brew install socat Bridges local UNIX sockets, TCP/TLS sockets, and stdio streams directly (socat - UNIX-CONNECT:...); MCP servers cannot relay arbitrary socket types.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Deterministic non-interactive CLI with -T timeouts and clean exit codes, though the comma-separated address DSL is dense and has no JSON output.
- Non-interactive stdio/socket bridging with
-Tidle timeouts - Dense address DSL and plain-text diagnostics
Supports EXEC:/SYSTEM: shell execution over sockets and binds 0.0.0.0 by default on TCP-LISTEN unless bind=127.0.0.1 is explicitly added.
EXEC:/SYSTEM:address types can expose shells over sockets- Requires explicit
bind=127.0.0.1on listeners
Standard package on macOS (brew install socat) and nearly every Linux distribution.
- Available via Homebrew and Linux package managers
Unmatched Swiss-army relay for UNIX sockets, TLS wrapping (OPENSSL:), SOCKS4A, PTYs, and pipes.
- Bridges UNIX sockets, TLS, TCP, UDP, PTY, and stdio
Long-maintained dest-unreach project (socat 1.8.x) under GPL-2.0.
- Active
1.8.xreleases at dest-unreach.org/socat
Exhaustive socat(1) manual page and built-in socat -h / socat -hh reference.
- Official HTML manual and
socat -hhoption listing
Security, Auth & Guardrails
No central config store; optional TLS keys, CA certs, or proxy credentials are passed inline as address parameters.
Free, GPL-2.0 open-source C utility.
# socat Agent Rules - Always include `bind=127.0.0.1` on `TCP-LISTEN` and `-T <seconds>` for one-shot stdio calls so processes do not hang or expose ports publicly. - Never attach `EXEC:` or `SYSTEM:` to network-listening `socat` addresses.
Agent-Ready Command Recipes
Safe Read-Only Queries
socat -V
Prints version, OpenSSL/readline build support, and exits without opening sockets.
printf 'PING\r\n' | socat -T 2 - UNIX-CONNECT:/tmp/app.sock
Sends a command to /tmp/app.sock from stdin and closes after a 2-second inactivity timeout (-T 2).
Controlled Writes & Previews
socat TCP-LISTEN:8080,bind=127.0.0.1,reuseaddr,fork UNIX-CONNECT:/tmp/app.sock
Bridges local 127.0.0.1:8080 to /tmp/app.sock cleanly without exposing 0.0.0.0.
Strengths for Agents
- + Bridges UNIX domain sockets, OpenSSL TLS, TCP, UDP, and stdio cleanly in one command.
- +
-T <secs>timeout prevents indefinite hangs on one-shot stdin/stdout socket queries.
Caveats & Pitfalls
- ! Combining
TCP-LISTENwithEXEC:/SYSTEM:or omittingbind=127.0.0.1creates severe exposure risks. - ! Address-option grammar is terse and error messages require
-d -dfor debugging.