Spike: kanidm + Netbird provisioning — gates founding on ADRs 0038/0039 #5
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
1 participant
Notifications
Due date
No due date set.
Depends on
Reference
Matou/idss#5
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?
Spike — kanidm + Netbird provisioning (IdP/mesh pairing)
Gating spike (PROCESS.md Phase 2½): validates ADR feasibility, references
no seam contract, depends on nothing — a root by construction. ADR 0038 names
it explicitly: kanidm client/group provisioning + Caddy ingress "must be
validated before the founding feature builds on it — same role S13 plays for
clan driving." ADR 0039 adds: "Netbird's management plane authenticates via
OIDC against kanidm; the kanidm gating spike validates the pairing."
Task manifest
Why this spike exists
Founding seeds the control plane — config repo, deploy runner, IdP, dashboard —
onto the cluster declaratively. ADR 0038 picked kanidm as the built-in OIDC IdP
because its clients and groups can be declared in Nix (
services.kanidmprovisioning options): no container, no embedded postgres, no imperative API
bootstrapping. But the clan-mauke spike specced this choice without
exercising it — its Phase 9 (identity + ingress) never ran. ADR 0039 then
swapped the mesh from ZeroTier to Netbird, whose management plane must
authenticate against that same kanidm. Two accepted ADRs are stacked on an
unexercised integration; this spike exercises it before the founding feature
builds on it.
Environment
clan-labskill environment. node1plays the gateway (the lab droplet's public 80/443 forward to it); node2/3
are the peer nodes. Read the skill's SKILL.md before any infra action;
provision only through the
clan-labCLI.clan-lab.matou.nzat the lab droplet's public IP with the
lab-dnsskill(
.claude/skills/lab-dns/— built and live-verified under #6, now closed);it overrides the
*.matou.nzwildcard. TLS terminates on node1's ownCaddy (real ACME through the forwarded 80/443) — that is the topology Q2
exists to verify; do not terminate TLS anywhere upstream. The WebAuthn
origin is
https://clan-lab.matou.nz. Teardown includeslab-dns park.perf/resource-floor numbers from nested VMs. The "measured footprint on the
4 GB gateway floor" deliverable is deferred to a real host — record in
the findings that it remains unmeasured, with whatever coarse observations
fall out for free (clearly labelled as non-evidence).
record them in the findings.
spikes/kanidm-netbird/; findings indocs/spike-findings/kanidm-netbird.md.The questions
Q1. Declarative kanidm provisioning (load-bearing)
Stand up kanidm via
services.kanidmwith OIDC clients and groups declaredin Nix — the dashboard and Netbird management as clients, operator/member
groups seeded — entirely from the config repo. No imperative bootstrap: rebuild
the machine from config and the IdP comes back identical. Verify the
WebAuthn-first login actually works end-to-end (register a passkey, log in).
How complete are the provisioning options in practice — what still needs
out-of-band CLI/API calls, if anything?
Q2. Caddy ingress (the mauke Phase 9 that never ran)
Put kanidm behind Caddy on the gateway per the gateway role: TLS + proxy, with
the service reachable publicly for login while its backing ports stay
mesh-only. Confirm certificate handling and any kanidm-behind-proxy gotchas
(origin/URL config, WebAuthn origin binding).
Q3. Netbird as a custom clan service
Author the custom
netbirdclan service ADR 0039 commits to: management +signal + relay role on the gateway, peer role fleet-wide. The mauke spike's
pg-ha/redis-hapattern says custom clan services are routine — confirmthat holds for Netbird's shape. A peer node must join the mesh and reach the
gateway over it.
Q4. The pairing — Netbird management authenticates via OIDC against kanidm
The integration both ADRs lean on: Netbird's management plane configured as an
OIDC client of the community's own kanidm. Log in to Netbird's admin surface
with a kanidm identity; enroll a peer under that regime. Report any impedance
(token formats, PKCE/device-flow support, group-to-access mapping).
Q5. Mesh operational rules transfer
Apply and verify the mauke spike's rules on this stack: service ports open on
the mesh interface only (never WAN/LAN) except the deliberately-public ingress;
test the actual TCP port, not ICMP. Report the resulting port/firewall layout
as the reference for the founding feature.
Q6. Evidence for the CA question (gather, don't decide)
Updated by the seam gate, 2026-07-09 (
docs/seams/agent-control-plane.mdopen decision 2 is now DECIDED in shape): the
IdentityGrantinterface isconfirmed as written under either implementation, and v1 implementation depth
defaults to the full community CA (NodeCert + SSH host cert minted at
enrollment) unless this spike shows that is genuinely hard on this stack —
in which case v1 ships the shortcut (Netbird admission + pinned SSH host key)
stubbed behind the same types.
So Q6's job is sharper than before: from what this spike builds, report what
Netbird admission gives for free, and what cert minting would concretely add —
CA key generation at founding, the two signing operations at approval, cert
install on the peer — as effort, moving parts, and failure modes. End with an
explicit verdict on one axis only: CA-at-enrollment on this stack is
{cheap | workable | genuinely hard}, with evidence. That verdict resolves
the default; the gate's comparison (sequence diagrams + trade-off table) found
the shortcut saves only three steps and one key ceremony at v1 while owing a
live-fleet migration, so "genuinely hard" is the only finding that flips it.
Deliverables & exit criteria
docs/spike-findings/kanidm-netbird.md: verdict per Q1–Q6with evidence, pinned versions, and the port/firewall reference layout
(Q5). The resource-footprint measurement is deferred (see Environment);
the findings must say so explicitly.
spikes/kanidm-netbird/: the Nix config (kanidm provisioning,Caddy ingress, the custom netbird clan service) + README reproducing the
stack from scratch.
Success = Q1–Q5 confirmed (workarounds acceptable if specified) and Q6's
evidence written up. Failure is a valid result = a broken Q1 or Q4
reverses/amends ADR 0038/0039 before founding builds on them — cheap now,
expensive later.
Timebox
One week. This spike is deliberately narrower than S13: one integration
exercised honestly beats a survey.
Agent Brief
Category: enhancement
Summary: Run the kanidm + Netbird provisioning spike on the clan-lab environment, with a real public TLS origin via
lab-<name>.matou.nz, delivering a verdict per Q1–Q6.Current behavior:
ADRs 0038 (kanidm as built-in IdP) and 0039 (Netbird as mesh layer) are accepted but stacked on an unexercised integration — the clan-mauke spike's Phase 9 (identity + ingress) never ran. Nothing has demonstrated declarative kanidm provisioning from Nix, Caddy ingress with real certificates, a custom
netbirdclan service, or Netbird's management plane authenticating via OIDC against kanidm.Desired behavior:
Each question Q1–Q6 in the issue body has an explicit verdict — confirmed / confirmed-with-workaround (described) / broken (described) — with evidence, in the findings doc named by the task manifest. A broken Q1 or Q4 stops the spike early and writes up: revisiting ADR 0038/0039 before founding builds on them is a success outcome.
Environment (the resolved human decision):
Use the
clan-labskill (read its SKILL.md first; provision only through theclan-labCLI). node1 is the gateway — the droplet's public 80/443 forward to it; node2/3 are peers. For Q2's real TLS: this issue is blocked by the lab-DNS-skill issue; once that skill exists, pointlab-<name>.matou.nzat the lab droplet's IP so node1's own Caddy completes ACME and owns the WebAuthn origin. Do not terminate TLS anywhere upstream of node1 — the topology is the thing under test. Resource-footprint numbers are deferred (nested-VM honesty limits); the findings must say so explicitly.Key interfaces:
services.kanidmprovisioning options (clients + groups declared in Nix) — Q1's whole point is "no imperative bootstrap"; anything needing out-of-band CLI/API calls gets named in the findings.netbirdclan service shape (management + signal + relay on the gateway, peer role fleet-wide) — written as a clan service in the lab's clan flake.docs/seams/agent-control-plane.mdopen decision 2 — Q6 gathers CA evidence for it; it does not decide it.Acceptance criteria:
clan-lab statusempty, thelab-*DNS record removedOut of scope (from the manifest):
lab-*names may be touched, via the lab-DNS skillSeam-gate update (2026-07-09):
docs/seams/agent-control-plane.mdopen decision 2 is decided in shape — theIdentityGrantinterface is confirmed as written; v1 depth defaults to the full community CA unless this spike's Q6 shows CA-at-enrollment is genuinely hard on this stack. Q6 in the body has been updated accordingly: it now ends with an explicit{cheap | workable | genuinely hard}verdict, which is what resolves the default.Spike #5 complete — all questions cleared; neither ADR 0038 nor 0039 reversed.
Ran headless against the
clan-lablab with a real public origin(
clan-lab.matou.nz, real Let's Encrypt cert). Findings:docs/spike-findings/kanidm-netbird.md; prototype:spikes/kanidm-netbird/.Committed in
a55e556.netbirdclanService, peer joins meshworkable→ default holds: full community CA at v1Highlights:
services.kanidmwith OIDC clients + groups declaredpurely in Nix (
provision) — no imperative bootstrap. WebAuthn-first loginproven end-to-end with a Chromium CDP virtual authenticator against the real
origin (register passkey → log in → landed on
/ui/apps). Only out-of-bandstep: passkey enrolment (inherent to WebAuthn), via a reset token.
backing port
127.0.0.1:8443only.kanidm identity authenticated to Netbird's management plane end-to-end
(passkey → kanidm OAuth2 PKCE → JWT →
POST /api/setup-keysHTTP 200;garbage/no token → 401). That setup key then enrolled a peer (Q3).
IdP-manager (no user/group sync — mesh access = Netbird groups + setup keys);
kanidm advertises no device flow, so CLI SSO uses the PKCE loopback flow.
kanidmWithSecretProvisioning_1_10is patched and noton the public binary cache — the founding gateway builds it (or OurCloud's
cache serves it), same shape as S13's clan-cli.
Resource-footprint measurement remains DEFERRED to a real host per the
clan-lab honesty limits (recorded in the findings).
Lab destroyed,
lab-dns parked. Next (Blocked on Ben): flipdocs/seams/agent-control-plane.mdopen decision 2 → full-CA +status: confirmed.enrollpackage + in-memory fake #26curls, soyour-identityburns the 180 s ceiling #995sopstoken mislabels itmissing_varand eats the transport retry #1210service-catalogueandsave-serviceshave no live half #1390placeOptions/serverOffer/rentServerto the new enroll ops so the real panel opens the dialog on the place screen #1398service-catalogueandsave-serviceshave no live half #1390