founding: automatic port opening (UPnP/IGD) — and the self-hosted walkthrough that does not exist #331

Open
opened 2026-08-07 17:32:55 +00:00 by ben · 6 comments
Owner

ADR 0022 recommends renting a VPS because "the operator never touches router config, never wipes a machine, and never runs an install command." Router config is the real friction on the self-hosted path, and it is addressable.

A home gateway must expose five port groups, not two:

Port Who
80, 443/tcp Caddy
53 tcp+udp acme-dns, authoritative for the delegated zone (internal/clan/acmedns.go:108-109)
51820/udp WireGuard, peers dial in (docs/architecture/03-fleet-topology.md:45)
3478/udp + range coturn relay (:46)
25/465/587/993 mail, once provisioned (ADR 0115)

A gateway that asks the router directly — UPnP/IGD, NAT-PMP, PCP — could open all five, and the operator never opens a router UI. That is a better answer to ADR 0022's stated problem than any external tunnel, and it costs no sovereignty: TLS still terminates on the community's own Caddy and no third party enters the traffic path.

Why this carries needs-design

There is no self-hosted walkthrough to amend. RunPreCheck (internal/founding/access.go:297-316) is the entire self-hosted path — one CGNAT verdict, then straight to S5. The only port-forwarding guidance anywhere in the tree is a failure string (internal/reachability/prober.go:57). S4b in the wireframes shows the pre-check and its two outcomes, and nothing after it.

So this ticket designs the walkthrough rather than modifying one: grill the self-hosted access path, then wireframe its states — including the partials that will dominate in practice ("router refused", "three of five ports opened", "UPnP is disabled on your router").

Library options (all permissive; ADR 0039 cares about licensing)

Library Protocols Licence
tailscale.com/net/portmapper UPnP + NAT-PMP + PCP BSD-3-Clause
huin/goupnp UPnP / IGD v1+v2 BSD-2-Clause
jackpal/go-nat-pmp NAT-PMP Apache-2.0

Rulings this needs

  • Do we ask operators to enable UPnP? It is off by default on many routers and often deliberately disabled, because any device on the LAN can punch holes with it. Recommending it is a household-wide security posture change made on the community's behalf — a stance a sovereignty product should take deliberately, with honest copy, not silently.
  • What happens when IGD is absent or refuses? The manual path must remain a first-class fallback, not a error state.

Out of scope

Does nothing for CGNAT (ADR 0026's gate stands) and cannot set PTR, so mail stays out on residential either way.

Background: docs/research/2026-08-07-home-gateway-reachability-scope.md §5.

Ruled: DEFERRED (Ben, 2026-08-12 backlog walk)

Not rejected — the self-hosted walkthrough (and any UPnP/IGD ask) waits until the home path has a real customer; everything current rides the rented-VPS path (ADR 0022's recommendation).

Revisit when the FIRST of these fires:

  1. A real community attempts a self-hosted founding in earnest (reaches S4b's pre-check on a home connection with intent to proceed).
  2. A community explicitly asks for the home-gateway path during scoping.

On revisit: route through grill-ux-with-docs → wireframe for the walkthrough; the two in-body rulings (the UPnP household-posture question, the manual path staying first-class) are the grill's opening questions.

ADR 0022 recommends renting a VPS because *"the operator never touches router config, never wipes a machine, and never runs an install command."* Router config is the real friction on the self-hosted path, and it is addressable. A home gateway must expose five port groups, not two: | Port | Who | |---|---| | 80, 443/tcp | Caddy | | 53 tcp+udp | acme-dns, authoritative for the delegated zone (`internal/clan/acmedns.go:108-109`) | | 51820/udp | WireGuard, peers dial in (`docs/architecture/03-fleet-topology.md:45`) | | 3478/udp + range | coturn relay (`:46`) | | 25/465/587/993 | mail, once provisioned (ADR 0115) | A gateway that asks the router directly — UPnP/IGD, NAT-PMP, PCP — could open all five, and the operator never opens a router UI. That is a better answer to ADR 0022's stated problem than any external tunnel, and it costs no sovereignty: TLS still terminates on the community's own Caddy and no third party enters the traffic path. ## Why this carries `needs-design` **There is no self-hosted walkthrough to amend.** `RunPreCheck` (`internal/founding/access.go:297-316`) is the entire self-hosted path — one CGNAT verdict, then straight to S5. The only port-forwarding guidance anywhere in the tree is a failure string (`internal/reachability/prober.go:57`). S4b in the wireframes shows the pre-check and its two outcomes, and nothing after it. So this ticket *designs* the walkthrough rather than modifying one: grill the self-hosted access path, then wireframe its states — including the partials that will dominate in practice ("router refused", "three of five ports opened", "UPnP is disabled on your router"). ## Library options (all permissive; ADR 0039 cares about licensing) | Library | Protocols | Licence | |---|---|---| | `tailscale.com/net/portmapper` | UPnP + NAT-PMP + PCP | BSD-3-Clause | | `huin/goupnp` | UPnP / IGD v1+v2 | BSD-2-Clause | | `jackpal/go-nat-pmp` | NAT-PMP | Apache-2.0 | ## Rulings this needs - **Do we ask operators to enable UPnP?** It is off by default on many routers and often deliberately disabled, because any device on the LAN can punch holes with it. Recommending it is a household-wide security posture change made on the community's behalf — a stance a sovereignty product should take deliberately, with honest copy, not silently. - **What happens when IGD is absent or refuses?** The manual path must remain a first-class fallback, not a error state. ## Out of scope Does nothing for CGNAT (ADR 0026's gate stands) and cannot set PTR, so mail stays out on residential either way. Background: `docs/research/2026-08-07-home-gateway-reachability-scope.md` §5. ## Ruled: DEFERRED (Ben, 2026-08-12 backlog walk) Not rejected — the self-hosted walkthrough (and any UPnP/IGD ask) waits until the home path has a real customer; everything current rides the rented-VPS path (ADR 0022's recommendation). **Revisit when the FIRST of these fires:** 1. A real community attempts a self-hosted founding in earnest (reaches S4b's pre-check on a home connection with intent to proceed). 2. A community explicitly asks for the home-gateway path during scoping. On revisit: route through `grill-ux-with-docs` → `wireframe` for the walkthrough; the two in-body rulings (the UPnP household-posture question, the manual path staying first-class) are the grill's opening questions.
Author
Owner

Posture ruled by Ben 2026-08-08 (decision sweep) → ADR 0137 (1716193, on main): ask, then try. The walkthrough explains the household-wide tradeoff in honest copy and asks consent; on yes the gateway attempts UPnP/IGD, NAT-PMP, PCP; refusal, absence, or "no" drops to the manual port-forward walkthrough as a first-class destination, never an error state. needs-design stands — the arc is the grill + wireframes for the whole self-hosted access walkthrough, including the partial states ("router refused", "3 of 5 ports opened", "UPnP is disabled").

Posture ruled by Ben 2026-08-08 (decision sweep) → **ADR 0137** (`1716193`, on main): **ask, then try.** The walkthrough explains the household-wide tradeoff in honest copy and asks consent; on yes the gateway attempts UPnP/IGD, NAT-PMP, PCP; refusal, absence, or "no" drops to the **manual port-forward walkthrough as a first-class destination**, never an error state. `needs-design` stands — the arc is the grill + wireframes for the whole self-hosted access walkthrough, including the partial states ("router refused", "3 of 5 ports opened", "UPnP is disabled").
Author
Owner

Grilled 2026-08-08 (one interview, both trees; flow + seam gates confirmed by Ben). Landed on main in 6c799df: DDR 0140 — the S10b port board is ONE surface, automatic/manual are fill strategies for rows; web + certificate zone + mesh gate reachability, the relay group degrades by name; consent at S4c in the soft phase; generic manual copy that names the router when discovery learned it. ADR 0141 — the portmap seam (wrapping tailscale.com/net/portmapper, BSD-3) with two callers: the agent asks at founding, the control-plane renews in steady state beside ADR 0136's heartbeat; the outside-in prober stays the only truth of openness; a later-closing required group is monitoring's to raise. p1-founding.mermaid gains S4c/S10b + the verdict-unknown edge; CONTEXT.md carries port group / automatic opening / portmap seam / port-readiness states. NOTE for the spec: #326's just-landed ConfirmSelfHosted advances S4b→Address directly — the S4c screen inserts between them when this builds. Next: /wireframe (p1-s4c + p1-s10b frames), then /to-spec. needs-design stands until the wireframes land.

Grilled 2026-08-08 (one interview, both trees; flow + seam gates confirmed by Ben). Landed on main in `6c799df`: **DDR 0140** — the S10b port board is ONE surface, automatic/manual are fill strategies for rows; web + certificate zone + mesh gate reachability, the relay group degrades by name; consent at **S4c** in the soft phase; generic manual copy that names the router when discovery learned it. **ADR 0141** — the portmap seam (wrapping `tailscale.com/net/portmapper`, BSD-3) with two callers: the agent asks at founding, the control-plane renews in steady state beside ADR 0136's heartbeat; the outside-in prober stays the only truth of openness; a later-closing required group is monitoring's to raise. `p1-founding.mermaid` gains S4c/S10b + the verdict-unknown edge; CONTEXT.md carries port group / automatic opening / portmap seam / port-readiness states. NOTE for the spec: #326's just-landed `ConfirmSelfHosted` advances S4b→Address directly — the S4c screen inserts between them when this builds. Next: `/wireframe` (p1-s4c + p1-s10b frames), then `/to-spec`. `needs-design` stands until the wireframes land.
Author
Owner

One slice pulled forward, criteria unchanged (Ben, 2026-08-14, rehearsal phase 3): the thin manual walkthrough — name the port groups, honest per-port status wired to the prober's lanes, a re-check loop, no UPnP — is being built as #517 (design tier) + #518 (seam + screen) under the phase-3 gateway-from-home ratchet (spec docs/superpowers/specs/2026-08-14-183-phase-3-home-gateway-rehearsal-design.md).

Everything else here — the UPnP/IGD household-posture ruling, router-model guidance, the partials design ("router refused", "three of five ports") — stays deferred on this issue with the in-body revisit criteria unchanged. When revisited: a live UPnP proof rig sketch (miniupnpd behind a two-droplet or netns topology; SSDP needs L2, DO VPC won't carry multicast) is recorded in the phase-3 spec conversation. #513 (Mac/Windows VM-doorway testing) is deferred until this issue's UPnP work passes and this issue closes.

**One slice pulled forward, criteria unchanged (Ben, 2026-08-14, rehearsal phase 3):** the *thin manual walkthrough* — name the port groups, honest per-port status wired to the prober's lanes, a re-check loop, **no UPnP** — is being built as #517 (design tier) + #518 (seam + screen) under the phase-3 gateway-from-home ratchet (spec `docs/superpowers/specs/2026-08-14-183-phase-3-home-gateway-rehearsal-design.md`). Everything else here — the UPnP/IGD household-posture ruling, router-model guidance, the partials design ("router refused", "three of five ports") — **stays deferred on this issue with the in-body revisit criteria unchanged**. When revisited: a live UPnP proof rig sketch (miniupnpd behind a two-droplet or netns topology; SSDP needs L2, DO VPC won't carry multicast) is recorded in the phase-3 spec conversation. #513 (Mac/Windows VM-doorway testing) is deferred until this issue's UPnP work passes and this issue closes.
Author
Owner

Slice pulled forward (rehearsal phase 3, spec 2026-08-14 cluster b / #517, landed a4b860d): the option-3 thin manual walkthrough now has its design tier — DDR 0175 + p1-s4c/p1-s10b frames, manual fill strategy only. This ticket's deferred scope and criteria stand unchanged: UPnP/IGD ask-then-try (ADR 0137), router discovery + model naming, the automatic fill strategy on the same board (DDR 0140), and the portmap seam's steady-state renewal (ADR 0141) all remain here. One refinement DDR 0175 records that touches this scope: founding's reachability gate needs only the doors the community's shape exercises (web now; mesh/relay at first multi-device use) — the full board inherits that timing when it lands.

**Slice pulled forward** (rehearsal phase 3, spec 2026-08-14 cluster b / #517, landed `a4b860d`): the **option-3 thin manual walkthrough** now has its design tier — DDR 0175 + `p1-s4c`/`p1-s10b` frames, manual fill strategy only. **This ticket's deferred scope and criteria stand unchanged**: UPnP/IGD ask-then-try (ADR 0137), router discovery + model naming, the automatic fill strategy on the same board (DDR 0140), and the portmap seam's steady-state renewal (ADR 0141) all remain here. One refinement DDR 0175 records that touches this scope: founding's reachability gate needs only the doors the community's shape exercises (web now; mesh/relay at first multi-device use) — the full board inherits that timing when it lands.

Pointer from #623 (ruled 2026-08-20): pre-deploy S10 reachability semantics are now decided — DDR 0188.

#623 (a selfhosted rehearsal drive) hit the concrete case this issue's body already names: "nothing after S4b actually makes a required port real pre-deploy." The ports-honest leg proved live that S10's old bar (every required port must be open, i.e. serving) can never pass before deploy-takeover, because nothing binds 80/443 on a self-hosted box before the takeover runs.

Ben ruled (not this issue's UPnP/auto-fill scope, but adjacent and worth having before the next design pass starts): pre-deploy, S10 reads a refused required port as reachable too (path-proven — the knock reaches the box, nothing is serving yet, which is expected) — only dropped still gates. See docs/adr/0188-design-pre-deploy-reachability-is-path-proven-not-service-proven.md for the full ruling and internal/reachability/prober.go for the implementation.

This doesn't touch #331's own deferred scope (UPnP/IGD auto-fill, router discovery/model naming) — it just fixes the ground S10 stands on before that work resumes. Worth folding into whichever /grill-ux-with-docs or /wireframe pass eventually picks #331 back up: the two S10b wireframes (p1-s10b-port-board.html, p1-s10b-port-board-still-closed.html) now carry ✎ notes flagging that the "refused stalls the board" frame has no live edge to reach pre-deploy any more under DDR 0188 — that frame may want to move to depict a post-deploy service-proven check instead when #331 resumes.

Ruled by agent under ADR 0174 — veto anytime (posting Ben's own ruling as a pointer here; no independent ruling made by this comment).

**Pointer from #623 (ruled 2026-08-20): pre-deploy S10 reachability semantics are now decided — DDR 0188.** `#623` (a `selfhosted` rehearsal drive) hit the concrete case this issue's body already names: "nothing after S4b actually makes a required port real pre-deploy." The `ports-honest` leg proved live that S10's old bar (every required port must be `open`, i.e. serving) can never pass before `deploy-takeover`, because nothing binds 80/443 on a self-hosted box before the takeover runs. Ben ruled (not this issue's UPnP/auto-fill scope, but adjacent and worth having before the next design pass starts): pre-deploy, S10 reads a `refused` required port as reachable too (path-proven — the knock reaches the box, nothing is serving yet, which is expected) — only `dropped` still gates. See `docs/adr/0188-design-pre-deploy-reachability-is-path-proven-not-service-proven.md` for the full ruling and `internal/reachability/prober.go` for the implementation. This doesn't touch #331's own deferred scope (UPnP/IGD auto-fill, router discovery/model naming) — it just fixes the ground S10 stands on before that work resumes. Worth folding into whichever `/grill-ux-with-docs` or `/wireframe` pass eventually picks #331 back up: the two S10b wireframes (`p1-s10b-port-board.html`, `p1-s10b-port-board-still-closed.html`) now carry ✎ notes flagging that the "refused stalls the board" frame has no live edge to reach pre-deploy any more under DDR 0188 — that frame may want to move to depict a post-deploy service-proven check instead when #331 resumes. Ruled by agent under ADR 0174 — veto anytime (posting Ben's own ruling as a pointer here; no independent ruling made by this comment).
Author
Owner

Revisit consideration — the mesh/relay ports have no check and no surface at first multi-device use (review note, 2026-09-18)

Not a revisit trigger — neither criterion above has fired, and this stays deferred. Recorded so the revisit grill opens with it.

The gap. DDR 0175 decision 2 made mesh (51820/udp) and relay (3478/udp + range) informational rows at founding, because the gateway is the only device then, and said their requirement "fires when device-add first needs them (the P3 surface for that moment is #331's deferred scope)". That moment has no surface, and no check:

  • A service device at another site reaches a home-hosted gateway through the gateway's router on those two groups. The port check that matters at device-add time is therefore on the gateway's ports, not the new device's.
  • Device-add's connect-and-check step (DDR 0240, internal/founding/connectcheck.go, the control panel's enroll_connect.go) checks only the new device. Nothing re-probes the gateway's mesh/relay rows when the first off-site device is added.
  • Both groups are UDP. The reachability prober and the broker's front-door probe (#813) are TCP dials and honestly report no verdict for them (broker/internal/broker/frontdoor.go) — so today nothing in the product can observe them.
  • Net effect on a home gateway with 51820 closed: the first remote device simply fails to join the mesh, with nothing pointing the operator at their router.

For the grill. (1) Where does the requirement surface — on the device-add dialog when the first off-site device is chosen, on the Network card, or both? (2) What observes a UDP port honestly — a mesh-level handshake from the joining device is probably the only real evidence, which would make this a diagnosis on a failed join rather than a pre-check. (3) The relay-degrades-by-name rule (DDR 0140) — does a closed relay block, or degrade?

Related, from the same review: #1585 (the visitors check probes the private NIC address), #1586 (helpers should not carry the visitors check), #1587 (the probe's vantage is the operator's own computer), #1588 (the manual port board is unreachable behind the Connect check). Those four are defects in the shipped manual lane and do not wait on this ticket; this note is the part that genuinely belongs to the deferred walkthrough.

## Revisit consideration — the mesh/relay ports have no check and no surface at first multi-device use (review note, 2026-09-18) Not a revisit trigger — neither criterion above has fired, and this stays `deferred`. Recorded so the revisit grill opens with it. **The gap.** DDR 0175 decision 2 made mesh (51820/udp) and relay (3478/udp + range) *informational* rows at founding, because the gateway is the only device then, and said their requirement "fires when device-add first needs them (the P3 surface for that moment is #331's deferred scope)". That moment has no surface, and no check: - A service device at another site reaches a home-hosted gateway **through the gateway's router** on those two groups. The port check that matters at device-add time is therefore on the **gateway's** ports, not the new device's. - Device-add's connect-and-check step (DDR 0240, `internal/founding/connectcheck.go`, the control panel's `enroll_connect.go`) checks only the **new device**. Nothing re-probes the gateway's mesh/relay rows when the first off-site device is added. - Both groups are UDP. The reachability prober and the broker's front-door probe (#813) are TCP dials and honestly report no verdict for them (`broker/internal/broker/frontdoor.go`) — so today nothing in the product *can* observe them. - Net effect on a home gateway with 51820 closed: the first remote device simply fails to join the mesh, with nothing pointing the operator at their router. **For the grill.** (1) Where does the requirement surface — on the device-add dialog when the first off-site device is chosen, on the Network card, or both? (2) What observes a UDP port honestly — a mesh-level handshake from the joining device is probably the only real evidence, which would make this a *diagnosis on a failed join* rather than a pre-check. (3) The relay-degrades-by-name rule (DDR 0140) — does a closed relay block, or degrade? **Related, from the same review:** #1585 (the visitors check probes the private NIC address), #1586 (helpers should not carry the visitors check), #1587 (the probe's vantage is the operator's own computer), #1588 (the manual port board is unreachable behind the Connect check). Those four are defects in the shipped manual lane and do not wait on this ticket; this note is the part that genuinely belongs to the deferred walkthrough.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/idss#331
No description provided.