Skip to content

Lesson 9 of 12 · 16m

Workload Identity and SSH CAs

Attested, short-lived certificates — SPIFFE SVIDs, OIDC workload identity, SSH certs signed for hours — replace stored machine credentials entirely.

Every mechanism so far manages a stored secret better. Workload identity asks why a stored secret exists at all. A Kubernetes pod already owns a signed identity: its service account token is an OIDC JWT, projected into the pod, audience-bound, auto-rotated. EKS IRSA, GKE Workload Identity, and Azure managed identity each let that token assume cloud roles directly — the pod proves what it is, the cloud mints short-lived access, and no AWS key ever exists to leak. The cloud equivalent of the CI OIDC lesson: the token is the credential.

SPIFFE and SPIRE: identity as a minted artifact

SPIFFE standardizes the ID — spiffe://prod.example.org/payments/api — and the SVID that carries it: an X.509 certificate or JWT with a TTL measured in minutes to hours. SPIRE runs the machinery: a server plus an agent per node. The agent attests the workload — this process runs on this node, in this namespace, under this service account, verified against the kubelet's pod API or the instance's metadata service — then mints an SVID signed by the SPIRE server's CA. The workload never sees a password; it gets a document that already says who it is and when it stops being believed. mTLS between services carries the identity; there is nothing sitting on disk for an attacker to lift, and nothing to rotate because credentials die before they rot. Envoy and the SPIFFE libraries consume SVIDs natively; service meshes built on this pattern are what killed the service-to-service API key as a design choice.

SSH certificate authorities

The same idea on the host side. The sprawl everyone knows: authorized_keys files drift across forty servers, ex-contractor keys survive their contracts, nobody knows which laptop id_ed25519 came from. A user CA reverses the flow:

ssh-keygen -s ca_user_key -I deploy-2026-11-16   -n deploy,ops -V +4h -z 1042 id_ed25519.pub

That signs the user's public key into a certificate valid for four hours and only for principals deploy and ops. Servers list TrustedUserCAKeys /etc/ssh/ca_user_key.pub in sshd_config — one line, every host, forever. Access is granted by signing a cert with the right principals and a short -V, not by editing files on each box. Expiry is built in: at +4h the cert stops working without any revocation infrastructure. Vault's ssh secrets engine and Smallstep's step-ca both expose signing as an authenticated API, so your SSO login becomes the approval step for host access.

Host certs work symmetrically — sign each server's host key under a host CA, distribute @cert-authority lines in known_hosts, and TOFU key prompts disappear: ssh user@host either verifies against the CA or fails, no fingerprint squinting.

Two operational details. The -I key ID and -z serial land in the server's auth log for every login — cert-based access gives you a per-login audit trail keyed to a request ID for free. And for the rare emergency before expiry, RevokedKeys files and KRLs (ssh-keygen -k) revoke certs explicitly — you rarely need either, because a four-hour certificate usually expires faster than you can revoke it.

The wrong mental model

"Machine identity = distribute public keys / store IAM keys somewhere safe." Distribution and storage are the problem. Attestation replaces them: the workload proves itself, gets a document that expires, and uses it. Revocation stops being a hunt — you deny the signing, or wait four hours.

Concrete practice

  • EKS/GKE/Azure: federate service accounts to cloud roles; delete the IAM users CI and pods used to need.
  • SPIRE (or managed workload identity) for service-to-service: SVIDs + mTLS, no shared API keys.
  • SSH: one user CA, TrustedUserCAKeys everywhere, certs scoped by principal and hours-long validity; Vault ssh engine or step-ca fronts the CA key.
  • Keep the CA private key offline or in a KMS/HSM; it signs everything, it protects everything.

A credential that expires in four hours is a credential you never rotate and rarely revoke.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.