Ku bood nuxurka
Korur

Zero trust as an architecture, after NIST 800-207

PDP and PEP placement, decision lifetime, SPIFFE workload identity from SO_PEERCRED up, and what mutual TLS 1.3 hides on the wire, with a lab.

NIST SP 800-207 is a short document with a precise claim, and most of what is sold under its name ignores the claim. The claim is about placement. Every access decision is made by a policy decision point and carried out by a policy enforcement point, everything behind that enforcement point is an implicit trust zone, and zero trust is the discipline of making those zones as small as possible by moving the decision and the enforcement next to the resource1. Nothing in that definition names a product, and nothing in it says the network stops mattering.

This article reads 800-207 as an engineer would read a protocol specification: which component holds which state, what crosses the wire between them, and where a decision can go stale. The argument I want to make is that real deployments rarely fail on policy. They fail on binding: the credential the enforcement point checks is not tightly tied to the subject the decision point judged, or the decision outlives the facts it was based on. The sections follow that argument from the model, through BeyondCorp, to token lifetime, to workload identity rooted in kernel socket state, and down to the bytes of a mutual TLS 1.3 handshake, with a lab that needs no root and no cluster.

What 800-207 actually specifies

The publication, by Rose, Borchert, Mitchell and Connelly, dates from August 20201. Its abstract model splits the policy decision point into two logical components. The policy engine (PE) makes the grant, deny or revoke decision by feeding enterprise policy and external signals into a trust algorithm, and it logs the decision. The policy administrator (PA) executes it: it establishes or shuts down the communication path by commanding enforcement points, and it may generate the session-specific token or credential the client uses. The policy enforcement point (PEP) enables, monitors and terminates the connection between subject and resource, and it may be split into a client-side agent and a resource-side gateway1.

The document's own analogy is airport screening: everyone who has passed the checkpoint mills about the boarding area and is trusted to the level of the last check. The PEP cannot apply policy beyond its position in the flow, so the only way to make decisions specific is to shrink the zone behind it1. Every design choice that follows is therefore a choice about where the PEP sits and how much sits behind it. A VPN concentrator in front of a flat network is a PEP with an enormous implicit trust zone. A sidecar in front of a single service is a PEP with a zone the size of one process. Both satisfy the vocabulary; only the second satisfies the intent.

Section 3.4.1, which lists the network requirements to support a ZTA, adds a structural requirement that is easy to read past. Requirements 5 and 7 say that control traffic between PE, PA and PEP runs on a control plane that is logically separate from the data plane carrying application traffic, and that the PEP is the only component that talks to the PA as part of a business flow1. In other words, the decision path is itself an asset with its own trust boundary. Requirement 4 of the same list says enterprise resources should not be reachable without going through a PEP at all, which is the requirement most retrofits quietly fail, because the old network path to the resource still exists next to the new one.

The trust algorithm is a state machine with memory

The PE's trust algorithm takes five classes of input: the access request itself, the subject database, the asset database with the observed state of the requesting device, the resource's own requirements, and threat intelligence1. 800-207 then classifies algorithms on two axes. A criteria-based algorithm grants only if every configured attribute is met; a score-based one computes a weighted confidence and compares it with a per-resource threshold. A singular algorithm evaluates each request alone; a contextual one keeps the subject's recent history and can see a valid account behaving unlike itself. The document states plainly that a contextual algorithm is the ideal, and that it obliges the PE to keep state on every subject and to be told about behaviour by the PA and the PEPs1.

That obligation is the part vendors underplay. A contextual PE is a stateful service on the critical path of every session, fed by telemetry from every enforcement point. Its failure modes are those of any stateful distributed system: stale replicas, partitions, and the question of what an enforcement point does when the PE is unreachable. 800-207 lists denial of service against the PE or PA, and subversion of the decision process by anyone who can edit the PE's rules, as threats specific to the architecture1. In a design review I would take those two threats first, because every other control depends on the PE answering correctly.

800-207 components and the deployed examples discussed in this article
800-207 componentResponsibilityBeyondCorp (2016 terms)Examples in this article
Policy engineDecide and log grant, deny, revokeAccess Control Engine with Trust Inferer outputEntra ID Conditional Access evaluation; Keycloak at the token endpoint
Policy administratorOpen and close paths; mint session credentialsPrecomputed decisions pushed to gatewaysToken issuance; CAE revocation events; SVID issuance
Policy enforcement pointAdmit, monitor, terminate sessionsGateways: web proxies, SSH servers, 802.1x networksA resource server validating a bound token; an mTLS-terminating proxy
Asset databaseObserved device stateDevice Inventory ServiceKubernetes pod and node objects behind a pod-bound token

BeyondCorp as the reference implementation

Google's BeyondCorp predates 800-207 and is the most complete public description of the model actually running. The 2014 paper by Ward and Beyer describes the moving parts2. Each managed device carries a device certificate, issued only if the device is present and correct in the Device Inventory Database and stored in a hardware or software TPM or a qualified certificate store. The paper is careful about what the certificate means: it uniquely identifies the device but does not by itself grant anything; it is a key into a set of information about the device. Users authenticate to an SSO system that issues short-lived tokens. Inside Google buildings, clients join an unprivileged network that reaches only the internet, limited infrastructure services such as DNS, DHCP and NTP, and configuration management, assigned by RADIUS after an 802.1x handshake in which the device presents its certificate. Applications are published through an internet-facing access proxy, registered in public DNS as CNAMEs pointing at it, and an Access Control Engine inside the proxy authorizes each request against user, group, device certificate and inventory data2.

The 2016 follow-up by Osborn, McWilliams, Beyer and Saltonstall is the more useful paper for an engineer, because it describes the pipeline rather than the boxes3. A Trust Inferer continuously evaluates device state and assigns each device a maximum trust tier; each resource carries a minimum tier, and access requires the device tier to be equal or greater. The Access Control Engine is a centralized service referenced by every gateway and returns a binary decision. Trust evaluation is largely precomputed before any request arrives, which the authors credit with less data pushed to the gateways, a consistent data set at every enforcement gateway, and a framework for testing and canarying policy changes. They report that the latency between a state change and gateway enforcement is typically under a second, and they name the limit of precomputation directly: some inputs, such as real-time second-factor checks, are not available ahead of the request3.

My reading of both papers is that the proxy is the least interesting part. The hard engineering is the inventory: merging records from asset systems, certificate authorities and network databases that disagree about what a device even is, which the 2016 paper describes in uncomfortable detail3. An organisation that buys an access proxy without an authoritative device inventory has bought an enforcement point with nothing trustworthy to enforce.

Decision lifetime: a token is a cached decision

In a request-per-decision world the PE would be consulted for every packet. Nobody builds that. Real systems cache the decision as a credential, an access token or a certificate, and the enforcement point validates the credential locally. The validity window of that credential is the window during which the PEP enforces a decision the PE might no longer make. Tenet 6 of 800-207 asks for authentication and authorization that are dynamic and strictly enforced, with continual reevaluation during the session1. Reconciling that tenet with a cached credential is the central engineering problem of a zero trust deployment.

Microsoft Entra ID's continuous access evaluation (CAE) is a clear example of how a PA can withdraw a decision without waiting for expiry. Without CAE, access tokens are valid for one hour by default. With a CAE-capable client and resource, token lifetime grows to as much as 28 hours, and revocation is driven by events instead of the clock4. The resource provider subscribes to critical events (account deleted or disabled, password changed or reset, MFA enabled for the user, an administrator revoking all refresh tokens, high user risk detected) and synchronises IP-based Conditional Access location policies to evaluate locally. Microsoft documents the latency: critical events can take up to 15 minutes to propagate, IP location enforcement is instant, and Conditional Access policy or group membership changes can take up to one day to reach resource providers4.

The wire protocol for the withdrawal is a claims challenge, the same envelope Entra uses for Conditional Access step-up. The resource answers 401 Unauthorized with a www-authenticate header whose error is insufficient_claims and whose claims parameter is a base64-encoded claims request; the client must drop its cached token and return to the authorization endpoint with that claims request5. What the claims request asks for depends on the cause. For a step-up the generic example requests an acrs authentication context value; for a CAE revocation or an IP change, Microsoft's example for CAE-enabled APIs requests an essential nbf claim, that is, a freshly issued token6. A client only receives such challenges after declaring the capability cp1, which it does by sending xms_cc in its own claims request5.

CAE claims challenge example, verbatim from the Microsoft documentation for CAE-enabled APIs; the base64-decoded claims value below it is added by this articletext
// Line breaks for legibility only

HTTP 401; Unauthorized

Bearer authorization_uri="https://login.windows.net/common/oauth2/authorize",
  error="insufficient_claims",
  claims="eyJhY2Nlc3NfdG9rZW4iOnsibmJmIjp7ImVzc2VudGlhbCI6dHJ1ZSwgInZhbHVlIjoiMTYwNDEwNjY1MSJ9fX0="

claims, base64-decoded:
{"access_token":{"nbf":{"essential":true, "value":"1604106651"}}}

Read as a state machine, CAE trades a short fixed lifetime for a long lifetime plus a revocation channel, and the security of the trade depends entirely on the channel. Two documented limits matter in design. When the IP ranges across location policies exceed 5,000, CAE can no longer enforce location changes in real time and issues a one-hour CAE token: critical-event revocation still applies, only real-time location enforcement is lost; and when the identity provider and the resource see different egress addresses, Entra may issue a one-hour token that suspends IP checks at the resource4. Both are network-topology facts leaking into the policy plane, which is exactly what 800-207 predicts when it says the enterprise must still observe its network1.

Kubernetes makes the same trade for workloads. A projected service account token is a JWT whose kubernetes.io claim names the namespace, the pod and its UID, the service account and its UID, and the node; the kubelet requests and rotates it, refreshing when the token is older than 80 percent of its TTL or older than 24 hours7. The revocation channel is the API server itself: when a bound token is presented to the kube-apiserver, its service account authenticator rejects it once the pod no longer exists or its UID no longer matches, and for an object pending deletion from 60 seconds after metadata.deletionTimestamp8. That check runs only where the kube-apiserver is the verifier, directly or through a TokenReview. Through service account issuer discovery the API server also publishes /.well-known/openid-configuration and a JWKS at /openid/v1/jwks, so external relying parties can validate the token's signature themselves9. Such an offline verifier, an Entra workload identity federation, a Vault role or any OIDC library, sees a valid signature after the pod is gone and honours the token until exp. For federated use the token's exp is the real withdrawal window, and it is often not the lifetime the pod asked for. The kube-api-access volume that the ServiceAccount admission controller injects by default requests expirationSeconds: 36078, but while the kube-apiserver flag --service-account-extend-token-expiration is true, which is its default, admission-injected tokens are extended up to one year, ignoring --service-account-max-token-expiration10. An offline verifier can therefore accept the default pod token for up to a year after the pod is gone. Only a token the pod requests through its own projected volume, with its own audience and expirationSeconds, keeps the requested lifetime, which the issuer caps at --service-account-max-token-expiration10. The documentation also notes that the node information embedded in the token is not verified by the API server when the token is used8. That last detail is worth remembering when someone proposes to authorize on it.

How three credentials cache a decision, per the cited documentation
CredentialLifetimeWithdrawal pathBound to
Entra ID access token, no CAEOne hour by default4Expiry; refresh re-evaluates policyBearer: whoever holds it
Entra ID access token, CAE sessionUp to 28 hours4Critical events, up to 15 minutes; IP policy instantBearer, plus location checks at the resource
Kubernetes pod-bound service account tokenAdmission-injected default token: extended up to one year while --service-account-extend-token-expiration is true, the default; a token the pod projects itself: its requested expirationSeconds, capped at --service-account-max-token-expiration10; kubelet rotates at 80 percent of TTL or 24 hours7kube-apiserver, directly or through TokenReview, rejects once the pod is gone or 60 seconds after metadata.deletionTimestamp8, which for a pod is the end of its grace period11; an offline verifier using issuer discovery accepts it until exp9Pod name and UID, service account, audience

Identity as the perimeter for people: bearer versus bound

A bearer token is a decision that anyone holding it can replay. That is acceptable inside a short window and a confidential channel, and it is the weakest link when the token leaves the device it was issued to. The fix in the OAuth world is sender-constrained tokens: the PA binds the decision to a key, and the PEP checks possession of that key on every request. The binding uses the cnf (confirmation) claim from RFC 780012, and there are two standard ways to fill it.

RFC 8705 binds the token to the client's TLS certificate. When the client uses mutual TLS on its connection to the token endpoint, the authorization server writes cnf with an x5t#S256 member: the base64url-encoded SHA-256 hash of the DER encoding of the client certificate, with trailing padding removed. The resource server must then require mutual TLS with the same certificate and compare the hash of the certificate its TLS stack saw against the token13. Section 4 of the RFC keeps binding and client authentication apart: certificate-bound tokens work without mutual-TLS client authentication, so a public client that cannot authenticate at all can still obtain a token bound to a key it has proven it holds13. For PKI-based client authentication, the client registration names exactly one expected subject value: a subject DN, or a DNS, URI, IP or email SAN13. That last option is how a SPIFFE ID, which lives in a URI SAN, can be the client identity at an OAuth server.

A certificate-bound JWT claims set, as in RFC 8705 Figure 2json
{
  "iss": "https://server.example.com",
  "sub": "[email protected]",
  "exp": 1493726400,
  "nbf": 1493722800,
  "cnf": {
    "x5t#S256": "bwcK0esc3ACC3DB2Y5_lESsXE8o9ltc05O89jdN-dg2"
  }
}

RFC 8705 contains a sentence that every architect should read before choosing it. The resource server must know in advance that mutual TLS is needed, because the access token is application data, available only after the handshake, while the server's CertificateRequest happens during the handshake. The token cannot decide whether to ask for a certificate13. In practice that means separate hostnames or ports for mTLS-protected resources, which is a network design decision forced by a protocol ordering.

RFC 9449 (DPoP) moves the proof into HTTP. The client generates a key pair, and for every request it sends a DPoP header carrying a JWT of type dpop+jwt whose header holds the public key and whose claims include a unique jti, the HTTP method htm, the target URI htu, the creation time iat, and, when presenting an access token, ath, a hash of that token. The token's cnf carries jkt, the JWK SHA-256 thumbprint of the key. Servers can force freshness with a DPoP-Nonce header14. DPoP needs no TLS client certificate, which makes it the practical choice for browser and mobile clients, at the cost of a signature per request.

Keycloak implements both. Its server administration guide for 26.8.2 documents a client switch named OAuth 2.0 Mutual TLS Certificate Bound Access Tokens Enabled, which binds access and refresh tokens to the certificate presented in the handshake and verifies the sender on refresh, and an X509 Certificate client authenticator that checks the client certificate's subject DN and the subject DN of the issuing root CA15. The guide gives the reason for the CA check: the mTLS trust store is shared by all realms, so pinning the issuing CA keeps one realm's CA from vouching for another realm's clients. It also notes that a certificate-bound token cannot be used as the subject_token in standard token exchange, and that regex matching of the subject DN is deprecated15. Keycloak's DPoP guide adds that DPoP is not supported for flows that issue access tokens in the front channel, implicit and hybrid, and that such requests are rejected when a client requires DPoP-bound tokens16.

Korur runs Entra ID and Keycloak as identity providers, and their configuration, together with Cloudflare's, lives in Terraform that goes through review before it reaches the provider. I mention it because the binding settings above are exactly the kind of switch that drifts when it is clicked in a console: a client that loses its certificate binding still works, it just silently becomes a bearer client again. Nothing in the user experience reveals the downgrade, so the only reliable control is a diff.

Workload identity from the kernel up

Service-to-service traffic has no person to run MFA, so the subject is the workload and the question becomes how a workload proves what it is. SPIFFE answers it in three layers: a name, a document carrying the name, and an API that hands documents only to the right process.

The name and the documents

A SPIFFE ID is a URI of the form spiffe://trust-domain/path. The trust domain must be lowercase and limited to letters, digits, dots, dashes and underscores; the path may not contain percent-encoding, empty segments, . or .., or a trailing slash; queries, fragments, ports and userinfo are forbidden. Implementations must accept IDs up to 2048 bytes, and the trust domain is capped at 255 bytes by RFC 3986's host limit17. The path's meaning is left to the operator, and the specification warns that any assertion placed in an SVID stays valid for the SVID's lifetime, so volatile attributes do not belong in it17.

An X.509-SVID carries the ID as a URI SAN. The rules are strict on purpose: a leaf must contain exactly one URI SAN, and validators must reject an SVID with more than one; a leaf must have cA false, a critical key usage with digitalSignature and without keyCertSign or cRLSign; if extended key usage is present, both id-kp-serverAuth and id-kp-clientAuth must be set; a signing certificate must have cA true and must not be used for authentication. Signing certificates may carry URI name constraints to limit a compromised CA to its trust domain, but the specification only permits them (MAY) and urges caution: support for URI name constraints is rare, and libraries without it reject such certificates, so path validation fails for every leaf under the constrained CA, legitimate ones included18. Because the specification only permits name constraints, a validator cannot assume that a signing CA carries one. Citing that lack of widespread support, the Workload API specification requires the authenticator to choose the bundle of the trust domain the peer presents, and treats a peer with no matching bundle as untrusted, so a CA from one domain is never asked to vouch for an ID in another19.

A JWT-SVID carries the ID in sub, must carry aud and exp, and validators must reject a token whose audience list does not contain their own value. The specification is blunt about the weakness: a token with audiences Bob and Chuck, presented to Chuck, lets Chuck impersonate the holder to Bob, so single-audience tokens are strongly recommended20. I would go further and treat a multi-audience JWT-SVID as a design defect: the convenience of one token for two services costs the isolation between them.

Attestation: who is on the other end of the socket

The SPIFFE Workload Endpoint has no client authentication at all. The specification says so, and asks implementations to identify callers out of band, giving kernel introspection of socket state as an example. It MUST be served over gRPC, and implementations SHOULD prefer a Unix domain socket; TCP is permitted only where the network lets the server strongly authenticate the caller, for example by source address. The client locates it through SPIFFE_ENDPOINT_SOCKET, and every request must carry the metadata workload.spiffe.io: true, a guard against server-side request forgery, since an SSRF bug rarely lets the attacker set gRPC metadata21. FetchX509SVID is a server stream: the server pushes a complete new set of SVIDs and bundles whenever they change, and section 4.4 governs what a client does with a later message. Where a field arrives set to its default or empty value, clients MUST interpret it that way, and previously received non-empty values MUST NOT be retained; where data is simply absent from a message, clients SHOULD interpret the absence as a redaction, the specification's example being a bundle that SHOULD then be unloaded19. That stream is the PA's revocation channel for workloads, and how strongly it revokes depends on which path a withdrawal takes. svids is a mandatory field that MUST contain one or more X509SVID messages, and every field of X509SVID except hint is mandatory, bundle included (section 5.2.1). A message that leaves either of them empty is therefore malformed rather than a withdrawal: section 4.5 says the client SHOULD report an error and discard it. Withdrawing every SVID is signalled instead by the gRPC status PermissionDenied, and for that case, as for one SVID dropped from a later response, the client SHOULD cease using the redacted SVIDs (section 5.2.1). The MUST of section 4.4 binds only when an optional field, such as federated_bundles or crl, arrives empty19. For the workload's own SVIDs every withdrawal is therefore SHOULD-level: the workload's SPIFFE library, not the specification, decides whether a revoked SVID stops being used before it expires.

The out-of-band check is where the kernel enters. For AF_UNIX stream sockets Linux records the peer's identity when the connection is made. In Linux v6.12, unix_stream_connect() in net/unix/af_unix.c calls init_peercred(newsk) on the server-side socket it creates for the connection, which stores get_pid(task_tgid(current)) in sk->sk_peer_pid and get_current_cred() in sk->sk_peer_cred; the listener's own credentials are captured by update_peercred() in unix_listen() and copied to the client with copy_peercred()22. getsockopt(SO_PEERCRED) reads those fields in sk_getsockopt() in net/core/sock.c under sk_peer_lock23. The unix(7) page states the consequence: the credentials returned are those in effect at the time of connect(2), listen(2) or socketpair(2)24. The caller cannot forge them, because it never writes them.

SPIRE, the reference SPIFFE implementation, uses exactly this. In v1.16.0, getCallerInfoFromFileDescriptor() in pkg/common/peertracker/uds_linux.go calls unix.GetsockoptUcred(fd, SOL_SOCKET, SO_PEERCRED) and keeps PID, UID and GID25. A PID is only a number, and numbers are recycled, so newLinuxWatcher() in tracker_linux.go immediately opens /proc/<pid> and records the process start time; IsAlive() later checks that the directory handle is still readable and that the start time is unchanged, and its comments explain both checks as defence against a PID that died and was reused26. Since Linux 6.5 the kernel offers a cleaner primitive: SO_PEERPIDFD, option 77 in include/uapi/asm-generic/socket.h, which returns a pidfd for sk_peer_pid and therefore refers to the process, not to the number2723.

From a PID, SPIRE's Kubernetes workload attestor derives a pod. With the default container locator in v1.16.0, pkg/common/containerinfo/extract.go reads the pod UID and container ID from /proc/<pid>/cgroup; the agent matches them against the pod list it fetches from the kubelet's /pods endpoint and emits selectors such as sa:, ns: and pod-uid:, which SPIRE then matches against its registration entries to decide which SVIDs the caller may receive2829. The code comment in extract.go states the trust boundary better than most design documents: the cgroup file is controlled by the kernel, so it is authoritative against an unprivileged workload, but a process with root on the node can change cgroup membership, so it does not establish identity against a node-root attacker; and /proc/<pid>/mountinfo is deliberately ignored because the workload's own mount namespace controls it28. That comment marks where workload zero trust ends. The node is inside the implicit trust zone of every workload on it.

What Kubernetes now does natively

Kubernetes v1.37 made pod certificates stable. A pod declares a podCertificate projected volume source naming a signerName, a key type (ED25519, ECDSA P-256, P-384 or P-521, RSA 3072 or 4096) and a maxExpirationSeconds that defaults to 86400 and must lie between 3600 and 7862400; the kubelet generates the key, creates a PodCertificateRequest, writes the credential bundle into the pod, and refreshes it before expiry3031. The request carries the pod name and UID, the service account and the node, and with the NodeRestriction admission plugin enabled a node can only create requests for pods actually running on it. There is no approval phase: the signer's controller issues or denies directly32. The interesting property is that the attestation evidence is now an API object the kubelet created, which the API server and admission plugins can check, where SPIRE's agent has to parse a cgroup path. The signer is still yours to write or choose, and it decides what goes into the URI SAN.

What changes on the wire

Tenet 2 of 800-207 asks that all communication be secured regardless of network location, with confidentiality, integrity and source authentication1. For service traffic that means mutual TLS almost everywhere, and the protocol version decides what a network observer, including a network-layer PEP, can still see.

In TLS 1.2 the client's Certificate message follows ServerHelloDone and precedes ChangeCipherSpec, so it travels in cleartext together with the server's certificate and the CertificateRequest33. In TLS 1.3, everything after ServerHello is protected. EncryptedExtensions, CertificateRequest, both Certificate messages and both CertificateVerify messages are encrypted under keys derived from the handshake traffic secrets34. On the record layer every protected record wears an outer content type of 23 (application_data) and a legacy_record_version of 0x0303; the true type sits inside the encrypted TLSInnerPlaintext, followed by optional zero padding34. The client proves key possession by signing 64 bytes of 0x20, the context string TLS 1.3, client CertificateVerify, a single zero byte and the transcript hash, which binds the signature to this handshake and this role34.

Three consequences follow for a zero trust design. First, a firewall or IDS that once keyed policy on the client certificate seen in transit can no longer do so with TLS 1.3, so identity enforcement has to live in the process that terminates TLS. 800-207 anticipates this in its discussion of network visibility, where it accepts that much traffic will be opaque and that only metadata will be observable1. Second, the server name is still visible in the server_name extension of the ClientHello unless the client uses Encrypted Client Hello, published as RFC 9849 in March 2026, which encrypts the ClientHello under a server public key35. Third, TLS 1.3 forbids renegotiation34, so a server that wants a client certificate after the handshake has to rely on post-handshake authentication, which RFC 8705 explicitly makes no provision for13. Decide at the listener whether a port requires client certificates.

Kernel TLS does not change any of this. The kernel documentation for v6.12 is explicit that only symmetric encryption is handled in the kernel: the application runs the handshake in user space, attaches the tls upper-layer protocol with setsockopt(sock, SOL_TCP, TCP_ULP, "tls", ...), and then installs keys, IVs and record sequence numbers with TLS_TX and TLS_RX36. Peer verification, and therefore the PEP decision, has already happened in user space before the kernel sees a key. kTLS offloads record encryption and adds no enforcement point of its own.

Lab: SVIDs, a passive tap and the peer of a socket

The lab shows the three mechanisms above with stock tools and no root: a name-constrained CA issuing X.509-SVIDs, a passive relay that prints every TLS record header between an mTLS client and server, the RFC 8705 thumbprint, and the kernel's view of who connected to a Unix socket. It was run on Fedora Linux 43, kernel 7.2.13-100.fc43.x86_64, OpenSSL 3.5.9, Python 3.14.8 and systemd 258. Any kernel from 6.5 has SO_PEERPIDFD. Run everything from one directory, for example mkdir -p ~/ztlab && cd ~/ztlab.

Step 1: a trust domain and three SVIDs

The CA carries a critical name constraint permitting only URIs in lab.example. The leaves follow the X.509-SVID profile: CA:FALSE, critical key usage with digitalSignature only, both TLS EKUs, and one URI SAN18. The profile requires the SAN to be marked critical only when the subject is omitted; the lab marks it critical anyway, which is harmless here, where the subject carries only O=ztlab. The third leaf claims an ID in another trust domain, signed by the same CA.

Create the CA and SVIDs, then verify themshell
cat > ca.ext <<'X'
basicConstraints = critical, CA:TRUE, pathlen:0
keyUsage = critical, keyCertSign, cRLSign
subjectAltName = URI:spiffe://lab.example
nameConstraints = critical, permitted;URI:lab.example
X
openssl req -x509 -new -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes \
  -keyout ca.key -out ca.pem -days 1 -subj "/O=ztlab/CN=lab.example CA" \
  -extensions v3 -config <(printf '[req]\ndistinguished_name=dn\n[dn]\n[v3]\n'; cat ca.ext)

svid() {  # svid <name> <spiffe-id>
  openssl req -new -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes \
    -keyout "$1.key" -out "$1.csr" -subj "/O=ztlab"
  printf 'basicConstraints = critical, CA:FALSE\nkeyUsage = critical, digitalSignature\nextendedKeyUsage = serverAuth, clientAuth\nsubjectAltName = critical, URI:%s\n' "$2" > "$1.ext"
  openssl x509 -req -in "$1.csr" -CA ca.pem -CAkey ca.key -days 1 -out "$1.pem" -extfile "$1.ext"
}
svid api   spiffe://lab.example/ns/payments/sa/api
svid web   spiffe://lab.example/ns/web/sa/frontend
svid rogue spiffe://evil.example/ns/web/sa/frontend
openssl verify -CAfile ca.pem api.pem web.pem rogue.pem
Output of the final commandtext
O=ztlab
error 47 at 0 depth lookup: permitted subtree violation
error rogue.pem: verification failed
api.pem: OK
web.pem: OK

OpenSSL enforces the URI name constraint, so the rogue leaf fails path validation even though the CA's signature on it is valid. That is the blast-radius limit the SVID specification describes18. Do not rely on it alone: name constraints are optional, so a validator cannot assume a signing CA carries one, and the Workload API rule of selecting the bundle by trust domain is what keeps their reach inside one domain19.

Step 2: a passive tap that reads only record headers

The tap listens on port 9443, relays to the server on 8443, and parses the five-byte TLS record header (type, version, length) in each direction. For handshake records sent before that direction's ChangeCipherSpec, it also prints the handshake message type from the first body byte. At the end it counts how often the bytes spiffe:// crossed the wire in cleartext. It sees exactly what a network PEP sees.

Write tap.pyshell
cat > tap.py <<'EOF'
# Passive TCP tap: relays 127.0.0.1:9443 -> 127.0.0.1:8443 and prints
# every TLS record header it sees, plus the handshake type of records
# that travel in cleartext.
import socket, sys, threading

HS = {1: "ClientHello", 2: "ServerHello", 4: "NewSessionTicket",
      8: "EncryptedExtensions", 11: "Certificate", 12: "ServerKeyExchange",
      13: "CertificateRequest", 14: "ServerHelloDone", 15: "CertificateVerify",
      16: "ClientKeyExchange", 20: "Finished"}
CT = {20: "change_cipher_spec", 21: "alert", 22: "handshake", 23: "application_data"}

def pump(src, dst, tag, seen):
    buf = b""
    while chunk := src.recv(65536):
        dst.sendall(chunk)
        buf += chunk
        seen[tag] += chunk
        while len(buf) >= 5:
            ctype, ver, length = buf[0], buf[1:3].hex(), int.from_bytes(buf[3:5], "big")
            if len(buf) < 5 + length:
                break
            body, buf = buf[5:5 + length], buf[5 + length:]
            note = ""
            if ctype == 22 and not seen["ccs_" + tag]:
                note = HS.get(body[0], str(body[0]))
            if ctype == 20:
                seen["ccs_" + tag] = True
            print(f"{tag} {CT.get(ctype, ctype):<18} ver=0x{ver} len={length:<5} {note}")
    dst.shutdown(socket.SHUT_WR)

lsock = socket.create_server(("127.0.0.1", 9443))
client, _ = lsock.accept()
server = socket.create_connection(("127.0.0.1", 8443))
seen = {"C>S": b"", "S>C": b"", "ccs_C>S": False, "ccs_S>C": False}
t = [threading.Thread(target=pump, args=(client, server, "C>S", seen)),
     threading.Thread(target=pump, args=(server, client, "S>C", seen))]
[x.start() for x in t]; [x.join() for x in t]
for tag in ("C>S", "S>C"):
    print(tag, "cleartext 'spiffe://' bytes on the wire:", seen[tag].count(b"spiffe://"))
EOF

Step 3: the same mutual TLS session in TLS 1.3 and TLS 1.2

Run an mTLS server that requires a client certificate, the tap, and a client, once per versionshell
for v in tls1_3 tls1_2; do
  echo "=== $v"
  openssl s_server -accept 127.0.0.1:8443 -cert api.pem -key api.key \
    -CAfile ca.pem -Verify 1 -verify_return_error -$v -naccept 1 -www -quiet \
    > server-$v.log 2>&1 & S=$!
  sleep 0.5
  python3 -I tap.py > tap-$v.log & T=$!
  sleep 0.5
  printf 'GET / HTTP/1.0\r\n\r\n' | openssl s_client -connect 127.0.0.1:9443 \
    -servername api.lab.example -cert web.pem -key web.key -CAfile ca.pem \
    -verify_return_error -$v -quiet > client-$v.log 2>&1
  wait $T; wait $S
  cat tap-$v.log
done
Tap output from one run; lengths move by a byte or two between runs because ECDSA signatures vary in DER lengthtext
=== tls1_3
C>S handshake          ver=0x0301 len=1483  ClientHello
S>C handshake          ver=0x0303 len=1210  ServerHello
S>C change_cipher_spec ver=0x0303 len=1
S>C application_data   ver=0x0303 len=23
S>C application_data   ver=0x0303 len=122
S>C application_data   ver=0x0303 len=1018
S>C application_data   ver=0x0303 len=96
S>C application_data   ver=0x0303 len=69
C>S change_cipher_spec ver=0x0303 len=1
C>S application_data   ver=0x0303 len=727
C>S application_data   ver=0x0303 len=97
C>S application_data   ver=0x0303 len=69
C>S application_data   ver=0x0303 len=35
S>C application_data   ver=0x0303 len=762
S>C application_data   ver=0x0303 len=762
S>C application_data   ver=0x0303 len=7334
S>C application_data   ver=0x0303 len=19
C>S application_data   ver=0x0303 len=19
C>S cleartext 'spiffe://' bytes on the wire: 0
S>C cleartext 'spiffe://' bytes on the wire: 0
=== tls1_2
C>S handshake          ver=0x0301 len=210   ClientHello
S>C handshake          ver=0x0303 len=65    ServerHello
S>C handshake          ver=0x0303 len=996   Certificate
S>C handshake          ver=0x0303 len=115   ServerKeyExchange
S>C handshake          ver=0x0303 len=88    CertificateRequest
S>C handshake          ver=0x0303 len=4     ServerHelloDone
C>S handshake          ver=0x0303 len=996   Certificate
C>S handshake          ver=0x0303 len=37    ClientKeyExchange
C>S handshake          ver=0x0303 len=79    CertificateVerify
C>S change_cipher_spec ver=0x0303 len=1
C>S handshake          ver=0x0303 len=40
S>C handshake          ver=0x0303 len=682   NewSessionTicket
S>C change_cipher_spec ver=0x0303 len=1
S>C handshake          ver=0x0303 len=40
C>S application_data   ver=0x0303 len=42
S>C application_data   ver=0x0303 len=7761
S>C alert              ver=0x0303 len=26
C>S alert              ver=0x0303 len=26
C>S cleartext 'spiffe://' bytes on the wire: 2
S>C cleartext 'spiffe://' bytes on the wire: 2

In TLS 1.2 the tap names every handshake message, including the client's Certificate, and finds spiffe:// twice in each direction: OpenSSL sends the leaf and the CA certificate, and both carry a SPIFFE URI SAN. Anyone on the path learns which workload called which. In TLS 1.3 the tap can name only ClientHello and ServerHello; after the compatibility change_cipher_spec record, which RFC 8446 keeps for middleboxes, everything is type 23 and no SPIFFE ID crosses in cleartext. Appendix D.4 of RFC 8446 describes that compatibility mode as making the TLS 1.3 handshake look more like TLS 1.2 to misbehaving middleboxes34.

The lengths still talk. To see what the encrypted records hold, connect once more directly to the server, without the tap, and let s_client print the handshake messages it decrypts.

Decrypted handshake trace of one TLS 1.3 session with the same certificatesshell
openssl s_server -accept 127.0.0.1:8443 -cert api.pem -key api.key \
  -CAfile ca.pem -Verify 1 -verify_return_error -tls1_3 -naccept 1 -www -quiet \
  > /dev/null 2>&1 &
sleep 0.5
printf 'GET / HTTP/1.0\r\n\r\n' | openssl s_client -connect 127.0.0.1:8443 \
  -cert web.pem -key web.key -CAfile ca.pem -verify_return_error -tls1_3 -msg 2>&1 \
  | grep -E 'Handshake \[|Negotiated TLS1.3 group'
wait
Output; lengths are hexadecimal and include the four-byte handshake headertext
>>> TLS 1.3, Handshake [length 05b3], ClientHello
<<< TLS 1.3, Handshake [length 04ba], ServerHello
<<< TLS 1.3, Handshake [length 0006], EncryptedExtensions
<<< TLS 1.3, Handshake [length 0069], CertificateRequest
<<< TLS 1.3, Handshake [length 03e9], Certificate
<<< TLS 1.3, Handshake [length 004f], CertificateVerify
<<< TLS 1.3, Handshake [length 0034], Finished
>>> TLS 1.3, Handshake [length 02c6], CompressedCertificate
>>> TLS 1.3, Handshake [length 004f], CertificateVerify
>>> TLS 1.3, Handshake [length 0034], Finished
Negotiated TLS1.3 group: X25519MLKEM768

With the AES-GCM suite OpenSSL negotiated here, each protected record is its plaintext plus one inner content-type byte plus a 16-byte tag, so the tap's lengths are the trace's lengths plus 17. EncryptedExtensions is 6 bytes in a 23-byte record, CertificateRequest 105 in 122, the server Certificate 1,001 in 1,018 and Finished 52 in 69. The client sent its certificate chain as a CompressedCertificate (RFC 8879) of 710 bytes, the 727-byte record in the tap37. The 35-byte client record is the 18-byte GET / HTTP/1.0 request plus 17, and the 19-byte records are two-byte alerts plus 17. With the certificates from Step 1 held fixed, only the two CertificateVerify records of the TLS 1.3 handshake can move between runs, because each handshake produces a new ECDSA signature and a DER-encoded ECDSA signature can vary in length by a byte or two. In TLS 1.2 the server signs the client and server randoms and its ephemeral ECDH parameters inside ServerKeyExchange33, so that message, like the client's CertificateVerify, carries a fresh signature on every handshake even with the same certificates and can change length by a byte or two between runs. Only regenerating the certificates shifts the Certificate lengths, so a rerun of Step 1 will not reproduce these numbers exactly. A passive observer cannot read the client's identity, but it can tell that a client certificate of about that size was sent. TLS 1.3 allows zero padding inside TLSInnerPlaintext for exactly this reason34; the lab's stack did not pad. The trace also reports the negotiated group as X25519MLKEM768, a hybrid post-quantum key exchange, which is why the ClientHello and ServerHello are each well over a kilobyte.

Step 4: the RFC 8705 thumbprint

Compute the x5t#S256 value an authorization server would place in cnf for web.pemshell
openssl x509 -in web.pem -outform DER | openssl dgst -sha256 -binary | basenc --base64url | tr -d '='

The run above printed 7-DoXhprezYmr_bhYNQj2Yp9niutKDv95OaolK6N0YQ; yours will differ because the key is fresh. This is the comparison a resource server performs on every request carrying a certificate-bound token: hash the DER certificate the TLS stack authenticated, base64url it without padding, and compare it to cnf.x5t#S25613. If your API gateway terminates mTLS and forwards the request to the service, the service cannot perform that comparison unless the gateway passes the authenticated certificate through, and the gateway has become the PEP whether you planned it or not.

Step 5: what the kernel says about a Unix socket peer

This listener behaves like a workload endpoint's first step. It accepts one connection, reads SO_PEERCRED and SO_PEERPIDFD, reads the caller's start time, executable and cgroup from /proc, waits for the caller to exit, and then probes the pidfd.

Write peer.py, start it, and connect from a process placed in its own systemd scopeshell
cat > peer.py <<'EOF'
# Workload-endpoint style UDS listener: who is calling, per the kernel?
import os, signal, socket, struct, time

SO_PEERPIDFD = 77  # include/uapi/asm-generic/socket.h, Linux 6.5+
path = "/tmp/ztlab-peer.sock"
if os.path.exists(path):
    os.unlink(path)
srv = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
srv.bind(path)
srv.listen(1)
conn, _ = srv.accept()
pid, uid, gid = struct.unpack("3i", conn.getsockopt(
    socket.SOL_SOCKET, socket.SO_PEERCRED, struct.calcsize("3i")))
pidfd = struct.unpack("i", conn.getsockopt(socket.SOL_SOCKET, SO_PEERPIDFD, 4))[0]
with open(f"/proc/{pid}/stat") as f:
    starttime = f.read().rsplit(")", 1)[1].split()[19]  # field 22
print(f"SO_PEERCRED pid={pid} uid={uid} gid={gid} starttime={starttime}")
print("exe:", os.readlink(f"/proc/{pid}/exe"))
print("cgroup:", open(f"/proc/{pid}/cgroup").read().strip())
conn.recv(1)  # wait until the client closes and exits
time.sleep(0.2)
try:
    signal.pidfd_send_signal(pidfd, 0)
    print("pidfd: caller still alive")
except ProcessLookupError:
    print("pidfd: caller has exited; a recycled PID can never match this fd")
EOF
python3 -I peer.py & sleep 0.5
systemd-run --user --scope --quiet -u ztlab-client python3 -I -c \
  "import socket,time;s=socket.socket(socket.AF_UNIX);s.connect('/tmp/ztlab-peer.sock');time.sleep(1);s.close()"
wait
Output from one run; PID and start time differ per runtext
SO_PEERCRED pid=180272 uid=1000 gid=1000 starttime=440818
exe: /usr/bin/python3.14
cgroup: 0::/user.slice/user-1000.slice/[email protected]/app.slice/ztlab-client.scope
pidfd: caller has exited; a recycled PID can never match this fd

Replace ztlab-client.scope with a kubepods slice containing a pod UID and a 64-hex-digit container ID and you have the input SPIRE's attestor parses29. The pidfd line is the part that matters for correctness. Between accept() and the moment an attestor finishes reading /proc, the caller can exit and its PID can be handed to another process. A pidfd taken from the socket refers to the original process, so the probe fails with ESRCH instead of silently describing a stranger. That is the same race SPIRE's start-time check closes from user space26.

Where the architecture breaks

The decision plane is a single point of compromise by design. 800-207 says that a compromised PA could grant access that would otherwise be refused, that anyone with configuration access to the PE's rules can make unapproved changes, and that the mitigation is configuration that is logged and audited1. I read that as an argument for treating policy as code with review, and for treating the identity provider's administrative roles as more sensitive than any production database credential, because they can mint access to all of them.

Availability inverts. In a perimeter network, losing the VPN concentrator cuts off remote users and leaves the inside working. In a zero trust network, losing the PE or PA can stop resources talking to each other, and 800-207 notes that an operational error at a cloud-hosted policy service could stop an entire enterprise1. Every PEP therefore needs a defined behaviour when the decision plane is unreachable, and there are only two choices: fail closed and accept the outage, or keep enforcing the last cached decision until a bounded expiry. CAE's long-lived tokens and BeyondCorp's precomputed gateway policies are both forms of the second choice, each with a documented propagation delay43.

Binding is only as strong as its weakest hop. A JWT-SVID with two audiences, a gateway that terminates mTLS and forwards a bearer token over plain HTTP to the pod, a Keycloak client whose certificate binding was switched off, a pod-bound token whose node claim someone decided to trust: each turns a holder-of-key design back into a bearer design without anything visibly breaking. The JWT-SVID specification asks for confidentiality on every hop that carries a bearer token, from workload to load balancer and onward20, and that sentence generalises well.

Finally, the node. Every workload attestation scheme discussed here, SPIRE's and Kubernetes' own, trusts the kernel and the kubelet of the node the workload runs on, and SPIRE's source says plainly that cgroup-based identity does not hold against root on the node28. In 800-207's vocabulary the node is an implicit trust zone that cannot be shrunk below one machine. The engineering consequence is that node hardening, short node lifetimes and limiting which workloads share a node belong in the zero trust architecture and its design reviews. On a Kubernetes platform deployed through Argo CD, which workloads may share a node is decided by the node pools, taints, tolerations and affinity rules in the manifests Argo CD applies, so it can be reviewed in Git like any other policy. A design that leaves the question to the scheduler has accepted the widest implicit trust zone the cluster offers.

Tixraacyada

  1. NIST Special Publication 800-207: Zero Trust Architecture (Rose, Borchert, Mitchell, Connelly, August 2020) National Institute of Standards and Technology
  2. BeyondCorp: A New Approach to Enterprise Security (Ward, Beyer), ;login: vol. 39, no. 6, December 2014 USENIX
  3. BeyondCorp: Design to Deployment at Google (Osborn, McWilliams, Beyer, Saltonstall), ;login: Spring 2016 USENIX
  4. Continuous access evaluation in Microsoft Entra Microsoft Learn
  5. Claims challenges, claims requests and client capabilities Microsoft Learn
  6. How to use Continuous Access Evaluation enabled APIs in your applications Microsoft Learn
  7. Configure Service Accounts for Pods: ServiceAccount token volume projection Kubernetes documentation
  8. Managing Service Accounts: bound service account tokens Kubernetes documentation
  9. Configure Service Accounts for Pods: Service account issuer discovery Kubernetes documentation
  10. kube-apiserver command line reference: --service-account-extend-token-expiration and --service-account-max-token-expiration Kubernetes documentation
  11. Kubernetes API reference: ObjectMeta, deletionTimestamp Kubernetes documentation
  12. RFC 7800: Proof-of-Possession Key Semantics for JSON Web Tokens (JWTs) IETF
  13. RFC 8705: OAuth 2.0 Mutual-TLS Client Authentication and Certificate-Bound Access Tokens IETF
  14. RFC 9449: OAuth 2.0 Demonstrating Proof of Possession (DPoP) IETF
  15. Keycloak Server Administration Guide, version 26.8.2 Keycloak
  16. Securing applications with Demonstrating Proof-of-Possession (DPoP) Keycloak
  17. The SPIFFE Identity and Verifiable Identity Document (SPIFFE-ID.md, commit 5d15e3e) SPIFFE project
  18. The X.509 SPIFFE Verifiable Identity Document (X509-SVID.md, commit 5d15e3e) SPIFFE project
  19. The SPIFFE Workload API (SPIFFE_Workload_API.md, commit 5d15e3e) SPIFFE project
  20. The JWT SPIFFE Verifiable Identity Document (JWT-SVID.md, commit 5d15e3e) SPIFFE project
  21. The SPIFFE Workload Endpoint (SPIFFE_Workload_Endpoint.md, commit 5d15e3e) SPIFFE project
  22. net/unix/af_unix.c: init_peercred, update_peercred, copy_peercred, unix_stream_connect (Linux v6.12) Linux kernel source
  23. net/core/sock.c: sk_getsockopt, SO_PEERCRED and SO_PEERPIDFD (Linux v6.12) Linux kernel source
  24. unix(7): sockets for local interprocess communication (man-pages 6.19) Linux man-pages project
  25. pkg/common/peertracker/uds_linux.go: getCallerInfoFromFileDescriptor (SPIRE v1.16.0) SPIRE project
  26. pkg/common/peertracker/tracker_linux.go: newLinuxWatcher and IsAlive (SPIRE v1.16.0) SPIRE project
  27. include/uapi/asm-generic/socket.h: SO_PEERPIDFD (Linux v6.5) Linux kernel source
  28. pkg/common/containerinfo/extract.go: GetPodUIDAndContainerID (SPIRE v1.16.0) SPIRE project
  29. pkg/agent/plugin/workloadattestor/k8s: Kubernetes workload attestor (SPIRE v1.16.0) SPIRE project
  30. Projected Volumes: podCertificate projected volumes Kubernetes documentation
  31. KEP-4317: Pod Certificates Kubernetes enhancements
  32. Certificates and Certificate Signing Requests: PodCertificateRequests Kubernetes documentation
  33. RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2 IETF
  34. RFC 8446: The Transport Layer Security (TLS) Protocol Version 1.3 IETF
  35. RFC 9849: TLS Encrypted Client Hello IETF
  36. Documentation/networking/tls.rst: Kernel TLS (Linux v6.12) Linux kernel documentation
  37. RFC 8879: TLS Certificate Compression IETF

Ma cabbiri karnaa sida aad halkan u timid?

Waxaan isticmaalnaa cookies-ka falanqaynta si aan u aragno bogagga shaqeeya iyo xayeysiiska halkan ku keenay. Haddaad diiddo, degelku si la mid ah ayuu u shaqeeyaa, mana dhigno wax cookies falanqayn ah. Siyaasadda cookies-ka