Repository navigation
Remote Access
Research and decision trail for how AutoButler devices get reached from outside the home
network. Spans issues #862, #863, #864, #865, #866, #931, #968 (epic #498, design doc
docs/design/zero-config-remote-access.md).
AutoButler devices sit behind whatever router the user already has — we don't control it, and we can't assume port forwarding, a public IP, or CGNAT-free service. That single fact rules out most of the obvious answers and is why this took seven tickets to settle.
Before comparing tech, the UX bar was defined explicitly:
- Zero-touch setup for the common case. No port forwarding, no router admin, no third-party account, no terminal. One toggle in Settings ("Enable remote access") is the acceptable first-time action.
- One-time device pairing is fine for a new device (phone, laptop) — a QR code or short code, same pattern as 1Password or Tailscale.
- Transparent local/remote switching — fast path on the home WiFi, tunnel automatically when away, user never picks a mode.
- Graceful offline state — a clear "your AutoButler isn't reachable" message, not a spinner or a cryptic error.
- Per-device authorization and revocation — losing a phone means revoking it from another trusted device, immediately.
- No mandatory third-party account for basic functionality.
Everything below was judged against this list.
First pass concluded Firewalla's remote access was just a WireGuard/OpenVPN server on the device — which needs a public IP and port forwarding, and doesn't work behind CGNAT. That would have made Firewalla a non-model for us.
That first pass was wrong. A follow-up dig into Firewalla's actual open-source code (firewalla/firewalla) found a second, primary mechanism it had missed:
-
Cloud relay via
encipher.io— the device holds a persistent outbound Socket.IO WebSocket to Firewalla's cloud. Outbound-only means it works through CGNAT and any NAT/firewall with zero configuration. End-to-end encrypted with device-generated RSA keys (the relay only ever sees encrypted blobs). This is Layer 1 — what makes the box "just set itself up." -
FRP tunnel relay — a secondary mechanism (
frpc/frpd) used to expose specific services (their API port, VPN port) through NAT without port forwarding. - Direct VPN (WireGuard/OpenVPN) — the optional full-tunnel mode, which is the one that does require port forwarding. This is what the first research pass found and mistook for the whole picture.
Takeaway: Firewalla's "it just worked" reputation comes from the cloud relay, not the VPN server. The VPN server is the power-user path layered on top.
| Approach | CGNAT? | Zero-config? | 3rd-party account? | Infra cost | Self-hostable? |
|---|---|---|---|---|---|
| Cloud relay (Firewalla model) | ✅ | ✅ | No | Low (one relay) | ✅ |
| Tailscale tsnet + Headscale | ✅ (DERP fallback) | ❌ needs a coordination server | No (self-hosted Headscale) | Medium (VPS) | ✅ |
| Plain WireGuard | ❌ | ❌ | No | None | ✅ |
| ZeroTier | ✅ | Partial | ZeroTier account (or self-hosted controller) | Free tier | Partial |
| Cloudflare Tunnel | ✅ | Partial | CF account | Free tier | ❌ — ruled out on privacy principle |
Plain WireGuard and Cloudflare Tunnel were both ruled out early: the first doesn't solve CGNAT, the second means all traffic transits Cloudflare's edge, which conflicts with the no-data-leaves-the-house premise.
Two different final recommendations came out of #866, and they disagreed on sequencing:
Recommendation A — Tailscale tsnet + self-hosted Headscale, ship first.
Embed tsnet (Tailscale as a Go library, no separate daemon) directly in the AutoButler binary.
Run our own Headscale coordination server so users never see a Tailscale account or an auth key.
DERP relay (Tailscale's, initially) handles CGNAT transparently.
Recommendation B — lightweight custom relay first, Tailscale later. Build a small WebSocket relay (control-plane only), mirroring Firewalla's cloud-relay layer more directly, and treat Tailscale/tsnet as a Phase 2 data-plane upgrade.
Confirmed: A is what shipped, and it's the only one that did. Checked directly against the
codebase (2026-08-25) — go.mod depends on tailscale.com v1.102.2 directly (not indirect), and
pkg/util/remoteutil/remoteutil.go wraps tsnet.Server exactly per Recommendation A. There's no
custom relay anywhere in the tree. B was superseded, not left open — this page previously said the
tension was unreconciled; it wasn't, the commit history just didn't say so explicitly on the
issue thread.
pkg/util/remoteutil/remoteutil.go is real and in production shape, not a prototype:
-
Start(authKey)boots atsnet.ServerwithHostname: "quark", persists its state under/var/lib/quark/tsnet(falls back to~/.config/quark/tsnetoff Linux), and is controlled by theQUARK_HEADSCALE_URLenv var — default is alreadyhttps://network.quark.org, already HTTPS. (The env var and default host were renamed fromAUTOBUTLER_HEADSCALE_URL/network.autobutler.orgat some point —autobutler.org's own Terms of Service still referencesnetwork.autobutler.org; worth a look at whether that's stale copy or a second, still -live domain.) The code itself warns loudly at startup if it's ever pointed at a plain-http://control URL. -
Stop()/IsRunning()/RemoteURL()are implemented and already wired to a real settings API:GET/POST/DELETE /settings/remote-access(internal/server/api/v0/settings/remote_access.go). POST takes a Tailscale auth key, starts the tsnet node, starts an HTTP reverse proxy (StartProxy) on the tailnet listener forwarding to the local server, and persists the enabled state viasettingsutil.SetRemoteAccess. DELETE tears it down. This is a full, working device-side on/off switch today — see quark#1582, which is about a client-app quick-toggle UI for this, not new backend plumbing. -
RemoteURL()returnshttp://<tailscale-ip>:80(the tsnet-internal listener), proxying to whatever the local server is actually serving —StartProxytakes alocalTLSflag (serverutil.ServingTLS()) and skips cert verification on that hop with a code comment explaining why: it's a loopback connection to the same process presenting its own self-signed cert, there's no third party to authenticate. SeeSpikes/Encrypt-Data-In-Motion.md— this confirms Option B (Gin-native TLS) from that spike was the one actually built.
Three connectivity scenarios need to keep working (per #931):
-
AutoButler's own Headscale network (the default, zero-config path) — implemented, and the
TLS gap on the control server that #931 flagged as blocking appears closed (
network.quark.orgis the HTTPS default now). -
User's existing Tailscale account ("bring your own tailnet") — code-level, this should work
by setting
QUARK_HEADSCALE_URL=https://controlplane.tailscale.com, but end-to-end validation (conflict with a system Tailscale daemon already running on the same box, correct surfacing of the resulting100.x.x.x/*.ts.netaddress in the UI) wasn't confirmed as tested. - Direct socket / NAT hole-punch, no VPN at all — not implemented, spike-only. Recommendation was to assess real user demand before building this.
For genuine peer-to-peer performance (vs. routing through a relay), the plan is to compile tsnet
into a native .aar (Android) / .xcframework (iOS) via gomobile bind and call it from Flutter
over a method channel.
-
Android — needs the
VpnServicepermission; one-time system dialog, then fully transparent. Lower complexity, do first. - iOS — needs Apple's Network Extension entitlement (Tailscale itself ships this way, so it's known-possible, but expect App Store review scrutiny).
- Desktop — no special entitlements, simplest of the three.
Not started as of the last tracked update. Open questions: gomobile bind feasibility against
the current tsnet version, and IPA/APK size impact of bundling it.
openGym — a self-hosted workout tracker — takes the opposite approach worth noting as a contrast, not a recommendation:
- Ships no remote-access mechanism at all. DNS, TLS, and tunneling are entirely bring-your-own: the README points self-hosters at Cloudflare Tunnel, Caddy (automatic Let's Encrypt), or Traefik/nginx/NPM — pick one, point your own domain at it.
-
The reason it needs a real domain isn't a networking design choice — it's WebAuthn.
Passkeys are bound to an exact hostname (
RP_ID) and only work over HTTPS (with alocalhostexception), so a plain LAN IP simply can't complete a passkey prompt from another device. Remote reachability is a side effect of the auth method, not a feature they built. AutoButler's WebAuthn spikes (Spikes/Post-Quantum-Cryptography.md) will hit the sameRP_ID/origin binding once passkey login lands — worth keeping in mind for scenario 2 above, since a Headscale-assigned*.ts.nethostname changing would invalidate existing passkeys the same way changingRP_IDdoes for openGym. - No mesh VPN, no coordination server, no relay — it explicitly suggests layering a VPN or an auth proxy (Authelia, Cloudflare Access) in front of whichever reverse proxy you picked, as an optional extra, not something it provides.
- Falls back to a LAN-only "guest mode" with no passkey and no sync (data stays in that one browser) for people who don't want remote access at all — conceptually adjacent to quark#1581 (local-only file explorer mode, no device required).
The takeaway: openGym pushes 100% of the DNS/TLS/tunneling complexity onto the self-hoster, which is a reasonable choice for a project with no dedicated infra budget, but is exactly what the UX requirements in #865 ruled out for AutoButler. It's a useful data point for "what happens if we did nothing," not a design to imitate.
- Validate scenario 2 (bring-your-own Tailscale) end-to-end.
- Decide whether scenario 3 (VPN-free hole-punch) is worth building at all.
-
gomobile bindmobile embedding (#968) — not started. -
quark#1582 — a fast, prominent on/off toggle for remote access in the mobile/desktop
apps. The backend API already supports this (
/settings/remote-access, see above) — the gap is a client-side UI that's reachable in a tap or two, for when a VPN-hostile network (airplane WiFi, some corporate/school networks) makes the tunnel actively harmful rather than just slow. Note this existing API is a whole-device switch (turns tsnet off on the butler itself); once #968 lands a client-embedded tunnel, there may also be a need for a purely local, per-device "don't route through the tunnel right now" toggle that doesn't touch the butler's own tsnet state at all — worth deciding whether #1582 means one, the other, or both. - Confirm whether
network.autobutler.org(referenced in autobutler.org's Terms of Service) andnetwork.quark.org(the code's actual default) are the same infrastructure under two names, or one of them is stale.