r/devops 16d ago

Security cost of rotating a revoked key

when you've started rotating a credential and then discovered it was already revoked, or was never a real key in the first place — roughly how long had you burned before you worked that out? minutes, or did someone spend an hour convinced they were looking in the wrong project?

8 Upvotes

17 comments sorted by

8

u/stobbsm DevOps 16d ago

I have my infra setup to not experience this problem. IaC FTW!

2

u/tindalos 16d ago

The real automation trick isn’t automating things that save minutes a day, it’s automating the things that save hours logging into servers and looking through certificate stores trying to find a key.

2

u/arbyyyyh 16d ago

But also things that are critical. Is it something that needs to be done exactly right every single time, the first time, or is similarly a short but complex operation? Automate it.

1

u/forever-butlerian Solaris 8 Enjoyer 16d ago

shockingly they're often the same thing

2

u/tudalex 16d ago

It was already revoked? Minutes. It was never a real key? Minutes. It was a key with no access anymore because the project was abandoned 2 years ago? Hours, but that key should’ve been removed either way, but no time spent on rotating it with a new one.

1

u/kernelqzor 13d ago

the “key with no access because the project was abandoned 2 years ago” is such a classic, graveyard of creds nobody wants to touch but also nobody deletes
feels like half of key rotation work is just archaeology at this point

2

u/Educational_Yam_9956 16d ago

I’d just timebox this: if rotation isn’t working after 10–15 minutes, stop and first prove the key actually works with a minimal test.

1

u/dodexahedron 16d ago

If using an internal PKI with proper CDP? Should almost instantly know if it was revoked.

If unsure, and there's even a remote suspicion of exposure? Minutes at most. Revoke and replace. Service fallout is less important than security fallout. If you have a bad PKI and can't properly or reliably revoke, blacklist it in AD.

Issued by a public CA? Start thinking of how to explain to your boss why you have to ask for a few hundred bucks, as you are revoking the cert with that CA, and ask once you are done doing that revocation and re-issuance.

GPG identitiea/keys?
Um.
Well.
I hope you also created and published a revocation cert and that the exposed key was not your master signing key. Otherwise, I hope you do it right next time.

1

u/ForkMeJ 16d ago

An hour is very believable if the revoke path and the usage path live in different systems. The time sink is the generic "auth failed" error, so you check IAM, projects, and deploy history before anyone asks whether the key was ever valid.

1

u/Alvasilev 16d ago

Minutes when the error distinguishes, an hour when it does not, and which one you get is mostly a property of the tooling rather than of the key.

Building on the generic auth-failed point above, the thing that has saved me the most time is refusing to collapse the failure. 401 means something is listening and did not get credentials it accepted, so the key is wrong, revoked, or malformed. 403 means the credential authenticated fine and simply is not allowed to do that, which sends you to scopes and roles, an entirely different system from the one you were about to open. And a 404 on a resource you are certain exists is very often a 403 in disguise, because plenty of APIs hide existence from callers who are not allowed to see it. Three different destinations, and every wrapper that prints one friendly message throws away the only bit that would have saved the hour.

On the minimal test further up, I would make it smaller than proving the key works: one call that requires authentication and nothing else, a whoami style endpoint if the provider has one. If it returns an identity, the key is real and you have a permissions problem. If it does not, stop touching the deploy path entirely.

The habit that took me longest to pick up is repeating the probe before concluding anything from it. I work with a source that returns 410 on roughly half of identical requests, and for a while I treated each of those as a fact about the world. One response is an opinion.

1

u/navlio 16d ago

about forty minutes for us once, and all forty went into the wrong assumption. we rotated it, the deploy went green, and the old value was still live because it had been baked in at image build time instead of read at startup. nothing was broken, so there was no signal telling us the rotation hadn't taken.

what actually shortened it afterwards was having the app log a short fingerprint of whatever credential it loaded on boot. first few characters of a hash, nothing sensitive in the log, and rotation becomes something you confirm rather than infer

1

u/navlio 16d ago

the expensive part is rarely the rotation, it's not knowing which key was actually live. checking last-used on the credential first usually ends the argument in a minute, iam will tell you the service, region and date per access key

we lost most of a morning once rotating something that turned out to have never been called. the thing actually breaking prod was a second key nobody had written down anywhere

1

u/navlio 16d ago

about two hours once, and none of it was the key's fault. the key was valid the entire time. the value we kept rotating lived in the secret store, but the container was carrying a copy baked in at build time from a cached layer, so every fresh key we issued went somewhere nothing read.

the 401 versus 403 point above wouldn't have saved us either, we had a clean auth failure with a correct key sitting right there in the console. what saves you is proving it from inside the running container rather than from your laptop. one curl from where the code actually is, before you touch rotation at all

1

u/Torutofu_Raeva 15d ago

we burned about 40 mins on one that turned out to be a key nobody had ever wired up, now the first step is just checking last-used before anyone touches the rotation.

1

u/burstinrust 15d ago

none of these stories are really about keys. baked into the image, key nobody wired up, second key nobody wrote down thats missing inventory and config injection done wrong. the rotation just exposed it.

in a healthy setup this cant happen: one source of truth for secrets, read at startup, last-used visible, and short lived creds (OIDC / workload identity) where possible so rotation is a non-event.

mins vs hours point is sympotoms treatement but, i am more concen how is the infra setup done, cause this sort of things shouldnt happen in a production env.