Skip to content

Propagate and issue service-account certificate identities - #1216

Open
rkoster wants to merge 33 commits into
cloudfoundry:developfrom
rkoster:service-accounts-poc
Open

rkoster wants to merge 33 commits into
cloudfoundry:developfrom
rkoster:service-accounts-poc

Conversation

@rkoster

@rkoster rkoster commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor
  • Read the contributing document.

Summary

Community RFC draft: cloudfoundry/community#1645.

Runtime implementation of org-owned service accounts with qualified identities and explicit same-org space entitlements managed by CAPI.

  • Carry optional typed certificate_properties.service_account with name and organization prefix through BBS LRP/task conversion into executor. The BBS runtime contract requires both labels.
  • Add one canonical <name>.<prefix>.svc.identity DNS SAN to instance and C2C credentials while preserving caller GUID/CN/IP/OUs, existing routes, usages, lifetime and independent keys.
  • Retain launch-time account identity on timed renewal/route-triggered regeneration; copy account pointers when copying container snapshots.
  • Validate canonical names and reserve the account SAN namespace across internal-route and instance-GUID inputs, including case/trailing-dot variants.
  • Fail closed when account credentials are requested without identity support or an enabled gate. Declare/render default-off diego.executor.service_account_identity_enabled for Linux and Windows rep jobs.
  • Document operator rollout and contract provenance.

Backward compatibility

Experimental opt-in; existing account-free workloads preserve their credential shape. SAN-producing inputs in the reserved svc.identity namespace are rejected even without an account. Review this namespace restriction as an intentional compatibility change.

Keep the CAPI runtime gate off until every participating BBS/rep/cell supports the contract. Automatic auction/foundation capability negotiation is not implemented, so old components discarding unknown protobuf fields remain a rollout risk. Windows templates/cross-compilation were verified; Windows execution was not.

Verification

History preserves committed RED/GREEN behavior cycles.

  • Required-prefix dependency alignment: RED f05c613cd → GREEN fbf2a7ffc. Both LRP/task runtime contracts rejected missing prefixes after refresh; qualified wire-to-certificate flow remains valid.
  • Final-model credential issuance: RED 8c77dc63a → GREEN 325d9a244. Executor rejects nine missing/malformed prefix inputs at issuance and has no unqualified SAN fallback. All21 focused cases pass, including qualified 3/63-character boundaries and renewal/unbind snapshots. The entire executor/rep regression run passes after this correction, plus go vet, changed-file gofmt and whitespace checks.
  • On 2026-11-19, all executor/rep packages passed in the full regression run except two rep fixtures still using unqualified identities. Updated those fixtures to assert qualified copying/no aliasing, then reran rep: all139 specs pass, plus standalone contract/certificate tests. Other packages passed, including containerstore and rep command integration.
  • Both vendored and -mod=mod focused TestServiceAccount tests pass against the published fork module. Changed Go files are gofmt-clean; git diff --check passes. Rep report: /tmp/opencode/diego-bbs-alignment-rep.json (local).
  • Earlier verification before this dependency refresh:
  • 137 release-template examples passed; focused race tests, go vet and formatting checks passed.
  • Linux rep/gocurl/BBS builds and Windows rep cross-build passed.
  • Wire → stored-LRP assembly → rep → real certificate tests cover shared identity across two apps/task, independent keys, renewal and unbind invariants.
  • Live lab: two apps and a runtime task received the shared SAN; app keys differ; UAA token acquisition and explicit CAPI role access succeeded; unbind retains running identity until restart, restart removes it, rebind restores it.

Contract and other draft dependencies

Merge dependency: BBS draft #168, source 7fc64d1d37a1bb2f5bcb6619c87ac27f859ea62e, provides required qualified identity validation and the stored-LRP AddRunInfo fix. code.cloudfoundry.org/bbs/models is pinned to v1.15.1-0.20261119082436-7fc64d1d37a1 with an explicit replacement by the same published version of github.com/rkoster/bbs/models and committed checksums. Vendor was refreshed via go mod vendor; no vendor/generated files were hand-edited. Fresh focused module-mode resolution/tests pass. Remove the fork replacement/select the upstream version once the BBS change is merged and published.

Companion drafts: cloud_controller_ng #5520, capi-release #702, CLI #3875. UAA baseline: cloudfoundry/uaa#4076. Live tokens include cnf, an explicit deviation from the proposal's bearer profile. Near-expiry lifetime caps, namespace-limited UAA management, timed live renewal and the remaining acceptance matrix are still open.

Disabling/unbinding is not immediate certificate revocation. Account authorization/provisioning and staging exclusion are CAPI responsibilities. Current verification is local; prior live evidence predates this dependency refresh and required-prefix issuance correction. Current upstream reconciliation, release/build verification and integrated live revalidation remain readiness work.

rkoster added 27 commits October 5, 2026 17:01
@rkoster rkoster changed the title Draft: propagate and issue service-account certificate identities Propagate and issue service-account certificate identities Nov 19, 2026
@rkoster
rkoster marked this pull request as ready for review November 19, 2026 11:52
@rkoster
rkoster requested a review from a team as a code owner November 19, 2026 11:52
Copilot AI balanced review requested due to automatic review settings November 19, 2026 11:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Security-sensitive identity issuance depends on an unmerged BBS contract and coordinated cross-component rollout, requiring human review while integrated revalidation after the prefix correction and Windows runtime validation remain outstanding.

No open issues 🎉

What changed in this PR

Adds experimental, default-off service-account certificate identities to Diego, carrying qualified account names from BBS through rep into executor-issued instance and container-to-container credentials.

Changes:

  • Propagates and validates account names and organization prefixes using the updated BBS contract.
  • Issues qualified service-account DNS SANs, preserves launch-time identity during renewal, and rejects reserved-namespace injection.
  • Adds Linux and Windows configuration gates, regression coverage, and operator rollout documentation.
File Description
src/​code.cloudfoundry.org/​vendor/​modules.txt Records the updated BBS models dependency and fork replacement.
src/​code.cloudfoundry.org/​vendor/​code.cloudfoundry.org/​bbs/​models/​task.go Validates task certificate properties.
src/​code.cloudfoundry.org/​vendor/​code.cloudfoundry.org/​bbs/​models/​desired_lrp.go Validates qualified identities and preserves certificate properties during LRP assembly.
src/​code.cloudfoundry.org/​vendor/​code.cloudfoundry.org/​bbs/​models/​certificate_properties.proto Defines the service-account wire contract.
src/​code.cloudfoundry.org/​vendor/​code.cloudfoundry.org/​bbs/​models/​certificate_properties.pb.go Adds generated service-account serialization support.
src/​code.cloudfoundry.org/​rep/​service_account_credentials_test.go Covers required prefixes and wire-to-certificate propagation.
src/​code.cloudfoundry.org/​rep/​conversion_helpers.go Validates and copies account identities into executor requests.
src/​code.cloudfoundry.org/​rep/​conversion_helpers_test.go Tests identity propagation, validation, and copy isolation.
src/​code.cloudfoundry.org/​go.sum Adds BBS model dependency checksums.
src/​code.cloudfoundry.org/​go.mod Pins the qualified-identity BBS contract through a fork replacement.
src/​code.cloudfoundry.org/​executor/​service_account_copy_test.go Tests account identity isolation in container copies.
src/​code.cloudfoundry.org/​executor/​resources.go Defines executor account identities and copies them independently.
src/​code.cloudfoundry.org/​executor/​initializer/​initializer.go Wires the feature gate and requires instance-identity support.
src/​code.cloudfoundry.org/​executor/​initializer/​initializer_test.go Tests gate configuration and credential prerequisites.
src/​code.cloudfoundry.org/​executor/​depot/​containerstore/​credmanager.go Issues account SANs, validates inputs, and retains launch identity.
src/​code.cloudfoundry.org/​executor/​depot/​containerstore/​credmanager_test.go Covers issuance, rejection, renewal, and unbind behavior.
spec/​rep_windows_template_spec.rb Tests default-off and enabled Windows configuration.
spec/​rep_template_spec.rb Tests default-off and enabled Linux configuration.
jobs/​rep/​templates/​rep.json.erb Renders the Linux feature gate.
jobs/​rep/​spec Declares the default-off Linux property.
jobs/​rep_windows/​templates/​rep.json.erb Renders the Windows feature gate.
jobs/​rep_windows/​spec Declares the default-off Windows property.
docs/​072-service-account-identity.md Documents the contract, rollout requirements, lifecycle, and dependency provenance.

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants