Skip to content

fix(config): accept a management block with no trust_pem, and record why a SetManagement was refused - #422

Merged
Bugs5382 merged 2 commits into
mainfrom
fix/418-link-trust-pem-optional
Nov 17, 2026
Merged

Bugs5382 merged 2 commits into
mainfrom
fix/418-link-trust-pem-optional

Conversation

@Bugs5382

@Bugs5382 Bugs5382 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Linking a running node to a FleetOS Manager fails at approval on v0.1.0-rc.2, for every node (#418). The manager's LINK approval calls SetManagement with its manager_cn and a read-only operator surface, and sends no trust_pem on purpose: the operator CA is never pushed to a node (cryptos-manager#146). validateManagement required a trust_pem, and since ApplyConfig validates before it persists (#229), the node refused every link with config: management.trust_pem: required when management is set, which the manager reported as a masked error 1900. The regression test reproduces that exact error.

This is the design approved on #418, with the trust check done first (the note is on the issue thread): trust_pem authenticates nothing on the node. The manager connects with the node's own admin certificate, which the mTLS listener and AuthorizeAdmin pin, SetManagement is itself admin-gated, and the field is only copied between the config and the protobuf. So the production change is small:

  • validateManagement requires manager_cn only. trust_pem stays in the schema, optional, and is documented as reserved and unused; a stored value is kept and a non-empty one is not rejected, so an existing node still loads.
  • A failed SetManagement records why in its audit entry (details.error: the status message, at most 256 bytes, cut at a character boundary), and Describe shows it after (failed). Today the entry only says it failed, and the manager's error is masked, so the node's log was the only place to look and it had nothing to say.

Closes #418

The other halves of #418 are their own issues, so this PR stays on the node: the manager logging the error behind 1900 is CryptOS-PKI/cryptos-manager#233, and the full-image suite step that links a node (which blocks the rc.3 tag) is CryptOS-PKI/cryptos-appliance#125.

No docs change: the docs already describe linking a running node as working; this makes it so.

Verification

  • Lint clean
  • Tests pass
  • Build succeeds
  • Documentation updated (if behavior or API changed)

How this was verified

  • Tests first: the config and Describe tests failed before the change (the config rejected a manager_cn alone; DetailError didn't exist), and a ConfigStore.Apply regression test failed with the production message, InvalidArgument ... node: Apply: validate: config: management.trust_pem: required when management is set. The old TestValidate_Management, which asserted the requirement, is updated to the new contract. The audited-RPC tests (a refused SetManagement records its reason; the reason is bounded) were written with the production change.
  • gofmt clean, go vet ./... clean, golangci-lint run ./... 0 issues, go test ./... passes on macOS arm64.
  • Not run from here: linking a real node to a real manager. That is what the suite step adds (cryptos-appliance#125). With this PR's node and the rc.2 manager, the approval's SetManagement should now succeed, and I have not seen that on a running pair yet.

Before merging: add a closing comment summarizing what was actually done in this PR
(not just the checked boxes).

@Bugs5382 Bugs5382 added this to the v0.1.0 milestone Nov 17, 2026
@Bugs5382 Bugs5382 added the bug Something isn't working. label Nov 17, 2026
@Bugs5382 Bugs5382 self-assigned this Nov 17, 2026
@github-actions github-actions Bot added the fix Bug fix (fix). Patch. label Nov 17, 2026
…why a SetManagement was refused

A LINK enrollment makes the Fleet Manager call SetManagement with its manager_cn and a read-only operator surface. It sends no trust_pem on purpose: the operator CA is never pushed to a node. validateManagement required one, and since ApplyConfig validates before persisting, the node refused every link with management.trust_pem: required, which the manager reported as a masked error 1900.

trust_pem authenticates nothing on the node: the manager connects with the node's own admin certificate, which the mTLS listener and AuthorizeAdmin check, and the field is only copied between the config and the protobuf. validateManagement now requires manager_cn only. The field stays in the schema, optional, documented as reserved and unused, and a stored value is kept.

A failed SetManagement now records why in its audit entry (details.error, at most 256 bytes, cut at a character boundary), and Describe shows it after (failed).

Closes #418

Signed-off-by: Bugs5382 <12115015+Bugs5382@users.noreply.github.com>
@Bugs5382
Bugs5382 force-pushed the fix/418-link-trust-pem-optional branch from 861881f to 619835b Compare November 17, 2026 20:57
@Bugs5382

Copy link
Copy Markdown
Contributor Author

Summary of what this PR did:

  • validateManagement now requires only manager_cn. management.trust_pem stays in the schema as an optional field documented as reserved and unused; a stored value is kept and a non-empty one is not rejected. Nothing on the node used it to authenticate the manager (the bootstrap admin certificate is the node's trust anchor and SetManagement is gated by it), so dropping the requirement weakens nothing.
  • A failed SetManagement now records its reason in its audit entry (details.error, at most 256 bytes, cut at a character boundary), and Describe shows it after "(failed)".
  • Tests first: a ConfigStore.Apply regression test reproduced the exact production error (InvalidArgument ... management.trust_pem: required when management is set) before the fix; the old test that asserted the requirement is updated to the new contract. A real node linked to a real manager was not run here; the image-suite linking step (feat(console): hard reset (M3) #125) covers that. Closes fix(grpc): linking a running node fails: SetManagement needs management.trust_pem, which the manager never sends #418.

@Bugs5382
Bugs5382 merged commit 25a59f7 into main Nov 17, 2026
17 checks passed
@Bugs5382
Bugs5382 deleted the fix/418-link-trust-pem-optional branch November 17, 2026 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working. fix Bug fix (fix). Patch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(grpc): linking a running node fails: SetManagement needs management.trust_pem, which the manager never sends

1 participant