Security → Transport
Transport
SSH (via the russh library) is TunnelCrib's only encryption and authentication layer for Service traffic, in every connectivity tier.
Tier 0 — UDP + KCP
- A fixed magic-byte STUN-style probe (not RFC 5389) discovers each peer's externally observed
ip:port. No transaction IDs or authentication in the probe itself — it exists only for address discovery.
- The same local socket used for STUN discovery is reused for the UDP hole punch, avoiding a different NAT-mapped port from rebinding.
- KCP (reliable UDP) carries the SSH byte stream unmodified once the hole punch succeeds; the SSH handshake, host-key pinning, and public-key authentication run exactly as they would over TCP.
Tier 1 — TCP simultaneous-open punch
- Both peers dial each other from the same locally bound port they are listening on (
SO_REUSEPORT), racing an outbound connect against inbound accepts.
- Because simultaneous-open can yield more than one candidate stream, each is verified with a mutual handshake-echo before being handed to SSH, so a stray or phantom stream cannot be used.
Tier 2 — Relay
- The Central Server (or a delegated TunnelCrib Relay) spawns a per-session
tunnelcrib-bridge process with two fresh ED25519 keypairs — one for the Client, one for the Agent — used only for that session.
- The Bridge accepts exactly two SSH connections, authenticated by those per-session keys, and forwards
direct-tcpip (Client-side) to forwarded-tcpip (Agent-side) channels only. No shell, exec, or PTY access is possible through the Bridge.
- The Bridge exits automatically on a configurable timeout (default 30 minutes) or when the session ends. See what the Relay can see for what this means for payload visibility.
Session identity pinning
Regardless of tier, every Direct Tunnel's SSH layer pins a per-session Client public key and, after first use, the Agent's host key. This is independent of the Central Server's registration/nonce handshake, so a Direct Tunnel session cannot be impersonated even if transport-level address exchange were spoofed.