VPN & Proxy documentation

Server and client configuration reference for the STH proxy network. Everything the operator or integrator needs to deploy, tune, and secure a node.

Architecture

The client speaks Iroh QUIC to the server. The server parses SOCKS5 (RFC 1928/1929) for TCP, and V2 CONNECT-UDP for fragmented UDP, then applies its port and IP policies before opening the outbound connection.

[Client] ── auth Iroh QUIC ──▶ [Server] ── SOCKS5 / V2 ──▶ [Destination]
                 │
                 └─ port policy check  →  DNS (DoT)  →  IP policy check

Server configuration

The server is a single native binary driven by environment variables. Defaults are safe for internet-facing deployments.

VariableDefaultDescription
SOCKS5_SIGNATURE_AUTHonRejects every plaintext SOCKS5 greeting. The only accepted authentication is the tunnel HMAC.
SOCKS5_TUNNEL_ENCRYPTIONonChaCha20-Poly1305 encryption of the transport payload.
SOCKS5_ALLOWED_PORTS22,80,443,8080,8443,853Default-deny egress allowlist. Comma-separated ports and lo-hi ranges.
SOCKS5_BLOCK_PRIVATE_IPSonBlocks loopback, RFC 1918, link-local, CGNAT, and IPv6 ULA destinations after DNS resolution.
RELAY_IDLE_SECS60Idle timeout for half-closed relays before the socket pair is torn down.

Client configuration

XClient ships as two binaries: client_tunnel for the local SOCKS5 endpoint, and vpn_client for TUN mode. Both read the same shared secrets.

VariableDefaultDescription
TUNNEL_ENCRYPTION_SECRET—Base64-encoded ProxySecret shared with the server. Required for the tunnel handshake.
TARGET_ENDPOINT_X1_SOCKS5_13—The Iroh EndpointId of the remote proxy server.
RELAY_URL_PUBLIC—Iroh relay URL used for NAT traversal and fallback.
CLIENT_SOCKET_ADDRESS_BIND—Physical interface IP. Required in TUN mode; the client refuses 0.0.0.0.
VPN_TUN_NAMEtun0TUN device name created in VPN mode.
VPN_ROUTE_TABLE1600000Route table used for tunnel routes. Override if it collides with another VPN.
VPN_MANAGE_DNSfalseReserved for a future server-side DNS handler. Leave disabled on systemd-resolved hosts.

Port policy

The server refuses any destination port not in SOCKS5_ALLOWED_PORTS with a SOCKS5 REP=0x02. Ports for SMTP, IMAP, POP3, RDP, SMB, LDAP, MySQL, PostgreSQL, Redis, MongoDB, Elasticsearch, and VNC are excluded by default.

Port 853 (DNS-over-TLS) is included in the default allowlist so that systemd-resolved on Linux clients can resolve names while the tunnel is active. Without it every DNS lookup on such a host fails.

SOCKS5_ALLOWED_PORTS=22,80,443,8080,8443,853
SOCKS5_ALLOWED_PORTS=1-1024,8080,8443
SOCKS5_ALLOWED_PORTS=*   # allow all
SOCKS5_ALLOWED_PORTS=    # deny all

IP policy

After DNS resolution the server refuses any destination that resolves into the following ranges. This is the primary mitigation against SSRF and cloud-metadata exfiltration.

  • 127.0.0.0/8, ::1 — Server-local services.
  • 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 — RFC 1918 private address space.
  • 169.254.0.0/16 — Link-local and APIPA, including cloud metadata endpoints.
  • 100.64.0.0/10 — Carrier-grade NAT.
  • fc00::/7, fe80::/10 — IPv6 ULA and link-local.

Security model

  • Strict mode: every connection must present the tunnel HMAC before any SOCKS5 bytes are parsed.
  • Transport is encrypted end-to-end with ChaCha20-Poly1305 keyed by the shared ProxySecret.
  • Client TUN mode installs a source-address exemption for the transport only; every other socket, including root, is captured.
  • Kill switch is fail-closed: any partial install rolls back and exits rather than leaving the host with a dead tunnel.

For the fully enumerated threat model, bypass limitations, and known gaps:see the troubleshooting guide