PKI and workload identity: mTLS, short-lived certificates and rotation without heroics

An offline root, an online intermediate, short-lived leaves that renew by themselves. Short lifetimes replace revocation, and overlap plus reload makes rotation routine. mTLS only means something if identity names the workload.

Read the briefing
About 3 min to read 5 drills

What to remember

  1. Short-lived beats revocable. Revocation checks often fail open and are rarely tested. A certificate that expires in hours needs no revocation at all, and forces automation.
  2. If you can't rotate it today, you don't have rotation. Certificates that last a year are renewed by hand by someone who's left. Expiry outages keep happening for this reason.
  3. Trust both during a change. Rolling a CA means clients trust old and new, then servers move, then the old one goes. In that order.
  4. Identity names the workload, not the host. An IP or a hostname says where, not what. SPIFFE IDs and attestation tie a certificate to a service.
  5. Alert long before expiry. An alert at 14 days and a renewal at two-thirds of the lifetime mean a failure is a ticket rather than an outage.

The big picture

A head of security asking about PKI wants to know if certificate lifecycles are boring in your hands. "Without heroics" in a job post means someone has been woken up by an expired certificate. The answer is automation, short lifetimes, overlap, and monitoring you've actually tested.

The mental model

A passport office. The root is the government, kept in a safe and rarely used. The intermediate is the office that issues passports. Leaves are day passes that expire tonight, so nobody needs a list of stolen ones.

In depth

The chain

An offline root signs intermediates and nothing else. Online intermediates sign leaves. If an intermediate is compromised you replace it, without touching every trust store in the fleet. Name constraints and separate intermediates per environment bound the damage further.

Lifetimes and revocation

CRLs and OCSP are often not checked, or fail open when the responder is unreachable, because failing closed would be an outage of its own. So short lifetimes do the work: a leaf that lasts hours or a day can simply be allowed to expire. It only works if renewal is automatic and monitored. Renew at about two-thirds of the lifetime, so there's time to notice a failure.

Rotating without an outage

For leaves: renew and reload without restarting. Most servers can watch a file or take a signal. For a CA: add the new CA to every trust store, wait until that's done everywhere, start issuing from the new one, wait out the old leaves' lifetimes, then remove the old CA. Each step is reversible, and each is verifiable. Skip the wait and you've built an outage.

Workload identity

mTLS proves a client holds a certificate, which only helps if the certificate says what the client is. SPIFFE gives a standard form, spiffe://trust-domain/path, carried in a document called an SVID. SPIRE issues them after attesting the node and the workload. Then authorization can say "the risk service may call the signer", not "this IP may".

Myths and facts

Myth: mTLS means we've solved authorization.

Fact: It authenticates the peer. You still need rules on what that identity may do, and an accept-any-valid-cert setting authorizes everyone with a cert.

Myth: We can always revoke a bad certificate.

Fact: Revocation checks often fail open or aren't made. Plan on expiry, and treat revocation as a bonus.

Myth: A longer lifetime means fewer outages.

Fact: It means rarer renewals, done by hand, by people who've forgotten how. Short lifetimes make failure visible while it's small.

How pros do it

  • Keep the root offline, and run separate intermediates per environment.
  • Automate issuance and renewal; renew at about two-thirds of the lifetime.
  • Reload certificates without restarting services.
  • Monitor actual expiry from the outside, not only the renewal job.
  • Rehearse a CA rotation before you need one.

Questions people ask

What would you use on bare metal?

step-ca or Vault's PKI for issuance with ACME or an agent, or SPIRE if we want attested workload identity. The tool matters less than the properties: short-lived, automatic, monitored, rehearsed. Say which one you've actually run.

A certificate expired in production. What do you do?

Reissue and reload first, because that's the mitigation. Then ask why monitoring didn't catch it, and remove the class: automate that renewal, add external expiry checks, and find everything else on the same pattern.

What about clients that pin certificates?

Pin the CA or a public key rather than a leaf, and always have a backup pin. A pinned leaf means a planned rotation becomes an outage.

Further reading

Drills · 5

Answer in your head, or out loud, before you reveal. Mark each one: "Again" brings it back, "Got it" counts on your desk.

1 Answer out loud

Your internal CA has to be replaced across a multi-region fleet. Walk me through it, with no outage.

In short

Add the new CA to all trust stores first, check that's done everywhere, issue from the new one, wait for old certificates to expire, then remove the old CA.

What a strong answer does
  • Order: Trust everywhere, then issue, then wait out old leaves, then remove, each verified.
  • Verification: Measures which CA connections use, and uses that to decide each step.
  • communication: A numbered plan, with a rollback at each step.
Why

Order is the whole answer: trust first, issue second, remove last, with a verification and a wait between each. The usual mistake is issuing from the new CA before every client trusts it, so some connections fail, and they're the hardest to find.

The common mistake

Forgetting the things outside your config management: a cron job, a vendor box, a pinned client.

2 Pick the strongest answer

Why do teams move to certificates that last hours, instead of relying on revocation?

  1. Short-lived certificates use stronger cryptography. Lifetime and algorithm have nothing to do with each other.
  2. Revocation checks often fail open or aren't made, so expiry is the control that actually works, and short lifetimes force renewal to be automated. It removes a dependency that fails silently, and makes broken renewal visible early.
  3. Certificate authorities charge less for them. This is a private CA. There's nothing to charge.
  4. TLS handshakes are faster with short-lived certificates. No: the handshake is the same. You avoid a revocation lookup at most.
In short

Revocation often fails open or isn't checked, so short lifetimes limit a stolen certificate by itself, and they force automation.

Why

Failing closed on a revocation check means your OCSP responder can take down the fleet, so most clients fail open. A stolen certificate can then be used until it expires, which is why the lifetime is what bounds the damage.

3 Find what's broken

This is meant to allow only services with a client certificate from our CA to reach /sign. Which line is the problem?

server {
  listen 8443 ssl;
  ssl_certificate         /etc/tls/leaf_cert;
  ssl_certificate_key     /etc/tls/leaf_secret;
  ssl_client_certificate  /etc/tls/client_ca;
  ssl_verify_client       optional;
  location /sign {
    proxy_pass http://signer;
  }
}
In short

ssl_verify_client optional lets clients with no certificate through unless you also check the result, so set it to on.

What's broken
  • Line 6: With 'optional', a client with no certificate still gets through, and nothing here checks the result.
Why

'optional' asks for a certificate but doesn't require one. Even with 'on', any certificate from that CA passes, so the signer should still authorize by the identity in the certificate, not merely that one is present.

The common mistake

Stopping once it's set to 'on': authentication isn't authorization.

4 Scenario: what do you do next?

03:12. Services can't reach the signer: 'certificate has expired'. Trading has stopped.

Step 1. First move?

  1. Find out who was meant to renew it. It doesn't restore anything, and blame comes first in the wrong order.
  2. Issue a new certificate for it and reload, to restore service, and tell people what you're doing. Mitigate first. The cause is clear enough, and trading is down.
  3. Disable certificate verification on the clients so it comes back fast. You've just removed the authentication on the signing path, under pressure, and it may never go back.

Step 2. It's back. What now?

  1. Add a calendar reminder for next year. That keeps the process that failed.
  2. Find every certificate on the same manual pattern, today, because this one won't be alone. The same process that missed this one has missed others.

Step 3. What removes the class?

  1. Automatic renewal, short lifetimes, and an external check of what each endpoint actually serves. External checks catch a renewed file that was never reloaded, too.
  2. A longer certificate lifetime. That makes the next failure rarer and worse.
In short

Reissue and reload the certificate now, then find why monitoring missed it, then remove the class by automating that renewal.

Why

It's a behaviour question in disguise: mitigate, communicate, sweep for the same pattern, then remove the class.

5 Quick recall

In SPIFFE, what's the short name for the document that carries a workload's identity?

In short

An SVID: the SPIFFE Verifiable Identity Document, usually an X.509 certificate or a JWT.

Accepted

svid · spiffe verifiable identity document

Why

An SVID carries a SPIFFE ID such as spiffe://example.org/signer. SPIRE issues them after attesting the node and the workload.

Next lesson Production access: RBAC, short-lived credentials, four eyes and break-glass
Drill · PKI and workload identity
0:00

Loading…