Skip to content
🎉 Launch sale:50% off everything over $22 — automatically applied at checkout· ends Aug 2Shop the sale →
DevOps AI ToolKit
Newsletter
All prompts
AI for HashiCorp Vault Difficulty: Advanced ClaudeChatGPT

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.

Target user
Platform and security engineers running HashiCorp Vault
Difficulty
Advanced
Tools
Claude, ChatGPT

The prompt

You are a senior PKI and secrets-platform engineer who has built internal certificate authorities in Vault and knows that the design decisions you cannot undo are the root's key material and the name constraints on your roles.

I will provide:
- What the certificates are for (internal service mTLS, ingress, client auth, code signing, device identity)
- The DNS namespaces, IP ranges, and SAN types involved
- Whether an existing corporate root or intermediate must sign our CA, or we are creating a standalone trust domain
- How trust will be distributed to clients, and what those clients are (Go/Java/Python services, browsers, mobile, appliances)
- My Vault version, edition, and HA topology

Your job:

1. **Fix the trust topology before any commands.** Decide between a self-signed root inside Vault, a root kept offline outside Vault that signs a Vault-hosted intermediate, or an intermediate signed by an existing corporate CA. State the tradeoff honestly: a root generated inside Vault with `pki/root/generate/internal` never exposes its key, but it also cannot be taken offline, and its compromise is the whole trust domain. Recommend the offline-root pattern for anything long-lived and explain what "offline" must actually mean operationally.

2. **Separate mounts by function and lifetime.** Recommend a distinct mount per CA tier and per issuance purpose — a root mount, one or more intermediate mounts, and separate mounts where the policy or naming boundaries differ (for example internal service mTLS versus client authentication). Explain the blast-radius and policy-scoping benefit, and set each mount's `max-lease-ttl` with `vault secrets tune` before generating any CA, since a CA cannot outlive its mount's max TTL.

3. **Give the full generation sequence.** Root: tune the mount, then `vault write pki/root/generate/internal` with `common_name`, `ttl`, `key_type`, `key_bits`, and `issuer_name`. Intermediate: tune, `vault write pki_int/intermediate/generate/internal` to get a CSR, sign it with `vault write pki/root/sign-intermediate` including a constrained `ttl` and appropriate `permitted_dns_domains` where you want name constraints enforced by the certificate itself, then `vault write pki_int/intermediate/set-signed`. Specify sensible lifetimes — root measured in years, intermediate a fraction of the root, leaf certificates in days or hours.

4. **Choose key types and sizes deliberately.** Recommend key type and size per tier against what my clients actually support, and note where ECDSA is preferable but a legacy client forces RSA. Flag any client in my list that will not validate a modern chain.

5. **Constrain the issuing roles hard.** This is where over-issuance is prevented. For each role, give `vault write pki_int/roles/<name>` with `allowed_domains`, `allow_subdomains`, `allow_bare_domains`, `allow_glob_domains`, `enforce_hostnames`, `allow_ip_sans`, `allowed_uri_sans`, `server_flag`, `client_flag`, `key_usage`, `ext_key_usage`, `key_type`, `key_bits`, `ttl`, and `max_ttl`. Treat `allow_any_name=true` as a finding requiring explicit written justification. Consider `no_store=true` for high-volume short-lived issuance to keep the storage backend and CRL from growing without bound, and explain what that costs you (those certificates cannot be revoked individually by serial).

6. **Configure revocation and distribution endpoints.** Set `pki/config/urls` with `issuing_certificates`, `crl_distribution_points`, and `ocsp_servers` pointing at reachable addresses — including from clients that may not reach Vault's API directly. Configure `pki/config/crl` with a sensible `expiry` and `auto_rebuild` so the CRL doesn't expire under you, and set up `pki/config/auto-tidy` (or scheduled `pki/tidy`) to clear expired certificates and revocation entries. Be explicit that short leaf lifetimes are a better revocation strategy than relying on CRL propagation.

7. **Write the Vault policies for issuance.** Each consumer gets `update` on `pki_int/issue/<its-role>` and nothing more — no access to the root mount, no `pki_int/root/*`, no `pki_int/config/*`, and no ability to create or modify roles. Show the policy HCL and note that read access to `pki/cert/*` is public-ish information while access to `pki/roles/*` write is effectively the power to issue anything.

8. **Plan renewal, rotation, and the future.** Cover issuer rotation using Vault's multi-issuer support (`pki/issuers`, issuer names, and the `default` issuer), cross-signing to roll a new root without a flag-day trust update, how trust bundles reach clients, and what the rotation calendar looks like. State how you would recover from an intermediate compromise versus a root compromise, since those are very different days.

Output as: (a) the trust topology diagram in text with the reasoning, (b) the mount layout with tuned TTLs, (c) the full generation command sequence for root and intermediate, (d) the role definitions with every constraint set and justified, (e) URL, CRL, and tidy configuration, (f) the per-consumer issuance policies, (g) the rotation and compromise-recovery plan.

Do not issue leaf certificates directly from the root, do not use `allow_any_name` to make an issuance error go away, and do not set leaf TTLs in months because renewal automation isn't ready — build the automation instead. If any private key must leave Vault, say so explicitly and describe how it is protected.

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

A PKI hierarchy is mostly a set of decisions you cannot walk back. The root’s key material and where it lives, the mount’s maximum lease TTL, and the name constraints baked into an issued intermediate all outlive whoever chose them. This prompt therefore refuses to emit commands until the trust topology is settled, and it names the specific tradeoff people get wrong: a root generated inside Vault never exposes its private key, which sounds strictly safer until you notice it also can never be taken offline and its compromise is the entire trust domain. Forcing that choice to be stated with reasoning is worth more than any of the CLI output that follows.

Ordering matters as much as content, which is why mount tuning comes before CA generation. A certificate cannot outlive its mount’s max-lease-ttl, so generating a ten-year root on an untuned mount silently produces something far shorter than intended, and the fix is to start over. Sequencing vault secrets tune ahead of pki/root/generate/internal in the prompt itself removes a class of rework that is otherwise discovered weeks later by a monitoring alert.

The role-constraint step is where the design actually enforces anything. Policies control who may call pki_int/issue/<role>, but the role definition controls what that call can produce — allowed_domains, enforce_hostnames, allow_ip_sans, ext_key_usage, and the TTL ceiling are the only things standing between a legitimate consumer and a certificate for a name it has no business claiming. By treating allow_any_name=true as a finding requiring written justification and demanding each constraint be justified rather than merely set, the prompt produces a hierarchy where an over-issuance incident requires someone to have deliberately removed a guardrail instead of simply never adding one.

Related prompts

More HashiCorp Vault prompts & error guides

Browse every HashiCorp Vault prompt and troubleshooting guide in one place.

Free download · 368-page PDF

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.