Skip to content

feat(fleet): re-key a subordinate CA live via one orchestrated RPC#45

Merged
Bugs5382 merged 4 commits into
mainfrom
feat/29-rekey-live
Jul 20, 2026
Merged

feat(fleet): re-key a subordinate CA live via one orchestrated RPC#45
Bugs5382 merged 4 commits into
mainfrom
feat/29-rekey-live

Conversation

@Bugs5382

Copy link
Copy Markdown
Contributor

What and why

Adds FleetService.RekeyNode, a single operator-gated RPC that re-keys a subordinate CA end to end. Mirroring the SUBORDINATE path of ApproveEnrollment, the manager runs the whole ferry internally: it has the child mint a new key + CSR (BeginKeyRotation), resolves the parent from the child's issuer CN (resolveParentByCN), routes the CSR to the parent for signing under the request profile (SignSubordinateCSR), and delivers the signed chain back to the child (CompleteKeyRotation). It reuses runSubordinateFerry's chain-field mapping so there is no DER/PEM mismatch, closes every dialed connection, and appends exactly one rekeyed audit event on success.

Authz is checked before any dial or audit: a viewer is denied, an unknown child is a not-found, and a parent that is not a known fleet node is a clear failed-precondition (a manual ferry is out of scope for v1.0.0; the two-tier case has the parent in-fleet). No audit is written on any failure path. nodeclient.Client gains BeginKeyRotation/CompleteKeyRotation (the node-side RPCs already exist).

Closes #29

Part of #24

Verification

  • Lint clean
  • Tests pass
  • Build succeeds

How this was verified

  • task ci (gofmt, vet, golangci-lint 0 issues, all tests) and task license (0/39 changed).
  • New internal/fleet/rekey_test.go covers the viewer-denied, unknown-node, parent-not-in-fleet, happy-path (ferry order + chain mapping + response + single audit), and node-step-error (mapped error, no audit) cases.

Merge order

Depends on CryptOS-PKI/api#56 (adds the RekeyNode proto/stubs). api must merge first. This branch temporarily pins api at its branch pseudo-version so the manager builds; the pin will be moved to the api merged-main pseudo-version once api#56 lands (the chore(deps): bump api for RekeyNode commit).

@Bugs5382 Bugs5382 added this to the v1.0.0 milestone Jul 19, 2026
@Bugs5382 Bugs5382 added the enhancement New feature (feat). Minor version bump. label Jul 19, 2026
@Bugs5382 Bugs5382 self-assigned this Jul 19, 2026
…root)

resolveParentByCN maps a self-signed root to itself, which would ask the root
to re-sign its own key under a subordinate profile. Guard child==parent and
return FailedPrecondition.
@Bugs5382
Bugs5382 merged commit a5623a4 into main Jul 20, 2026
12 checks passed
@Bugs5382
Bugs5382 deleted the feat/29-rekey-live branch July 20, 2026 03:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature (feat). Minor version bump.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(web): re-key a subordinate live via the manager

1 participant