SSH Guru Blog.
← SSH Guru Blog
SSH Bridges
·8 min read

ESP32-S3 Bridges: How We Reach SSH Behind CGNAT Without Port Forwarding

esp32-s3cgnatremote accessssh bridgehardware
Laptop on desk with IDE open, showing coding environment, next to plush toy and greenery.
Photo: Daniil Komov on Pexels

The hardest part of remote SSH is not the protocol. It is the network between you and the server.

If your Raspberry Pi sits behind a home router, you forward port 22. If you are on Starlink, 5G home internet, or any carrier-grade NAT, you cannot. The ISP owns the public IP. You cannot open a port you do not control.

VPNs like Tailscale or WireGuard solve this for many people. But they require installing software on the client device. That fails on a locked-down work laptop, a Chromebook, or an iPad where you cannot install a TUN driver or run a background daemon.

We took a different approach: a $15 microcontroller board that plugs into the same LAN as your server, dials out to our relay over TLS, and ferries SSH traffic from your browser. No port forwarding. No VPN client. No inbound listeners on your network.

The Hardware

We use the ESP32-S3. It has native USB, enough RAM for TLS and WebSocket framing, and it costs about $15 for a bare dev board (ESP32-S3-DevKitC-1 or similar). No hat, no custom PCB, no soldering unless you want to.

The board does one thing: it opens a persistent WebSocket to wss://relay.sshguru.com. That connection stays up. When you open a browser session to a server behind that bridge, we route the SSH frames over that existing socket.

Because the connection is outbound-only, it traverses NAT, CGNAT, and most corporate firewalls without configuration. The board does not listen on any port. It does not expose a management interface on the LAN. It does not run a web server.

Flashing From the Browser

You do not need the ESP-IDF toolchain, esptool.py, or a terminal. We built a Web Serial flasher that runs in Chrome or Edge.

  1. Plug the board into your laptop with a data-capable USB-C cable.
  2. Open the bridge setup page in the dashboard.
  3. Click Flash. The browser downloads the signed firmware binary and writes it over USB.
  4. The board reboots, connects to Wi-Fi (credentials you just typed in the browser), and registers itself with your account.

The firmware image is signed. The board verifies the signature on boot. If you flash a bad image, it falls back to the previous slot. You cannot brick it from the browser.

The Allow-List Is Burned In

This is the part that matters for security.

When you create a bridge in the dashboard, you define an allow-list: target host (IP or hostname), target port (usually 22), and a label. That list is compiled into the firmware image before it is flashed. The board stores it in flash memory.

You cannot add a target later from the dashboard. You cannot change the allow-list over the air. The only way to modify it is to re-flash the board over USB with a new image.

This means a compromised dashboard session or a stolen API token cannot pivot the bridge to a new target. An attacker who reaches the relay cannot tell the bridge to connect to 192.168.1.1:22 unless that rule was already burned in.

The bridge also enforces the allow-list in firmware. If the relay asks for a connection to a target not in the list, the bridge drops it. The relay cannot override this.

What the Relay Sees

The relay is a dumb pipe. It terminates the WebSocket from the bridge and the WebSocket from your browser. It forwards frames. It cannot decrypt SSH traffic because the SSH handshake happens end-to-end between the browser client (WebAssembly) and the target sshd.

The relay sees:

  • Bridge ID and online status.
  • Connection metadata: which allow-list entry was used, bytes transferred, duration.
  • TLS handshake data (SNI, certificate).

It does not see SSH keys, passwords, session content, or command output.

Latency and Throughput

The ESP32-S3 runs at 240 MHz with 512 KB SRAM (plus PSRAM on most dev boards). It handles TLS 1.3, WebSocket framing, and TCP flow control in firmware.

Typical round-trip latency added by the bridge is 10–30 ms on a good Wi-Fi link. Throughput tops out around 3–5 Mbps, limited by the Wi-Fi radio and the single-threaded event loop. That is enough for interactive shell work, top, journalctl -f, vim, and small scp transfers.

It is not a file-transfer appliance. If you need to pull a 20 GB backup over CGNAT, use a different tool. The bridge is for administration.

Power and Reliability

The board draws 80–120 mA at 5 V idle, spiking to 250 mA during heavy Wi-Fi traffic. A standard USB port or a 5 V/1 A phone charger runs it indefinitely.

We recommend a USB cable with power-only wires cut (or a USB condom) if you plug into an untrusted host, but most people plug it into a Pi USB port or a wall wart.

If Wi-Fi drops, the bridge reconnects automatically. If the relay restarts, the bridge backs off and redials. The firmware includes a watchdog; a hard fault reboots the board in under a second.

We have bridges running for months on UPS-backed Pi USB ports. They survive power blips, router reboots, and ISP DHCP renewals.

Compared to a Reverse SSH Tunnel

A reverse tunnel (ssh -R) from the Pi to a VPS works, but it has sharp edges:

  • You need a VPS with a static IP.
  • You need autossh or a systemd unit to keep it alive.
  • The tunnel binds a port on the VPS. Anyone who reaches that port hits your sshd.
  • You must harden the VPS, rotate keys, audit logs.
  • From a Chromebook or iPad, you still need an SSH client that can reach the VPS port.

The bridge moves the complexity to hardware you own. The relay is our infrastructure; you do not manage it. The browser client works on any device with Chrome, Edge, Firefox, or Safari. No keys uploaded to the cloud. No agent forwarding.

Compared to Tailscale / WireGuard

Overlay networks are excellent when you control the client. They give you full L3 connectivity, not just SSH.

But they require:

  • A userspace daemon or kernel module on the client.
  • Admin rights to install.
  • A coordination server (DERO, headscale, or Tailscale's control plane).

On a managed corporate laptop, you often get none of those. The browser client needs zero install. It works in Incognito mode. It works on a borrowed iPad.

Threat Model

We assume:

  • The relay is honest but curious.
  • The LAN is hostile (IoT devices, guest Wi-Fi, compromised containers).
  • The bridge board is physically secure (inside your rack, not in a public hallway).

Under those assumptions:

  • SSH credentials never leave the browser. The vault is encrypted with your passphrase (Argon2id + AES-256-GCM).
  • Host keys are pinned on first connect (TOFU) and verified on every subsequent connect.
  • The bridge cannot be retargeted without physical USB access.
  • The relay cannot decrypt SSH traffic.

What we do not claim:

  • The bridge is a VPN. It forwards TCP to a single allow-listed port per rule. It does not pass UDP, ICMP, or arbitrary protocols.
  • The bridge hides the fact that you are connecting to a server. Traffic analysis on the WAN sees a persistent TLS connection to our relay.
  • The board is tamper-proof. With physical access and a USB cable, you can re-flash it. Keep it in a locked rack.

Setting One Up

You need:

  • An ESP32-S3 dev board (DevKitC-1, DevKitM-1, or any board with the ESP32-S3-WROOM-1 module and native USB).
  • A data-capable USB-C cable.
  • A 2.4 GHz Wi-Fi network (the ESP32-S3 does not do 5 GHz).
  • An SSH Guru account (Free plan includes one bridge).

Steps:

  1. Log in to the dashboard. Go to Bridges → New Bridge.
  2. Name it. Add allow-list entries (e.g., 192.168.1.50:22 labeled "Pi").
  3. Enter Wi-Fi SSID and password.
  4. Click Generate & Flash.
  5. Plug the board into your laptop. Allow the browser USB prompt.
  6. Wait for "Flashing complete."
  7. Move the board to the target LAN. Power it.
  8. In the dashboard, the bridge shows Online. Click Connect next to the allow-list entry.

The browser opens a terminal. You are in.

Jump Hosts Through the Bridge

On the Pro plan, you can chain: Browser → Relay → Bridge → Bastion → Target.

Define the bastion as an allow-list entry on the bridge. In the browser session, enable Jump host and point it at the bastion. The browser client opens a direct SSH channel through the bridge to the bastion, then a forwarded connection from the bastion to the final target.

This lets you reach a database server in a private subnet that only the bastion can touch, all from the browser, with the bridge providing the initial hole through CGNAT.

Runbooks and Watches

Bridges work with Watches (scheduled read-only checks) and Runbooks (approved command sequences). The watcher binary runs on the target server, not the bridge. The bridge only carries the SSH connection from the relay to the target.

This means you can monitor disk space, failed logins, Docker health, and certificate expiry on a Pi behind Starlink, and get a Telegram alert when something breaks, without ever opening a port.

Limits

  • One bridge per Free account, five on Pro, 25 on Team.
  • Each bridge supports up to 20 allow-list entries.
  • Wi-Fi only. No Ethernet PHY on the standard dev board (add a W5500 or ESP32-P4 if you need wired).
  • 2.4 GHz only. Plan your AP placement.
  • Not for bulk transfer. SCP a 100 MB log file: fine. Sync a 50 GB media library: no.
  • The relay is a single point of availability. We run it in multiple regions; if one goes down, bridges reconnect to the next.

Why Not a Raspberry Pi Zero W?

A Pi Zero 2 W runs Linux. You can run autossh, Tailscale, or a custom Go tunnel. It costs $15–$20 plus SD card plus power.

We chose the ESP32-S3 because:

  • Boot to firmware in < 1 s. No OS to patch, no apt update, no kernel CVEs.
  • Attack surface is tiny: Wi-Fi stack, TLS, WebSocket, TCP. No shell, no package manager, no users.
  • Allow-list immutability is enforced by flash layout, not file permissions.
  • Flashing from the browser via Web Serial works on ChromeOS, Windows, macOS, Linux without drivers.
  • Deterministic behavior. No OOM killer, no log rotation, no cron jobs.

If you already have a Pi Zero running a tunnel, keep it. The bridge is for the cases where you want a dedicated appliance that you configure once and forget.

What's Next

We are testing Ethernet-capable boards (ESP32-P4, W5500 SPI modules) for racks without Wi-Fi. We are also working on a "bridge group" feature so one dashboard button flashes multiple boards with the same allow-list for multi-site deployments.

If you run a home lab behind CGNAT, try a bridge. The hardware cost is a coffee and a pastry. The Free plan covers the relay.

Get started with a bridge →

Comments

No comments yet. Be the first.

Leave a comment

Comments appear once the author approves them.