mesh plane: provision the plane's API credential at the seed leg — neither carrier issues a service token, so Approve has nothing to mint with (ADR 0214 d.3 residue of #961/#963) #973

Closed
opened 2026-08-29 05:19:14 +00:00 by ben · 3 comments
Owner

Parent

Spec #960 · ADR 0214 decision 3/4 · named residue of #961 (V1 fallback) and #963 (IDSS_MESH_TOKEN_FILE / netbird-api-token clan var declared, never provisioned). Blocks the live half of #963, #964 and the phase-5 drive #854: with no token the minter is honest ErrNoMeshPlane at Approve.

The gap

#961's V1 found that neither carrier issues a non-interactive token the mesh plane accepts: kanidm has no client-credentials grant, the idss-idp bridge is authorization-code-only. The fallback recorded — a Netbird service-user PAT held as a clan var — has a bootstrap hole the spike named: on a fresh single-account plane, the first PAT can only be minted by a user who has already logged in through OIDC, and nobody has (decision 3: members never log in; the operator's founding ceremony has no Netbird step).

Options

  • (A) The control plane is the mesh plane's issuer (recommended). Management is configured with an explicit AuthIssuer / AuthKeysLocation pointing at a gateway-local JWKS the control plane serves (it already runs an OIDC provider on the IDIP path), signed with a clan-var key minted at the seed leg; the control plane mints its own short-lived service JWT per API call. No PAT, no first-login bootstrap, no kanidm/bridge dependency, identical on both carriers, and decision 3 becomes literally true. Netbird's OIDC config endpoint is then not set on the plane (its /api is only ever called from localhost by the control plane; the front door's /api route can be dropped). Amends ADR 0214 d.3's token source and the management OIDC wiring; the MeshMinter port and NetbirdMinter adapter keep their shape (bearer in, setup key out).
  • (B) Store-seeded PAT. A gateway oneshot writes a service user + hashed PAT straight into the management store before first start, from the clan var. Non-interactive but couples to Netbird's private schema on the pinned version.
  • (C) Operator mints it during founding. The founding S12 hand-off does one Netbird OIDC login as the operator (creating the account) and mints the PAT into the clan var. Interactive, kanidm-shaped, breaks decision 3's spirit, and the drives need a second passkey ceremony.

Acceptance (for whichever is ruled)

  • On a fresh founding on either carrier, Approve mints a real setup key with no human step; ErrNoMeshPlane only when the plane is genuinely absent.
  • The token material is a clan var minted at the seed leg (persisted prompt or on-box generator), exported to the control plane by file path, asserted by name.
  • Offline: render tests + eval smoke; minter adapter test against an httptest management. Live: phase-5 approve green on rehearsal-d.
  • ADR 0214 amended with the ruled token source; #964's self-admit oneshot un-rests.

Why human

Choosing the issuer of the mesh plane's admin credential is a security-posture call (who can mint peers into the community network). (A) is revertible and keeps every existing gate, so it is arguably a two-way door — but it re-wires the plane's auth, so Ben gets the veto before code. One line ("A") re-arms it.

## Parent Spec #960 · ADR 0214 decision 3/4 · named residue of #961 (V1 fallback) and #963 (`IDSS_MESH_TOKEN_FILE` / `netbird-api-token` clan var declared, **never provisioned**). Blocks the live half of #963, #964 and the phase-5 drive #854: with no token the minter is honest `ErrNoMeshPlane` at Approve. ## The gap #961's V1 found that **neither carrier issues a non-interactive token** the mesh plane accepts: kanidm has no client-credentials grant, the `idss-idp` bridge is authorization-code-only. The fallback recorded — a Netbird service-user PAT held as a clan var — has a bootstrap hole the spike named: on a fresh single-account plane, the *first* PAT can only be minted by a user who has already logged in through OIDC, and nobody has (decision 3: members never log in; the operator's founding ceremony has no Netbird step). ## Options - **(A) The control plane is the mesh plane's issuer (recommended).** Management is configured with an explicit `AuthIssuer` / `AuthKeysLocation` pointing at a gateway-local JWKS the control plane serves (it already runs an OIDC provider on the IDIP path), signed with a clan-var key minted at the seed leg; the control plane mints its own short-lived service JWT per API call. No PAT, no first-login bootstrap, no kanidm/bridge dependency, identical on both carriers, and decision 3 becomes literally true. Netbird's OIDC config endpoint is then **not** set on the plane (its `/api` is only ever called from localhost by the control plane; the front door's `/api` route can be dropped). Amends ADR 0214 d.3's *token source* and the management OIDC wiring; the `MeshMinter` port and `NetbirdMinter` adapter keep their shape (bearer in, setup key out). - **(B) Store-seeded PAT.** A gateway oneshot writes a service user + hashed PAT straight into the management store before first start, from the clan var. Non-interactive but couples to Netbird's private schema on the pinned version. - **(C) Operator mints it during founding.** The founding S12 hand-off does one Netbird OIDC login as the operator (creating the account) and mints the PAT into the clan var. Interactive, kanidm-shaped, breaks decision 3's spirit, and the drives need a second passkey ceremony. ## Acceptance (for whichever is ruled) - [ ] On a fresh founding on either carrier, `Approve` mints a real setup key with no human step; `ErrNoMeshPlane` only when the plane is genuinely absent. - [ ] The token material is a clan var minted at the seed leg (persisted prompt or on-box generator), exported to the control plane by file path, asserted by name. - [ ] Offline: render tests + eval smoke; minter adapter test against an httptest management. Live: phase-5 `approve` green on `rehearsal-d`. - [ ] ADR 0214 amended with the ruled token source; #964's self-admit oneshot un-rests. ## Why human Choosing the issuer of the mesh plane's admin credential is a security-posture call (who can mint peers into the community network). (A) is revertible and keeps every existing gate, so it is arguably a two-way door — but it re-wires the plane's auth, so Ben gets the veto before code. One line ("A") re-arms it.
Author
Owner

Ben ruled A (2026-08-29): the control plane is the mesh plane's own issuer.

Build:

  • A clan-var generator (netbird-api-signing-key, on-box generated at the seed leg like netbird-datastore) holding the signing key; the control plane serves its JWKS at a gateway-local path and mints a short-lived service JWT per management API call; management is rendered with explicit AuthIssuer / AuthKeysLocation / AuthAudience pointing at it and no OIDCConfigEndpoint — the front door's /api route is dropped (only localhost calls /api).
  • NetbirdMinter keeps its shape (bearer in, setup key out); the PAT env/var from #963 (IDSS_MESH_TOKEN_FILE / netbird-api-token) is replaced by the key-file export — one honest log line either way, nil = ErrNoMeshPlane.
  • Same on both carriers; #964's idss-mesh-self-admit un-rests using the same token source.
  • ADR 0214 d.3 amended on main by the session (token source only; port unchanged).
  • Offline: render tests + eval smoke + httptest minter with JWT verification. Live proof = phase-5 drive #854 approve → ConfirmEnrolled with a real wt0.

Re-armed ready-for-agent.

**Ben ruled A (2026-08-29): the control plane is the mesh plane's own issuer.** Build: - A clan-var generator (`netbird-api-signing-key`, on-box generated at the seed leg like `netbird-datastore`) holding the signing key; the control plane serves its JWKS at a gateway-local path and mints a short-lived service JWT per management API call; management is rendered with explicit `AuthIssuer` / `AuthKeysLocation` / `AuthAudience` pointing at it and **no** `OIDCConfigEndpoint` — the front door's `/api` route is dropped (only localhost calls `/api`). - `NetbirdMinter` keeps its shape (bearer in, setup key out); the PAT env/var from #963 (`IDSS_MESH_TOKEN_FILE` / `netbird-api-token`) is replaced by the key-file export — one honest log line either way, nil = `ErrNoMeshPlane`. - Same on both carriers; #964's `idss-mesh-self-admit` un-rests using the same token source. - ADR 0214 d.3 amended on main by the session (token source only; port unchanged). - Offline: render tests + eval smoke + httptest minter with JWT verification. Live proof = phase-5 drive #854 `approve` → `ConfirmEnrolled` with a real `wt0`. Re-armed `ready-for-agent`.

swarm-claim host=matou-dev-server-01 run=13650
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=13650 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #973 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 973,
  "status": "success",
  "commits": [
    "d3b80d7c"
  ],
  "changed_files": [
    "STATUS.md",
    "control-plane/cmd/control-plane/main.go",
    "docs/architecture/16-mesh-plane.md",
    "internal/clan/clan.go",
    "internal/clan/netbird.go",
    "internal/clan/netbird_test.go",
    "internal/clan/vmguest.go",
    "internal/controlapi/mesh_jwks.go",
    "internal/controlapi/mesh_jwks_test.go",
    "internal/enroll/mesh_minter.go",
    "internal/enroll/mesh_minter_test.go",
    "internal/enroll/mesh_signer.go"
  ],
  "tests": [
    {
      "command": "go build ./...",
      "exit_code": 0
    },
    {
      "command": "go vet ./internal/clan/ ./internal/enroll/ ./internal/controlapi/ ./control-plane/...",
      "exit_code": 0
    },
    {
      "command": "go test ./...",
      "exit_code": 0
    },
    {
      "command": "IDSS_EVAL_SMOKE=1 go test ./internal/clan/ -run 'EvalSmoke|EvalCatchesViolation|CarriesFullBaseline'",
      "exit_code": 0
    }
  ],
  "criteria": {
    "On a fresh founding on either carrier, Approve mints a real setup key with no human step; ErrNoMeshPlane only when the plane is genuinely absent": "The netbird-api-signing-key generator is MACHINE-generated on-box (openssl genpkey RSA) declared WITH the plane (netbirdGenerators, gated on GatewayFacts.Mesh) and exported as IDSS_MESH_SIGNING_KEY_FILE on both carriers — no fed prompt, so a fresh founding has the key with no human step (internal/clan/netbird_test.go TestNetbird_SigningKeyDeclaredExportedAsserted, TestNetbird_ControlPlaneIsIssuer over all four public renders). productionMeshMinter (main.go) rests nil -> ErrNoMeshPlane only when the key file is absent. NetbirdMinter mints a real setup key against the httptest management with a JWKS-verifiable service JWT (internal/enroll/mesh_minter_test.go TestNetbirdMinter_MintCallsSetupKeysAPI, TestNetbirdMinter_MissingKeyFailsLoud). Live approve is #854's deferred proof.",
    "The token material is a clan var minted at the seed leg (persisted prompt or on-box generator), exported to the control plane by file path, asserted by name": "netbird-api-signing-key is an on-box openssl-genpkey RSA generator (internal/clan/netbird.go netbirdGenerators), exported by file path as IDSS_MESH_SIGNING_KEY_FILE (vmguest.go gatewayEnvExports), and asserted BY NAME (meshAssertionItems) — pinned by TestNetbird_SigningKeyDeclaredExportedAsserted.",
    "Offline: render tests + eval smoke; minter adapter test against an httptest management": "Render tests: internal/clan/netbird_test.go (control-plane-is-issuer, signing-key declared/exported/asserted, no PAT residue, /api not fronted). Eval smoke: IDSS_EVAL_SMOKE=1 clan EvalSmoke suite green (own-vps + rented mesh-bearing renders evaluate the new management config; seed-community drvPath baseline unchanged). Minter adapter test: internal/enroll/mesh_minter_test.go stands up an httptest management that validates the Bearer JWT against MeshPublicJWKS (kid match + RS256 signature + iss/aud/sub).",
    "ADR 0214 amended with the ruled token source; #964's self-admit oneshot un-rests": "ADR 0214 Amendment 2026-08-29 (option A) records the token source (added by the design session, commit e2a44526); this slice implements it. #964's idss-mesh-self-admit un-rests on the SAME token source (IDSS_MESH_SIGNING_KEY_FILE / netbird-api-signing-key now exist) — its own downstream ticket, named residue, deliberately not pulled into this token-source slice."
  },
  "summary": "The control plane is the community mesh plane's own issuer (ADR 0214 option A): it self-mints a short-lived service JWT per management call and serves the matching JWKS, retiring the fed PAT and its first-login bootstrap hole so a fresh founding approves a device with no human step.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #973 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 973, "status": "success", "commits": [ "d3b80d7c" ], "changed_files": [ "STATUS.md", "control-plane/cmd/control-plane/main.go", "docs/architecture/16-mesh-plane.md", "internal/clan/clan.go", "internal/clan/netbird.go", "internal/clan/netbird_test.go", "internal/clan/vmguest.go", "internal/controlapi/mesh_jwks.go", "internal/controlapi/mesh_jwks_test.go", "internal/enroll/mesh_minter.go", "internal/enroll/mesh_minter_test.go", "internal/enroll/mesh_signer.go" ], "tests": [ { "command": "go build ./...", "exit_code": 0 }, { "command": "go vet ./internal/clan/ ./internal/enroll/ ./internal/controlapi/ ./control-plane/...", "exit_code": 0 }, { "command": "go test ./...", "exit_code": 0 }, { "command": "IDSS_EVAL_SMOKE=1 go test ./internal/clan/ -run 'EvalSmoke|EvalCatchesViolation|CarriesFullBaseline'", "exit_code": 0 } ], "criteria": { "On a fresh founding on either carrier, Approve mints a real setup key with no human step; ErrNoMeshPlane only when the plane is genuinely absent": "The netbird-api-signing-key generator is MACHINE-generated on-box (openssl genpkey RSA) declared WITH the plane (netbirdGenerators, gated on GatewayFacts.Mesh) and exported as IDSS_MESH_SIGNING_KEY_FILE on both carriers — no fed prompt, so a fresh founding has the key with no human step (internal/clan/netbird_test.go TestNetbird_SigningKeyDeclaredExportedAsserted, TestNetbird_ControlPlaneIsIssuer over all four public renders). productionMeshMinter (main.go) rests nil -> ErrNoMeshPlane only when the key file is absent. NetbirdMinter mints a real setup key against the httptest management with a JWKS-verifiable service JWT (internal/enroll/mesh_minter_test.go TestNetbirdMinter_MintCallsSetupKeysAPI, TestNetbirdMinter_MissingKeyFailsLoud). Live approve is #854's deferred proof.", "The token material is a clan var minted at the seed leg (persisted prompt or on-box generator), exported to the control plane by file path, asserted by name": "netbird-api-signing-key is an on-box openssl-genpkey RSA generator (internal/clan/netbird.go netbirdGenerators), exported by file path as IDSS_MESH_SIGNING_KEY_FILE (vmguest.go gatewayEnvExports), and asserted BY NAME (meshAssertionItems) — pinned by TestNetbird_SigningKeyDeclaredExportedAsserted.", "Offline: render tests + eval smoke; minter adapter test against an httptest management": "Render tests: internal/clan/netbird_test.go (control-plane-is-issuer, signing-key declared/exported/asserted, no PAT residue, /api not fronted). Eval smoke: IDSS_EVAL_SMOKE=1 clan EvalSmoke suite green (own-vps + rented mesh-bearing renders evaluate the new management config; seed-community drvPath baseline unchanged). Minter adapter test: internal/enroll/mesh_minter_test.go stands up an httptest management that validates the Bearer JWT against MeshPublicJWKS (kid match + RS256 signature + iss/aud/sub).", "ADR 0214 amended with the ruled token source; #964's self-admit oneshot un-rests": "ADR 0214 Amendment 2026-08-29 (option A) records the token source (added by the design session, commit e2a44526); this slice implements it. #964's idss-mesh-self-admit un-rests on the SAME token source (IDSS_MESH_SIGNING_KEY_FILE / netbird-api-signing-key now exist) — its own downstream ticket, named residue, deliberately not pulled into this token-source slice." }, "summary": "The control plane is the community mesh plane's own issuer (ADR 0214 option A): it self-mints a short-lived service JWT per management call and serves the matching JWKS, retiring the fed PAT and its first-login bootstrap hole so a fresh founding approves a device with no human step.", "reason": "", "blockers": [], "no_code_change": "" } ``` </details>
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#973
No description provided.