mTLS & SPIFFE/SPIRE Workload Identity

mTLS handshake mechanics, SPIFFE workload identity, SPIRE attestation, Istio PeerAuthentication, and certificate rotation.

Overview

Overview mTLS (mutual TLS) extends standard TLS so both the client and server present and validate certificates. It provides cryptographic service-to-service identity — neither side can be impersonated without the corresponding private key.

mTLS handshake additions vs TLS: 1. Server sends CertificateRequest after its own Certificate message. 2. Client responds with its certificate and a CertificateVerify (signature over the handshake transcript using its private key). 3. Server validates the client certificate against its trusted CA.

SPIFFE (Secure Production Identity Framework for Everyone): a CNCF standard that defines workload identity. A SPIFFE ID is a URI: spiffe://trust-domain/path (e.g., spiffe://example.com/ns/payments/sa/billing-service). The X.509 certificate encoding a SPIFFE ID is called an SVID (SPIFFE Verifiable Identity Document).

SPIRE (SPIFFE Runtime Environment): the reference implementation. The SPIRE Server is the CA; SPIRE Agents run on each node and attest workloads (by UID, binary hash, Kubernetes service account, or cloud metadata). On attestation, the agent issues a short-lived SVID (typically 1 hour). SVIDs are automatically rotated before expiry.

Istio integration: Istio's control plane (istiod) is a SPIFFE-compatible CA. It issues SVIDs to each Envoy sidecar. PeerAuthentication policy enforces mTLS: STRICT (reject plaintext), PERMISSIVE (allow both — for migration). Authorization policy uses SPIFFE IDs for allow/deny decisions at L7.

Certificate pinning: pins a specific certificate or public key instead of trusting any cert from a CA. More brittle but eliminates CA compromise risk. Used for critical internal APIs.

Key concepts

  • SPIFFE ID
  • SVID
  • SPIRE Agent
  • PeerAuthentication
  • Short-lived certificates

Interview questions

  • How does SPIFFE/SPIRE provide workload identity without secrets or API keys?
  • What is the difference between Istio PERMISSIVE and STRICT mTLS mode, and when do you use each?

Sign up free to read the full topic

More Networking topics

Start free on Cariara · Coding problems · System design studio