Skip to content

Prototype secure customer BMC access - #42

Closed
scotwells wants to merge 30 commits into
mainfrom
prototype/secure-bmc-access-ci
Closed

scotwells wants to merge 30 commits into
mainfrom
prototype/secure-bmc-access-ci

Conversation

@scotwells

@scotwells scotwells commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds an allocation-scoped customer Redfish prototype under the existing Bare Metal service. Customers request a MachineManagementSession without receiving physical BMC addresses or credentials. Karmada projects narrow authority to one location; an outbound relay connects an ephemeral-key customer connector to the location gateway.

Sessions consume Fleet's protected Secret-backed lifecycle custody instead of synthetic MachineAllocation annotations. Admission shares the allocation/installation CAS boundary. Release waits for verified gateway request draining and effect settlement before cleanup or reuse; unknown effects retain custody. An explicit synthetic controller mode and fleet-session-fixture exercise real Coordinator allocation/release transitions. Production remains unready without authoritative integrations.

Public sessions/bindings use metal.datumapis.com; location projections use coordination.fleet.datumapis.com. Includes schemas, plugin, relay/gateway, durable operation journal, manifests, tests, and a Linux sushy/libvirt E2E harness. Integrated current main, including documentation reorganization and the separate synthetic provider.

Verified CI evidence

Exact head: 62d88c4234028c0269c2ab87552ed6399b40463e.

The prior fixture startup panic was fixed by isolating CLI flags, with a regression test. Earlier baseline runs and zero-schema validator results are historical diagnostics, not the evidence for this head. The final passing run does not establish the cause of earlier intermittent Karmada/connection failures or long-run reliability.

Remaining production work

Caller-preserving Milo authorization, trusted observations, durable project quota, policy renewal, executor/replica fencing, interrupted operation recovery, relay/nonce/clock/rotation hardening, and physical hardware qualification remain incomplete. The production authorization plan specifies permissions, retained decisions, durable limits and acceptance gates; it does not enable production access. Synthetic cleanup and virtual BMC evidence do not qualify physical hardware.

See docs/implementation/machine-management-prototype.md, secure-bmc-lifecycle.md, synthetic-bmc-fixture.md and secure-bmc-authorization.md for contracts, commands and historical evidence. The CI links above supersede the documents' pending combined-run status. Existing live sessions require accounted teardown before removing old schemas or migrating custody.

@scotwells
scotwells marked this pull request as ready for review November 12, 2026 20:02

@ecv ecv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request changes.

go.mod moves go.miloapis.com/service-catalog from v0.13.1 on main to v0.3.2-0.20260714005215-6a3cddd298b0, a downgrade (latest tag is v0.16.1), and fleet-manager imports it. The staging manager image is rebuilt from this go.mod on merge, so this is not prototype-only for staging: staging picks up the older service-catalog plus k8s 0.36→0.37 and controller-runtime 0.24→0.25. Keep service-catalog at v0.13.1 or newer. The rest is an approve.

  • Manifests: infra staging renders only ./milo and ./overlays/synthetic-staging from fleet-kustomize:v0.0.0-main; this PR touches nothing those render. The new config/crd, config/location, config/federation and config/manager dirs ship in the bundle but nothing consumes them. Production and edge reference no fleet bundle.
  • Cross-tenant: admission resolves the claim only in the session's own namespace, requires exactly one active allocation by claim UID and checks claim UID, name and namespace. The principal annotation is overwritten from req.UserInfo.Username by a failurePolicy: Fail webhook, and spec and annotations are immutable after create (webhook plus CEL self == oldSelf). allocationStillActive compares binding, epoch, machine, location, member and route, so a reused allocation revokes the session.
  • Revocation: release sets the projection Revoked with AuthorityFreshUntil=now; the Redfish handler checks expiry and freshness on every request and returns 503 AuthorityStale, so it fails closed within the 2 min bound.
  • Replay: the ed25519 proof covers domain, version, session UID, audience, timestamp and nonce with ±30s skew, and the nonce is consumed after verification. go test -race ./internal/... passes.

Follow-ups:

  • allocationStillActive returns false on any List error or len != 1, and the caller sets revoked-at permanently, so one transient API error kills a live session. Distinguish error from not-found.
  • Session limits count from a cached list, so two sessions for one claim can both pass before the cache catches up.
  • Journal identity is hash(session, method, path, body): a second identical Reset returns the first task and never runs, and an op left Pending by a crash is never reconciled. Both need the client idempotency key the docs mention.
  • gateway.run returns on a relay dial failure but leaves the entry in r.active, so the session sits in RelayUnavailable until expiry.
  • Nonces are in memory and never pruned: a gateway restart reopens a 30s replay window, and the map grows for the process lifetime. The proof does not sign method, path or body.
  • Freshness is an absolute central time checked against the gateway clock, so clock skew stretches the revocation bound; the TLS stream is not closed on staleness.
  • Relay: one static gateway token shared by all gateways, sent in plaintext over the NodePort, with no cap on pending routes or unauthenticated connections.
  • secure-bmc-access.md says the proof signs the one-use route ID; the code signs the session UID.
  • No Milo IAM protected resource or role for machinemanagementsessions; the principal is never checked against the claim, only RBAC create. Needed before customer exposure.

@scotwells
scotwells requested a review from ecv November 12, 2026 23:17
@scotwells

Copy link
Copy Markdown
Contributor Author

Re-review requested on c0cbf80.

The prior blocking dependency issue is resolved: go.miloapis.com/service-catalog is now retained at v0.13.1, matching main. The updated head also:

  • migrates the prototype from MachineClaim/binding-ID/epoch fields to Machine + terminal MachineAllocation + MachineCapacity
  • projects only the minimal location contract through Karmada; no raw Kubernetes UID or BMC credential/routing detail crosses planes
  • resolves location BMC access through MachineCapacity -> Device -> service-owned enrollment Secret
  • binds client proof to the opaque one-use relay route
  • makes protected binding admission API-server-idempotent under controller cache lag
  • uploads sanitized, non-secret E2E evidence

Final CI is green:

Merge the secure BMC prototype and align public sessions, private bindings, and location projections with the current Metal/Fleet split. Restore the service-catalog baseline, fix projection freshness validation, and document remaining lifecycle integration and E2E verification gaps.

Signed-off-by: Scot Wells <wells.scot@gmail.com>
ecv
ecv previously approved these changes Nov 13, 2026

@ecv ecv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve.

The service-catalog hold is fixed: go.mod pins go.miloapis.com/service-catalog v0.13.1, same as main. I rendered ./milo and ./overlays/synthetic-staging (the two paths infra staging takes from fleet-kustomize:v0.0.0-main) with kustomize 5.8.1 on main (5047156) and on a git merge-tree of main and this head: both renders are byte-identical, so merging changes nothing in the staging render.

  • The fleet.datumapis.com to metal.datumapis.com CRD, IAM ProtectedResource and role renames are already on main (#44/#46), and infra staging already uses metal.datumapis.com (MachineClass, MachineProfile, MachineCapacity, the metal Service patches). This PR adds no further rename for staging, so no CRD is orphaned and no role is dropped.
  • This head alone, rendered without main, drops the metal-machines legacy ResourceRegistration that #48 added to config/components/service-catalog to preserve old quota accounting. The merge keeps it (clean three-way on those paths), so resolve the README.md and docs/development/roadmap.md conflicts without reverting #48. Staging's fleet-milo-configuration has prune: false, so a revert would orphan rather than delete the registration.
  • The 3 new CRDs (config/crd: sessions, bindings, projected sessions), config/federation, config/location, config/manager and config/rbac ship in the bundle but neither staging path references them.
  • The staging manager image is rebuilt from this go.mod on merge, so staging also picks up k8s 0.36.1 to 0.37.2 and controller-runtime 0.24.1 to 0.25.2. The virtual-bmc E2E (full Karmada/Kind/sushy run) and validate checks pass on this head.

Follow-ups:

  • The earlier open items still apply before customer exposure: Milo IAM role for machinemanagementsessions and a principal-to-claim check, allocationStillActive treating any List error as revoked, in-memory nonces, and the shared plaintext relay token.
  • Mergeable state is CONFLICTING (docs only), so the branch needs main merged in before it can land.

@scotwells
scotwells dismissed ecv’s stale review November 13, 2026 00:17

The merge-base changed after approval.

@kevwilliams kevwilliams left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hold: six new doc links are broken against current main, and the gateway sends BMC credentials over plain http when the enrollment endpoint allows it.

  • hack/validate-doc-links.sh calls rg, which ubuntu-latest lacks, so CI logs rg: command not found and passes; run locally, it fails on the design.md, architecture.md and implementation.md links moved by #47.
  • The gateway sends Basic-auth credentials to whatever endpoint the enrollment Secret names, http:// included; require https and offer a CA bundle option.
  • Test: an enrollment with an http:// endpoint is refused.

@ecv

ecv commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Closing as stale: this prototype has had no activity since 13 Nov, conflicts with main, and main has since reworked device custody and per-Device BMC credentials (#182). Reopen or start fresh from main if customer BMC access is still wanted; the branch is kept.

@ecv ecv closed this Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants