Rust • 2026-11-12 • 3 min read
mTLS Between Services with rustls, Without Adding a Service Mesh
A service mesh is a lot of moving parts to encrypt traffic between four services. What mTLS looks like when you wire rustls in directly, and when the mesh is genuinely worth it.

Mutual TLS is often the stated reason for adopting a service mesh. For a system with a handful of services that you control and that are all written in Rust, you can have the property without the control plane.
What mTLS actually gives you
Both sides prove who they are with a certificate. The server learns the client's identity from the certificate rather than from a header the client supplies, which is the whole point: a header can be forged by anything that reaches the port, a private key cannot.
That identity is then usable for authorisation. payments-api may call ledger-api; reporting may not. The decision is made against a cryptographic identity instead of a network position.
Wiring it with rustls
rustls has no ambient configuration, which feels verbose at first and then stops being a source of surprises. The server needs its own chain, its key, and a verifier that requires and checks client certificates against your internal CA.
let roots = load_internal_ca("/etc/wident/ca.pem")?;
let verifier = rustls::server::WebPkiClientVerifier::builder(roots.into())
.build()?;
let config = rustls::ServerConfig::builder()
.with_client_cert_verifier(verifier)
.with_single_cert(chain, key)?;The client side is the mirror image: your CA as the root store, your own certificate presented on connect.
Checking the identity, not just the signature
Verification tells you the peer holds a certificate your CA signed. It does not tell you *which* peer, and every service in the fleet has a certificate from the same CA. The authorisation check is yours to write.
We read the SAN from the peer certificate in a middleware layer, map it to a service name, and compare against a static allow-list compiled into the binary. Static, because the list changes at the speed of architecture decisions, not at the speed of traffic — and a file that can be edited at runtime is a file an attacker would like to edit.
Rotation is the hard part
Certificates expire. That is their job, and it is also the thing that takes an API down at 03:00 on a Sunday.
- Issue short-lived certificates — days, not years — so rotation is a routine path that is exercised constantly rather than an emergency procedure nobody has run
- Reload without restarting: watch the file and swap the
ServerConfigbehind anArcSwap - Alert on *remaining validity*, not on failures. An alert that fires when a certificate has three days left is actionable; one that fires when handshakes start failing is an incident
- Keep the CA key offline, and treat issuing from it as a reviewed operation
When the mesh is the right answer
Three honest cases. Polyglot services, where wiring mTLS into five runtimes is more work than running one sidecar. Dozens of services, where a static allow-list stops being maintainable. And organisations that need the policy to be auditable by a team that does not deploy the services.
Below that, a mesh adds a control plane, a sidecar per pod, and a new way for traffic to fail — in exchange for something a hundred lines of rustls configuration already gives you.