fleet: remote-site (cross-site) mesh enrolment — build the non-LAN path to management/signal (mechanism ruling needed) #543
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/idss#543
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Filed from #329, whose doc-vs-reality investigation is complete: spike #5 exercised the LAN-nic bootstrap for same-LAN peers only (node1–3 as libvirt VMs on one droplet's
10.100.0.0/24; the Netbird module opens management(8011)/signal(8012) on the shared LAN nicens2), and a node at a different physical site genuinely has no bootstrap path to management/signal — the three candidates all fail at enrolment:connection refused, proven from outside the fleet in spike #5);wt0— does not exist yet (the chicken-and-egg the LAN nic exists to break).coturn does not help: it relays the WireGuard data plane after enrolment, once a peer has already reached management/signal. So remote-site enrolment needs a non-LAN path to management/signal. This is a core case, not an edge one — the product targets communities whose machines sit at homes, an office and a marae, and the fleet topology's own zone-spread guidance ("different building or zone") assumes it.
The architecture doc already records the proven scope and this open gap (
docs/architecture/03-fleet-topology.md, Proven scope note after the bootstrap sequence + the reading-notes bullet). This ticket tracks the implementation, which cannot start until the mechanism is ruled.Why human
One-way-door ruling (ADR 0174). Every non-LAN path touches the "only deliberately public surface is Caddy on 80/443" invariant — this is precisely the class ADR 0174 rule 3 names as always-stop-on-human ("security-posture widenings: a new deliberately-public surface or port... the #329-class ruling" — #329 is this ticket's own parent). No agent session may adopt a default here under the ADR's reversibility rule; a security-posture widening is excluded from delegation regardless of how revertible the commit would be. Ben rules among:
${domain}:443by default, which OurCloud deliberately overrode to plaintext mesh ports). Keeps one public port but makes management/signal publicly reachable through it.Proposed default ruling (not agent-adoptable — flagged per ADR 0174 rule 4 so the digest carries a one-line ask): (b), reverse-proxying management/signal through Caddy on 443, is the smallest deviation from the current invariant (still exactly one public port, still fronted by Caddy/TLS same as everything else deliberately public) and is Netbird's own well-trodden default rather than a bespoke flow — but this trades off against (c)'s stronger "no new public reach" property, which is why it's a threat-model call and not a default this session can take. Whichever way it goes, (d)'s IPv6 interaction with #332 is worth reading first.
Definition of done
Once (a/b/c/d) is ruled: re-file as a doc correction (if none-public) or build the chosen path — the enrolment mechanism that lets a node at a different physical site reach management/signal at bootstrap, with a lab-proven genuinely-remote enrolment (an off-LAN node joins the mesh end to end).
Related: #329 (the investigation + doc record this derives from), #332 (IPv6 leg — the multi-site mesh escape hatch), #328 (the reachability gate doesn't probe mesh/relay ports today).
Ben ruled (live digest, 2026-08-14): option (b) — management/signal reverse-proxied through Caddy on 443, upstream Netbird's default shape. Recorded as ADR 0177 (
docs/adr/0177-remote-site-enrolment-rides-the-front-door.md). The 80/443-only invariant holds literally; reach is gated by Netbird's enrolment auth (setup keys/JWT), not network position. (a)/(c)/(d) rejected — rationale in the ADR.Relabelled
ready-for-session: the build (Netbird module advertises front-door endpoints, Caddy routes them) plus the acceptance's lab-proven genuinely-remote enrolment need clan-lab standing a swarm sandbox doesn't have. Fleet-topology doc updates ride the build commit.Ruled by agent under ADR 0174 — veto anytime.
Ruling: this is a one-way door, not a two-way door — no self-ruling possible. Checked against ADR 0174's own list (
docs/adr/0174-two-way-door-rulings-default-to-the-agent.md, rule 3): "security-posture widenings: a new deliberately-public surface or port... (the #329-class ruling)" is named explicitly, and #329 is this ticket's own parent — this ticket is that named precedent. All three implementation-worthy candidates (a, b, c) widen or replace the "only Caddy 80/443 is deliberately public" invariant; only (d) doesn't, and (d) is itself a scope ruling ("rule cross-site mesh out for v1"), not an implementation task. There's no independent two-way-door part of this ticket left to finish — the ticket says so itself ("cannot start until the mechanism is ruled") — so nothing was actioned beyond formatting the ask.What I did: reformatted the ticket body so it carries an explicit
## Why humanline (previous heading text conveyed the same thing but didn't match the label bar's literal convention indocs/agents/triage-labels.md) and a proposed default ((b), reverse-proxy through Caddy 443 — smallest deviation + Netbird's own default) so the digest ask is a one-liner Ben can approve or override, per ADR 0174 rule 4. The default is flagged as not agent-adoptable — I'm not ruling it, just shortening Ben's read.Label:
ready-for-session→ready-for-human(was mislabelled — this needs Ben's ruling, not a session's standing; nothing here needs host credentials or live-infra access, just a decision).Leaving open. Not closing — the ticket's definition of done is the implementation, which starts after the ruling.
Ruling confirmed (Ben, 2026-08-19, live session): option (b) — management/signal reverse-proxied through Caddy on 443. This was in fact already ruled 2026-08-14 and recorded as ADR 0177 (
docs/adr/0177-remote-site-enrolment-rides-the-front-door.md, status: accepted) — the ticket label was never flipped afterwards. Ben re-confirmed (b) today.Implementation per the ADR's consequence paragraph: Netbird module's advertised endpoints move to front-door addresses, Caddy routes them,
docs/architecture/03-fleet-topology.mdport table + bootstrap sequence update with the build, and the arc closes only on a lab-proven genuinely-remote enrolment (off-LAN node joins the mesh end to end). Armed ready-for-agent.Build landed (option b / ADR 0177), commit
9ff8482onmain. The front-door cross-site enrolment path is now declarative in the spike #5 clan config:spikes/kanidm-netbird/clan/modules/netbird.nix— newfrontDoorHostgateway option; when set, management advertises Signal athttps://<host>(Caddy's 443) instead of the plaintext mesh port (empty keeps spike #5's same-LAN-only shape). LAN fast path unchanged.spikes/kanidm-netbird/clan/machines/node1/gateway.nix— Caddy path-routes the netbird gRPC/REST prefixes:/api/*+/management.ManagementService/*→ management (8011),/signalexchange.SignalExchange/*→ signal (8012), bothh2c://127.0.0.1(gRPC over cleartext HTTP/2 to the plaintext backends on localhost); kanidm is the fallback handler. No new public port — the only listening public surface is still Caddy on 80/443; what widens is reach, gated by Netbird's setup-key/JWT auth, exactly as ADR 0177 rules.spikes/kanidm-netbird/clan/clan.nix— sets the front door; node3 dialshttps://clan-lab.matou.nzas the off-LAN bootstrap shape.docs/architecture/03-fleet-topology.md(diagram, port table, bootstrap sequence now branches LAN-fast-path vs front-door, reading notes, decisions) + ADR 0177's consequence +STATUS.md.Seam check:
nix-instantiate --parsepasses on all three changed.nixfiles (the spike configs aren't wired into the flake'snixosConfigurations, so parse is the runnable in-sandbox check; the module system + Caddyfile only fully evaluate under clan-core, which the sandbox lacks).Why human / session (not closing)
The DoD's arc-closer — a lab-proven genuinely-remote (off-LAN) enrolment — cannot be produced by the disposable clan-lab a swarm worker uses: it is single-droplet, same-NAT (node1–3 on
10.100.0.0/24) with simulated public reachability (the host port-forwards 80/443 to node1), so it structurally cannot host a node at a different physical site. Proving the front-door path really carries enrolment where the LAN path can't needs a multi-site lab — e.g. twoclan-labdroplets (genuinely different networks / public IPs), the gateway on lab A with DNS + ACME, and a netbird peer on lab B enrolling over the real internet viahttps://clan-lab.matou.nz(443) → Caddy → management/signal →wt0comes up, proven by TCP-port test per the mauke rule. That is a live-infrastructure operation needing an interactive session's lab standing (clan-lab + lab-dns), which a swarm sandbox lacks — exactly why this wasready-for-sessionbefore. The mechanism ruling itself is already made (ADR 0177), so this is not a one-way-door for Ben; it just needs a session to run the proof.Relabelled
ready-for-agent→ready-for-session. The build is onmain; the ticket stays open for the genuinely-remote lab proof.Session start. Working #543's remaining arc-closer — the genuinely-remote lab proof — per the previous comment's
ready-for-sessionrouting (mechanism ruling + build are both already done: ADR 0177, commit9ff8482).Bug found + fixed first (commit
ea8ff47, pushed): ADR 0128 (2026-08-05) moved the lab's public hostname fromclan-lab.matou.nz(deSEC, dead) toclan-lab.idss.nz(Cloudflare — the only hostnamelab-dnsmanages). The #543 build landed 2026-08-19, after that move, but copied the old hostname from spike #5's July config into the newfrontDoorHost/domain/OIDC defaults acrossspikes/kanidm-netbird/clan/{clan.nix,modules/netbird.nix,machines/node1/gateway.nix}and the README/proof scripts. Fixed every reference — this would have silently broken ACME/DNS for any future run of this config, including this one.Credential gap found:
OURCLOUD_LAB_DNS_TOKENis not provisioned to this session — checked env,.sandcastle/secrets/(onlyREADME.mdpresent, no token file),.sandcastle/.env,~/.git-credentials,~/.netrc, and a broader filesystem search.DIGITALOCEAN_ACCESS_TOKENandFORGEJO_TOKENare present; the lab-dns one was never written for this manual host run (thesecrets/README.md"for a manual host run, write the files yourself" step missed it). This blocks real public DNS + Let's Encrypt for the front door as the prior comment's proof design assumed.Ruled by agent under ADR 0174 — veto anytime. Proceeding anyway with a reduced-fidelity version of the same proof: two genuinely separate
clan-labdroplets (real network/NAT/public-IP separation — the actual thing in doubt), but the off-LAN peer gets a client-side/etc/hostsoverride forclan-lab.idss.nzinstead of real DNS, and Caddy on the gateway lab uses a local-CA cert instead of Let's Encrypt for this run only. This is a two-way door (lab droplets, config, all disposable/revertible) and it isolates exactly what #543 is actually asking — can an off-LAN peer with zero LAN adjacency complete enrolment through the front door — from DNS/ACME plumbing that spike #5 already proved separately (Q2, real cert againstclan-lab.matou.nzwhen that was the live hostname). Will call this out explicitly as an honesty-limit in the findings, matching this repo's existing pattern (clan-lab SKILL.md's own limits section). If this doesn't land cleanly within this session, I'll say so plainly rather than claim a proof that didn't happen.Close-report. The DoD's remaining piece — a lab-proven genuinely-remote enrolment — is done. The mechanism ruling (ADR 0177) and its build (commit
9ff8482) already landed before this session; this session ran the proof the previous session correctly identified as needing session standing (clan-lab+lab-dns).What was proven, on real infrastructure (2 independent DigitalOcean droplets, no shared NAT, different public IPs — one a
clan-labgateway, one a--freshstock droplet standing in for the off-LAN device):8011/8012— connection refused.443— answers.443alone: OIDC discovery, a real kanidm-JWT → Netbird-managementPOST /api/setup-keys(the Q4 pairing, exercised again through the front door), and a bare upstreamnetbirdclient (not the clan module — testing the mechanism, not one Nix wiring) logging in with that setup key.wt0came up on the off-LAN device with a real mesh IP, saw both Lab-A peers, and carried a real TCP payload to one of them — the mauke rule (TCP, never ICMP).Advances #329, closes the gap it left open.
Two real bugs found and fixed in the #543/ADR-0177 build along the way:
ea8ff47(earlier this session): the build hardcoded the pre-ADR-0128clan-lab.matou.nzhostname (dead — the zone moved toclan-lab.idss.nzon 2026-08-05, before the build landed).0c7a625: the front-doorSignal.URIwas set to a bare hostname with no port. Netbird's dialer does not infer:443fromProto = "https"— every peer'swt0silently never came up until this carried the port explicitly. Found live because node2 (the LAN-fast-path peer) failed too — Signal's advertised endpoint is account-wide, not per-peer, so this bug wasn't front-door-specific.Honesty limit (documented in
docs/spike-findings/kanidm-netbird.md's new #543 addendum):OURCLOUD_LAB_DNS_TOKENwas not provisioned to this session (checked.sandcastle/secrets/,.sandcastle/.env,~/.git-credentials,~/.netrc— absent everywhere), so real public DNS + Let's Encrypt (already proven separately in spike #5 Q2) was substituted with a client-side/etc/hostsoverride and Caddy's local CA, trusted only by the machines that needed to validate it. This is orthogonal to what #543 actually asks — whether a peer with zero LAN adjacency can reach management/signal through the front door — which was measured directly (port refusal, real TCP payload), not inferred.One gotcha reproduced but deliberately not fixed (out of this ticket's scope):
netbird service run's first boot ignoresNB_MANAGEMENT_URL/-mand always bootstraps against the upstream default (api.netbird.io) — reproduced on both the clan module's netbird client (0.72.3) and a bare upstream install (0.76.3); every peer in this session needed its profile file hand-seeded with the correctManagementURLbefore first login. Spike #5's original July run reported a clean automatic join with the same client version, so this may be session- or version-window-specific rather than a standing defect — flagged in the addendum for whoever next touches peer enrolment to re-verify against a clean golden-image run, not asserted as confirmed.Docs updated:
docs/architecture/03-fleet-topology.md(the "still pending" callout + reading-notes bullet now record the closed proof),docs/spike-findings/kanidm-netbird.md(full addendum),STATUS.md(header + milestone log).Infrastructure: both lab droplets destroyed at session end (
clan-lab statusempty). No DNS was ever pointed (no token), so nothing needed parking.Ruled by agent under ADR 0174 — veto anytime. Everything landed here is a two-way door: disposable lab droplets (destroyed), commits on
mainprovable by the TCP-payload proof above and this session's transcript. No security-posture widening — the mechanism ruling itself was Ben's (ADR 0177, 2026-08-14/19), not this session's; this session only proved and hardened what was already ruled.Closing per the ticket's definition of done.