Authenticating between services
Each of the printer's workloads now has an identity and short-lived credentials, so the next question is how they use them when they call each other. This lesson follows the order service calling the render service, compares mutual TLS with tokens carried in each request, shows what each proves when a proxy sits in between, and ends with the rule that decides which caller may do what.
One service calls another
When you place an order, the order service asks the render service to build your book. For years, the render service accepted any request that reached its internal network address. While tracing the overnight burst of print jobs, the team finds that the nightly batch job has been calling the render service too, asking it to regenerate files it believed were missing, and then resubmitting every affected book to the print lab. Nobody intended that, and nothing stopped it.
For a long time, network location stood in for identity: a request from inside the private network was trusted. That rule admits every workload on the network, including one that is misconfigured, like the batch job, or one an attacker has taken over. Addresses also change as instances move, and an address says nothing about which service is calling.
The alternative is the one What zero trust changes described for people: authenticate and authorize every call on its own merits, wherever it comes from. Each call between services raises two questions. Does the order service know it is really talking to the render service? And does the render service know the caller is really the order service? Ordinary HTTPSHTTP protected by TLS, so traffic is encrypted and checked for changes while it travels. It protects the connection, but does not prove that the site at the other end is honest. answers only the first, because only the server presents a certificateA signed statement that a public key belongs to a name, such as a website's hostname, for stated purposes and a limited period. A certificate authority signs it, so software that trusts the authority can connect the key to the name..
Mutual TLS between services
In mutual TLS, the client presents a certificate as well as the server, and proves during the handshake that it holds the matching private keyThe half of a key pair that its owner keeps to themselves and uses to create signatures or decrypt data. Anyone who obtains it can act as its owner.. With the workload certificates from Credentials for workloads, each side's identity sits in its certificate's subject alternative name:
Subject Alternative Name:
URI:spiffe://printer.example/prod/orders
Validity:
Not Before: Sep 24 09:00:00 2026 GMT
Not After : Sep 24 10:00:00 2026 GMTAll domains, credentials, and tokens in these examples are fictional. The render service validates the certificate as Validating a certificate describes, with one difference. It checks the chain against the trust bundle of printer.example, the CAAn organization that checks who controls a name and then signs certificates for it. Browsers and other software trust a chosen set of authorities, and through them the certificates those authorities issue. certificates its identity server uses to sign workload certificates, rather than against the public certificate authorities a browser trusts. Then it reads the caller's identity from the URI.
Many organizations do not build this into each service. A service mesh places a small proxy beside every service. The proxies obtain workload certificates, renew them, and wrap every call in mutual TLS, while the services themselves make ordinary calls to their local proxy. The mesh can then pass the verified caller identity to the service, or enforce rules about who may call whom.
Mutual TLS is strong, because the identity is tied to a key that never leaves its machine, and it protects every connection. Its limit is that the identity belongs to the connection. If anything between the two services ends the TLS connection and starts a new one, the far side no longer sees who called.
Tokens at the application layer
The other approach puts the caller's identity in the request itself. The order service attaches a signed tokenA piece of data issued by a trusted service that a client presents as a credential, for example to call an API or to report a sign-in. Some tokens carry readable claims; others are random strings that only the issuer can interpret., either its workload token or an access tokenA token that a client presents to an API to use access it has been granted, usually limited in what it allows and how long it lasts. It authorizes API calls; it does not tell the client who signed in. from an authorization serverIn OAuth, the service that handles a person's sign-in and approval and decides which tokens to issue to a client. It may belong to the same company as the API, but its job is separate., whose audience is the render service:
POST /render-jobs HTTP/1.1
Host: render.printer.example
Authorization: Bearer demo-orders-to-render-token
Content-Type: application/json
{ "order": "book-5561" }The render service checks the token's signatureA value made with a private key that lets anyone holding the matching public key check that a message came from the key's holder and has not been changed. It proves origin and integrity; it does not hide the message. against the trust domain's published keys, confirms that its audience is the render service and that it has not expired, and reads the caller's identity from its subject. Because the token travels with the request, it survives any proxy along the way, and it can carry more than a certificate, such as the customer an order belongs to.
A plain token is a bearer tokenA token that works for whoever presents it: the API checks that the token is genuine and current, not who is holding it. That is why bearer tokens must be kept from being copied., though. A copy captured from a log or a proxy can be replayed to the render service until it expires. Short lifetimes and a single audience limit the damage, and a token can also be bound to a key the caller holds, so a copy is useless without the key: Binding a token to a key did this with a key the client creates, and Certificate-bound access tokens with the client's certificate. Many systems use both approaches together: mutual TLS for every connection, and a token for what each request is about.
When something sits in between
Some of the printer's internal calls, including the order service's, pass through a load balancer, a server that receives requests and spreads them across the running copies of a service. It ends the TLS connection and forwards each request on a new one. If the load balancer checks a client certificate, it must tell the service behind it whom it verified, and usually it adds a header:
POST /render-jobs HTTP/1.1
Host: render.internal.printer.example
X-Client-Identity: spiffe://printer.example/prod/ordersThe render service may trust that header only under two conditions. The request must have arrived over an authenticated connection from the load balancer itself. And the load balancer must remove any copy of the header that arrived from outside. If either condition fails, any caller can send X-Client-Identity naming whichever service it likes. A header is only as trustworthy as whoever last wrote it.
No proxy in between
- Proof
- Client certificate
- Render reads
- prod/orders
- A proxy that ends TLS
- Identity lost with the connection
Caller known for one connection
TLS ends at the balancer
- Proof
- X-Client-Identity header
- Render reads
- Whatever the header names
- A proxy that ends TLS
- Trusted only if copies are stripped
Forged when copies get through
aud = render
- Proof
- Signed token for render
- Render reads
- The token's subject
- A proxy that ends TLS
- Same token arrives
Caller known for each request
A header is only as trustworthy as whoever last wrote it.
A further approach is being developed for requests that pass through proxies like this one, in the IETF WIMSE working group (Workload IdentityAn identity that belongs to software that runs and acts without a person directing each request, such as a service, a scheduled job or a pipeline step. It names the logical workload, not one running copy, and each copy holds its own credential. in Multi System Environments), whose drafts are not yet standards. The calling workload carries a workload identity token and signs a short proof for each request with the private key behind it. The proof covers that particular request, either as a token of its own or as an HTTPThe Hypertext Transfer Protocol, the rules browsers, apps, and servers use to send requests and responses on the web. message signature, a signature over chosen parts of the request such as its method, path and body. The receiver checks the proof itself, however many hops the request took, and a copied token is no use without the key. Until those drafts settle, the choice in practice is the one in the figure: identity from an authenticated connection, or a request credential the receiver validates itself.
Check your understanding
Try these questions before moving on. If an answer isn't right, use the feedback and try again.
Try it in the Lab
- Make render and storage services check who is callingProve the order service's identity with its certificate over mutual TLS, send a wrong caller, a wrong audience and a missing scope to real services, run an approved errand through them, then change who may call render.