Vault PKI Certificate Rotation Runbook Prompt
Produce an operational runbook for issuing, renewing, revoking, and rotating certificates backed by HashiCorp Vault PKI — including CA rotation, expiry monitoring, and the emergency mass-reissue path.
- Target user
- Platform and SRE teams running certificate automation on HashiCorp Vault
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior SRE who owns certificate automation and has been paged for an expiry at 3am often enough to write everything down. You produce runbooks that someone with no context can execute correctly. I will provide: - My Vault PKI mount layout, issuer names, and role definitions - What consumes the certificates (Kubernetes ingress, service mesh, load balancers, message brokers, databases, appliances) and how each one reloads - Current leaf, intermediate, and root TTLs and issuance volume - The renewal automation in place today, if any (Vault Agent, cert-manager, the Secrets Operator, scripts, manual) - Who is on call and what monitoring exists Your job — write the runbook, not an essay: 1. **Build the certificate inventory table.** One row per certificate population: issuing role, subject pattern, TTL, count, what consumes it, how that consumer reloads (hot reload, SIGHUP, restart, manual), and the blast radius if it expires. Any row where the reload mechanism is "unknown" or "manual" is the real risk and must be flagged at the top. 2. **Define the renewal trigger and the safety margin.** Set the renewal threshold as a fraction of the certificate's lifetime rather than a fixed number of days, so short-lived certs renew proportionally. Explain why the margin must cover the longest plausible outage of the renewal path — Vault sealed, network partition, expired auth token — and give the number for my TTLs. 3. **Write the routine renewal procedure.** Step-by-step: authenticate, issue via `vault write pki_int/issue/<role> common_name=... ttl=...`, place the certificate, key, and CA chain with correct ownership and permissions, validate the new material before swapping it in (chain verifies to the expected root, subject and SANs match, key pairs with the cert, not-before/not-after sane), reload the consumer, then verify the live endpoint is serving the new certificate. Include the pre-swap validation explicitly — the most common self-inflicted outage is deploying a valid-looking certificate the consumer can't use. 4. **Cover the automated path and its failure modes.** For whichever tool renews in my environment, document what it does, where its logs are, how to tell it has silently stopped renewing, and how to force a renewal manually. Include the check that matters most: does anything alert when the renewer stops succeeding, as opposed to only when a certificate finally expires? 5. **Write the revocation procedure.** How to revoke by serial (`vault write pki_int/revoke serial_number=...`), how to find the serial for a deployed certificate, how CRL rebuild and OCSP responses propagate, and the honest caveat that many clients cache or ignore revocation — so the real containment step is reissue plus rotating anything the compromised key protected. Note that certificates issued from a role with `no_store=true` cannot be revoked individually. 6. **Write the CA rotation procedure.** Separate the intermediate rotation (generate a new intermediate, sign it, distribute the updated chain, set the new issuer as default, keep the old issuer for validating outstanding certificates until they expire, then remove it) from the root rotation (cross-sign the new root with the old one, distribute both, wait out the trust propagation, then retire). Give the ordering constraint that trips people up: clients must trust the new chain before anything starts serving it. 7. **Specify monitoring and alerting.** Alert on certificates approaching expiry measured from the endpoint as served, not only from Vault's records; on renewal-job failures; on CRL approaching its own expiry; on issuance-rate anomalies; and on the intermediate CA's remaining lifetime with escalating thresholds months ahead. Include the periodic reconciliation that catches certificates nobody's automation owns. 8. **Write the emergency mass-reissue procedure.** For a compromised intermediate or a mis-issuance: the decision criteria, the order of operations, how to rate-limit reissue so Vault and the storage backend survive it, how to stage across services to avoid a total outage, communications, and the rollback if reissue goes wrong. Include a dry-run instruction so the runbook has been exercised before it's needed. Output as: (a) the certificate inventory table with risk flags, (b) renewal thresholds with reasoning, (c) the routine renewal procedure with pre-swap validation commands, (d) the revocation procedure and its caveats, (e) intermediate and root rotation procedures with ordering constraints, (f) alerting rules and thresholds, (g) the emergency mass-reissue runbook. Every procedure needs a verification step and a rollback. Do not include steps that skip certificate validation or that disable verification on a client to get past a chain error — a chain error at renewal is a real problem to fix, not a check to turn off.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Why this prompt works
Certificate expiry is a scheduled outage that nobody schedules. The renewal itself is rarely the hard part — Vault will issue a new certificate on demand — so this prompt puts the inventory table first and forces a column most teams never write down: how each consumer picks up new material. A load balancer that hot-reloads, an appliance that needs a restart, and a broker that only reads its keystore at boot are three completely different renewal procedures, and the row where that field reads “unknown” or “manual” is the one that will page someone. Making that the flagged output rather than a footnote turns a certificate list into a risk register.
The pre-swap validation step exists because the most common self-inflicted certificate outage is deploying a certificate that is entirely valid and that the consumer cannot use. Wrong chain order, missing intermediate, a key that does not pair with the cert, a SAN the client checks and the role never issued — all of these produce a healthy-looking vault write and a dead endpoint. Requiring the runbook to verify the chain, subject, SANs, key pairing, and validity window before anything is swapped in moves that discovery from production traffic to a shell prompt.
The revocation and CA-rotation sections are written to be honest rather than reassuring. Revocation entries propagate unevenly and plenty of clients cache or ignore them, so a runbook that stops at vault write pki_int/revoke has documented a gesture, not a containment step — the prompt insists on reissue plus rotating whatever the compromised key protected. The same realism drives the rotation ordering constraint: clients must trust a new chain before anything begins presenting it, and demanding a dry run of the mass-reissue path means the procedure has been exercised before the day it is needed under time pressure.
Related prompts
-
Vault PKI Hierarchy Design Prompt
Design a HashiCorp Vault PKI hierarchy — offline or online root, intermediate CAs, mount TTL tuning, tightly constrained roles, CRL/OCSP endpoints — so internal certificates are issued with short lifetimes and bounded naming.
-
Internal PKI & Certificate Lifecycle Design Prompt
Design a private PKI for internal services — CA hierarchy, HSM-backed roots, automated issuance and rotation via cert-manager/Vault, and revocation — so certificates never expire unexpectedly or outlive trust.
-
Prometheus TLS Certificate Expiry Monitoring Prompt
Set up Prometheus + blackbox exporter to monitor TLS certificate expiry across endpoints and design tiered alerts that warn before, not after, a cert outage.
-
Vault Agent Auto-Auth & Secret Templating Prompt
Design a Vault Agent deployment that authenticates workloads automatically, caches and renews tokens, and renders secrets into config files without ever hardcoding credentials.
More HashiCorp Vault prompts & error guides
Browse every HashiCorp Vault prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.