feat(spiffe): SPIFFE Agent sidecar + rep socket wiring (RFC UAA-SPIFFE-001)#1161
Draft
rkoster wants to merge 14 commits into
Draft
feat(spiffe): SPIFFE Agent sidecar + rep socket wiring (RFC UAA-SPIFFE-001)#1161rkoster wants to merge 14 commits into
rkoster wants to merge 14 commits into
Conversation
Introduce the SPIFFE Agent sidecar that runs on Diego cells and serves JWT-SVIDs to workloads over the SPIFFE Workload API. The agent attests local CF containers via SO_PEERCRED, resolves identity from BBS, and exchanges instance certificates for SVIDs at the UAA signer endpoint using RSA proof-of-possession. Daemon lives inline at src/code.cloudfoundry.org/spiffe-agent (config, cfattestor, bbsresolver, signer, workloadapi, cmd) with a BOSH job and package. Pulls in go-spiffe v2.8.1 as a top-level dependency.
…ng partial vendor" This reverts commit b9e86cc.
UAA's JwtSvidResponse serializes expires_at as a JSON number (Java long), but the signer decoded it as a string, breaking unmarshalling of the sign response. Decode as int64. The value is informational only; callers read expiry from the SVID's own exp claim.
The executor bind-mounts the SPIFFE socket dir read-only into every app container. App containers run as an unprivileged, user-namespaced uid that is neither the directory owner nor in its group, so the directory must be world-traversable (o+x) to reach the 0666 socket. Create it 0711 (withholding read) when diego.executor.spiffe_socket_dir is set.
Pull in the executor SPIFFE socket credential handler that bind-mounts the spiffe-agent Workload API socket into app containers and injects SPIFFE_ENDPOINT_SOCKET. Depends on the cloudfoundry/executor spiffe-socket-handler branch.
Implement the Workload API FetchJWTBundles RPC so standard SPIFFE clients (go-spiffe JWTSource, spire-agent) can obtain the JWT trust bundle for offline JWT-SVID validation. A new signer.BundleSource fetches UAA's token_keys JWKS and publishes it keyed by the trust domain SPIFFE ID. The server streams the current bundle immediately, then polls token_keys at a refresh interval and re-sends only when the bundle changes, supporting signing-key rotation. The endpoint requires the SPIFFE security header but performs no peer attestation, since trust bundles are public.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Integrates the SPIFFE Agent sidecar (Plan B1) into diego-release and wires
rep/executor so CF app containers can obtain UAA-signed JWT-SVIDs.
Key changes
spiffe-agentdaemon (src/code.cloudfoundry.org/spiffe-agent/) — a newper-cell sidecar implementing the SPIFFE Workload API (
FetchJWTSVID). Itattests workloads from their instance-identity cert + BBS metadata and proxies
signing requests to UAA's
/jwt-svid/signendpoint.diego.executor.spiffe_socket_dirproperty;setup_mounted_data_dirscreates the shared socket directory
0711(world-traversable, no read) souser-namespaced app containers can reach the socket.
spiffe-socket-handlerbranch(cloudfoundry/executor) that bind-mounts the socket into app containers.
expires_atas a numeric epoch; socket-dir perms.Context
Part of RFC UAA-SPIFFE-001 — UAA as a SPIFFE Identity Server for Cloud Foundry.
Cross-repo dependencies
spiffe-socket-handler(vendored here)spiffe-signer— the JWT-SVID signing endpointspiffe-signer— exposes theuaa.spiffe.*propertiesStatus
Draft / POC. End-to-end verified on bosh-lite: a test app fetched a valid JWT-SVID
over the injected Workload API socket.