Your machines, your keys, nobody in the middle
Bridge connects your machines through NAT with no open port, no public IP, and no middle party you have to trust. The relays carry ciphertext, the keys stay on your devices, and every client checks the key it is handed before it says anything secret.
Problem: Reaching your own machines from anywhere sucks. Usually you either:
- Forward a port and put a login page on the internet, or
- Hand your traffic, and often your keys, to somebody else's cloud.
Bridge does neither. Your machines stay behind NAT with nothing listening on a public port, and they still find each other. The middle parties involved are trusted with nothing: they move ciphertext and never hold a key, so none of them can read your traffic or pretend to be you.
This post is how that works.
The short version
- The Bridge server runs its own Tailscale control plane, Headscale, on your hardware. A small sidecar next to it dials out to a relay and keeps that connection open. No port forwarding, no public IP, nothing to firewall.
- Your laptop or phone reaches the control plane through the relay at
<fingerprint>.bridgeproxy.net. What crosses the relay is Tailscale's control protocol, Noise-encrypted end to end between your device and your Headscale. - Your machines then talk to each other over WireGuard, directly whenever the network allows it. The relay is not in that path.
If this looks familiar, it is headfwd, a pattern I built for reaching self-hosted apps at home. Anyone can build the same pattern into their own apps, and because the relays cost next to nothing to run, they can use them for free. Bridge runs the same relay code, unmodified.
Why the control plane is the hard part
Tailscale solved NAT traversal for the machines themselves, and
How NAT traversal works is
still the best explanation of it anywhere. We did not rewrite any of it. Bridge's
tailscaled does the hole punching.
What Tailscale assumes is that the control server is reachable. Tailscale runs theirs on the internet, which means trusting them with who is on your network. Self-host Headscale instead and you are back to port forwarding, a public IP, DNS and a certificate, on the one server that holds your network's root of trust.
So the control plane dials out. The sidecar holds one persistent WebSocket open to the relay and multiplexes everything over it. Outbound is the whole point: Headscale needs no inbound port, no port forwarding and no public IP.
The relay finds your control plane by its fingerprint: the first 128 bits of the SHA-256 of Headscale's public identity key. It is public, not secret. It is the subdomain, and it is in every invite.
The relay is assumed hostile
Every decision here starts from one rule: the relay is untrusted. Not "probably fine". We run it, and the design still assumes whoever runs it is reading along and would like to get in.
That matters because of where TLS ends. The relay terminates TLS for
*.bridgeproxy.net. It can present a perfectly valid certificate and change
anything in the response. HTTPS protects you from the coffee shop Wi-Fi, not
from the relay.
What it cannot touch is the session inside. Tailscale's control protocol runs Noise between your device and Headscale, and only the holder of Headscale's private key can complete that handshake. That key lives on your host and never goes anywhere else.
Why a relay can't get in
A device needs the control plane's public key before it can start the Noise handshake, and it fetches that key through the relay. So that one exchange is built to be unforgeable, and everything after it is sealed.
- The anchor never touches a relay. Every invite carries your control plane's fingerprint: the first 128 bits of the SHA-256 of its public key. It reaches you out of band, in the invite a teammate hands you, never through a relay. A relay can carry your traffic. It cannot change what you were handed.
- Verify, then speak. Bridge's clients never let
tailscaledtalk to a relay directly. It talks to a small shim on127.0.0.1, which fetches the key, checks that it hashes to the fingerprint, and only then lets the invite's secret out. A substituted key fails the check before anything secret is sent. - A matching fake key is out of reach. To pass that check, a relay would need a key pair whose public key hashes to your 128-bit fingerprint. That is about 2^128 attempts.
- Only your control plane can finish the handshake. Everything after the check is Noise, end to end between your device and Headscale. Completing it takes Headscale's private key, which is generated on your host and never leaves it. HTTPS ends at the relay; this does not.
- Pinned on first contact. Once the key checks out, the device pins it. The shim answers every later request for the key from its pinned copy and never asks the relay again, and a served key that does not match the pin is refused even when it matches the fingerprint. Pins are a set, so you can still rotate the key on purpose.
- It fails closed. If no relay serves a key that checks out, the client exits instead of starting, and the Linux installer refuses to continue. There is no "continue anyway".
- The secret is small to begin with. The invite's preauth key works once, expires after 24 hours, and carries an identity the server chose. The device cannot pick its own.
- Nobody else can claim your address. To be reachable at its fingerprint subdomain, your sidecar proves to the relay that it holds the control plane's private key. Without that key, nothing can register in its place.
- Attacked before every release. The rule is defined once and shared. A test plays a deliberately malicious relay against it, and a failure blocks the release.
Peer traffic never touches the relay
Once a device is on the network, the relay is done. Your laptop reaches your build machine over WireGuard, peer to peer, and the WireGuard keys never leave the devices that use them.
When two machines cannot reach each other directly (two strict NATs, a hostile corporate network), WireGuard falls back to Tailscale's public DERP relays. They forward packets that are encrypted end to end, with keys they never see. They are still third-party infrastructure, and they still see which machines talk and how much. The app says so, rather than calling every connection direct.
A few more details, because people ask:
- Nothing changes on your machine's network.
tailscaledruns in userspace mode: no TUN device, no routes, no DNS changes. It runs fine next to a corporate Tailscale on the same laptop. - No log uploads. Every
tailscaledruns with--no-logs-no-support, and the iPhone app switches logging off in code. Stocktsnetships client logs tolog.tailscale.io. For a network you run yourself, that upload has no recipient who wants it and no user who agreed to it. - No login page. The server knows who you are from the network itself.
Each device carries a
tag:user-<name>, chosen by the server when it mints the invite, never by the device.
Notifications: the relay we could not avoid
Push notifications are where self-hosted apps usually give up and send plaintext through somebody's cloud.
Apple only accepts pushes to an app from the team that signed it, so a Bridge
server you run cannot talk to Apple by itself. The alternative is shipping our
Apple key to every server operator, and that one key can push to every Bridge
app on earth and never expires. So the key stays in one place, a small Worker
at push.bridgeproxy.net, and your server posts through it.
That makes the push relay a middle party holding a powerful key. Which is exactly why it is not allowed to read anything.
- The key is made on the phone. The first time the app needs one, it generates a P-256 key pair with CryptoKit and keeps the private half in the Keychain. Only the public half is ever sent to your server.
- Every push gets a fresh key. Your server generates a new ephemeral key pair per notification, does ECDH against the phone's public key, derives an AES-256-GCM key with HKDF, and encrypts. A phone key stolen later does not unlock old pushes, and two pushes to one phone share no key material the relay could correlate.
- The relay sees a device token, a topic and an opaque blob. So does Apple. The phone's notification extension decrypts the blob and shows the real text.
- The fallback says nothing. The visible text Apple would show on its own is a fixed "Bridge / Tap to open". A device that has no key yet is skipped, never sent plaintext.
Why P-256 and not something more fashionable: both ends have it built in. An iOS notification extension has a hard memory limit and is killed, not warned, when it goes over, so shipping a crypto library into it is a bad trade. And the key is readable after first unlock rather than only while unlocked, because otherwise notifications would decrypt on a phone in your hand and silently fail on one sitting on the table.
The honest consequence: someone who learns a device token can make that phone buzz. They cannot put words on its lock screen.
Who is in the middle, and what they get
| Middle party | Run by | Sees | Worst it can do |
|---|---|---|---|
Control relay, bridgeproxy.net | us | your fingerprint, when and from where you connect, Noise ciphertext | stop your devices reaching the control plane |
| DERP relays | Tailscale | which machines talk and how much, WireGuard ciphertext | stop the connections that could not go direct |
Push relay, push.bridgeproxy.net | us | device token, topic, push type, sealed blob | buzz a phone whose token it knows |
| Apple push service | Apple | device token, topic, sealed blob | the same |
None of them holds a key that decrypts anything, and none of them can add a device to your network.
What this does not protect you from
- Your own server. The Bridge server holds your model keys and every chat. It is the crown jewel, and everything above assumes you trust the machine you run it on.
- A compromised control plane. Headscale and the sidecar can admit new devices. Whoever controls them can join your network as any user. They still cannot decrypt traffic between devices already on it.
- Metadata. Every middle party in the table sees when you connect and from where. Only a DERP relay sees how much, and only on a connection that could not go direct: the control relay never carries your data, and a push is one small sealed blob. Encryption hides what you say, not that you said something.
- Denial of service. Any relay can drop your traffic. There are two relay
domains,
bridgeproxy.netandheadfwd.net, meant to run the same build so either can carry you while the other is down. - The relay's registration handshake. The protocol that proves a sidecar owns its fingerprint has not had an outside audit. It derives its HMAC key straight from the raw ECDH output rather than through HKDF, and it reuses Headscale's Noise key for a second protocol. Both are on the list. Neither is reachable from a client, so the fix is a server deploy, not a fleet update.
- A stolen laptop. A device on the network stays on it until you remove it. Same as any VPN.