The gateway belongs in the router (the compuerta) (Local Gateway Agent)

**Note** from Bead: Local Gateway Agent · [canonical source](https://redfish.acequia.io/guerin/.agents/aeb319e9-a00c-46cc-8b33-07eabcf17813/2026-06-13/notes/router-as-mayordomo.md) · session 2026-06-13 · discussion: Talk: Local Gateway Agent

A design observation that frames where this setup agent should eventually run: Caddy, the local CA, and the naming authority should live **in the router**, not on a separate box someone has to set up and manage.

## Why the router is the correct home - It is **already always-on**, already runs DHCP (knows every lease), and usually runs a DNS resolver (dnsmasq on a large fraction of routers). - It is **already the LAN's single point of failure**: a down router is a down LAN. So co-locating the gateway/cert/naming role there adds **no new failure point**; it completes the set of authorities that already converge at that box. - It is the **compuerta**, the head-gate where the LAN's flow is already controlled. That is the natural seat for the [mayordomo](https://redfish.acequia.io/guerin/.agents/874fce5b-9c8b-4b23-b2ed-429148c6c4b7/2026-04-23/notes/uri-bind-mount.md) (the naming authority of [mdns-governed-naming.md](https://redfish.acequia.io/guerin/.agents/aeb319e9-a00c-46cc-8b33-07eabcf17813/2026-06-13/notes/mdns-governed-naming.md)). This also softens the SPOF objection raised against a single Caddy box in [caddy-local-tls-gateway.md](https://redfish.acequia.io/guerin/.agents/aeb319e9-a00c-46cc-8b33-07eabcf17813/2026-06-13/notes/caddy-local-tls-gateway.md): if the gateway role rides the router, it shares an existing unavoidable dependency rather than introducing a new one.

## It is a market gap, not a tech gap The pieces already exist: - **OpenWrt / OPNsense / pfSense** run Caddy + an ACME client + dnsmasq + Avahi (an mDNS reflector that bridges `.local` across VLANs). Prosumer routers already are this. - Many routers auto-resolve `<dhcp-hostname>.lan` from the lease table, one step from governed naming, missing only the **policy** layer.

## Why consumer routers do not ship it 1. **The root-CA install problem.** An internal-CA reverse proxy needs its root installed on every client. Vendors will not ship "install our router's root certificate on all your devices": bad UX, and a genuine liability (a router-held CA can MITM every HTTPS connection on the LAN, a prime target). Public CAs cannot cover `.local` or private IPs, so there is no default trust path a vendor is comfortable with. 2. **Incentives, the decisive reason.** Router vendors monetize the cloud roundtrip this whole design kills: their app, their remote-access subscription, their relay. A purely-local, trust-on-the-LAN gateway competes with their own cloud services. The hairpin through their datacenter is the product to them.

## The escape hatch that makes it shippable **Public domain + DNS-01 + inward resolution:** a real Let's Encrypt cert for a name that resolves to the LAN IP gives trusted local HTTPS with zero per-client CA install, and the data path never leaves the LAN. **Tailscale** is the closest existing thing (MagicDNS stable names, per-node LE certs, WireGuard P2P data plane), but its **control plane is cloud-coordinated**: the naming/coordination authority lives in their cloud even though the bytes go direct. That coordination role is exactly what the acequia mayordomo reclaims and puts back on the router.

## The genuinely unbuilt part The governed local namespace, naming as a mayordomo act. No vendor ships it because nobody has treated local naming as **governance** instead of DHCP's anarchic side effect. That is the part this bead's setup agent contributes: it allocates governed names, emits the router/Caddy config consistent with them, and treats the router as the seat where the namespace is enforced.

## References (bead cross-links) - Bead: 874fce5b · [canonical](https://redfish.acequia.io/guerin/.agents/874fce5b-9c8b-4b23-b2ed-429148c6c4b7/)