This article distills practical guidance for safely issuing and managing certificates with Vault's PKI engine, aligned with the Associate/Ops certification scope.
Grounded in stable features from the official documentation, it walks through terminology, setup, role design, operations, security, and troubleshooting end-to-end.
Vault's PKI engine is a dedicated secrets engine that issues and revokes X.509 certificates from an internal or external Root CA / Intermediate CA, and serves CRLs and (depending on version) OCSP responses. Operations revolve around roles, which define constraints such as allowed domains, SANs, TTL, key type/size, and Key Usage.
The recommended design uses an offline Root CA to sign an Intermediate CA, then mounts that Intermediate CA in Vault to handle day-to-day issuance. CRL distribution points and issuing-CA URLs are configured as public endpoints via pki/config/urls.
A point of frequent confusion on both the exam and in practice is the TTL boundary. The request-time ttl cannot exceed either the role's max_ttl or the engine's max-lease-ttl (set via tune). Revocation is done by serial_number, and CRLs should be configured for auto-rebuild so clients always receive the latest state.
Issuance flow (offline Root + Vault Intermediate CA)
[Client] [Vault (pki_int)] [Offline Root]
| CSR (optional) issue/sign | verify policy/role | used only to sign
|------------------------------------->|--------------------------------| intermediate once
| | |
|<------------ cert/key/chain ---------| |
| |-- CRL build / OCSP (ver.dep) --|
|<------------- CRL/OCSP --------------| |
Notes:
- Vault holds the Intermediate CA. The Root stays offline.
- Issuance: issue/<role> generates and returns the private key; sign/<role> signs an external CSR.
- CRL/OCSP distribution URLs are configured via pki/config/urls.Conceptual section (CLI examples follow in later sections)
# This section covers terminology and the big picture.
# See later sections for actual commands.A minimal setup uses a single mount with an embedded Root CA for immediate issuance, but production runs on an offline Root + Vault Intermediate CA. Splitting Root and Intermediate into separate mounts cleanly separates TTL and operational policies.
Configure URL publication (issuing_certificates, crl_distribution_points) early so applications can immediately reach the certificate chain and the CRL.
| Approach | Pros | Risks / Caveats | Primary Use |
|---|---|---|---|
| Embedded Root only (online Root) | Fastest to try, minimal dependencies | Large attack surface from Root exposure; unfit for strict operations | Validation / short-term PoC |
| Offline Root + Vault Intermediate CA | Keeps the Root private while enabling issuance; stable rotation and CRL operations | More setup steps; Root custody overhead | Standard production answer |
| External enterprise CA signs the Intermediate | Complies with enterprise PKI policy; fits into existing ecosystems | Issuance is impacted if the external CA is unavailable; contract/process dependent | Integration with an enterprise-wide CA platform |
Typical procedure (offline Root + Vault Intermediate CA)
# 1) Create mounts (separating Root/Intermediate is recommended)
vault secrets enable -path=pki_root pki
vault secrets tune -path=pki_root -max-lease-ttl=87600h
vault secrets enable -path=pki_int pki
vault secrets tune -path=pki_int -max-lease-ttl=8760h
# 2) Generate the Root internally (if running Root offline, isolate/stop afterwards)
vault write pki_root/root/generate/internal \
common_name="Example Corp Root CA" \
ttl=87600h
# 3) Generate the Intermediate CA's CSR
vault write -field=csr pki_int/intermediate/generate/internal \
common_name="Example Corp Intermediate CA" > pki_int.csr
# 4) Sign the Intermediate with the Root and import the bundle
vault write -field=certificate pki_root/root/sign-intermediate \
csr=@pki_int.csr format=pem_bundle ttl=43800h > pki_int.pem
vault write pki_int/intermediate/set-signed certificate=@pki_int.pem
# 5) Configure published URLs (external reachability for CA chain / CRL)
vault write pki_int/config/urls \
issuing_certificates="https://vault.example.com/v1/pki_int/ca" \
crl_distribution_points="https://vault.example.com/v1/pki_int/crl"
# 6) Create a role (issuance policy)
vault write pki_int/roles/web \
allowed_domains="example.com" \
allow_subdomains=true \
allow_bare_domains=true \
max_ttl="168h" \
key_type="rsa" key_bits=2048 \
require_cn=false
# 7) Issue (with key bundled)
vault write pki_int/issue/web \
common_name="api.example.com" \
alt_names="api-1.example.com" \
ip_sans="10.0.0.10" \
uri_sans="spiffe://cluster/ns/prod/sa/api" \
ttl="24h"
# 8) CRL auto-rebuild (parameter names/details vary by version — verify before rollout)
vault write pki_int/config/crl auto_rebuild=true expiry="72h"A role is the minimum unit that constrains "which names, with which keys/extensions, and up to what max TTL can be issued." SAN-based operation is the norm today, so it's safer to set require_cn=false and avoid CN dependence.
The ttl parameter is capped by both the role's max_ttl and the engine's max-lease-ttl. Exceeding either one fails. Specify KeyUsage / ExtKeyUsage explicitly for the intended purpose (e.g., server authentication, client authentication).
Role definition and CSR signing example
# Role allowing both server authentication and client authentication
vault write pki_int/roles/app \
allowed_domains="svc.cluster.local,example.internal" \
allow_subdomains=true \
require_cn=false \
max_ttl="240h" \
key_type="ec" \
key_bits=256 \
key_usage="DigitalSignature,KeyEncipherment" \
ext_key_usage="ServerAuth,ClientAuth" \
allowed_uri_sans="spiffe://cluster/*" \
allowed_ip_sans="10.0.0.0/8"
# Sign a CSR (private key stays with the application)
openssl req -new -newkey rsa:2048 -nodes -keyout server.key -subj "/CN=api.svc.cluster.local" -reqexts SAN \
-config <(printf "[req]\ndistinguished_name=req\n[SAN]\nsubjectAltName=DNS:api.svc.cluster.local,URI:spiffe://cluster/ns/prod/sa/api") \
-out server.csr
vault write pki_int/sign/app [email protected] ttl="24h"Revoke by serial_number. Enable CRL auto-rebuild and periodically verify that clients can fetch it via the distribution URL. When issuance volume is high, clean up stale entries with tidy (keeping a sufficient safety buffer).
OCSP availability and delivery vary by version, so check support before adopting it. CRL-only validation can work too; choose based on your response-latency requirements.
Operational command examples (revoke, CRL, tidy)
# Revoke (serial is commonly in colon-separated form)
vault write pki_int/revoke serial_number="15:3a:9f:..."
# Current CRL (distributed over HTTP; CLI example for reference)
curl -s https://vault.example.com/v1/pki_int/crl > crl.pem
# Tidy (sweep old/revoked certificates). Run during maintenance windows in production
vault write pki_int/tidy \
safety_buffer="72h" \
tidy_cert_store=true \
tidy_revoked_certs=trueProtect issuance APIs with least privilege. Grant policies scoped to a specific role's issue/sign only, and separate the authority to change CAs or role definitions into a different role. Always enable audit logging so issuance and revocation requests are traceable.
TTL boundaries form three layers: the engine (mount) max-lease-ttl, the role max_ttl, and the request ttl. If you can't meet the expected TTL, identify which layer is constraining it. Vault's own HA / replication design directly determines the availability of the PKI engine.
Policy example (allow issuance only for a specific role)
# pki-issue.hcl
path "pki_int/issue/web" {
capabilities = ["create", "update"]
}
path "pki_int/sign/web" {
capabilities = ["create", "update"]
}
# Management capabilities (role creation/changes, CA updates) belong to a separate admin-only policy
# Tune the mount's max TTL to match your operations
vault secrets tune -path=pki_int -max-lease-ttl=168hTTL-exceeded errors almost always come down to role.max_ttl or mount.max-lease-ttl. Check the role definition and mount config first. If SANs are rejected, review the role's allowed_*_sans for sufficient coverage.
If the CRL grows large, revisit expiry and rebuild intervals against your issuance/revocation cadence and bake tidy into the operational plan. Chain inconsistencies (missing intermediate certificate) usually mean config/urls issuing_certificates isn't publishing correctly.
Read-only commands handy for verification
# Inspect the CA chain
vault read pki_int/ca/pem
# Details for a specific certificate serial (REST example)
curl -s https://vault.example.com/v1/pki_int/cert/15:3a:9f:... | jq .
# Verify URL configuration
vault read pki_int/config/urlsAssociate / Ops
問題 1
On a Vault pki_int mount, you want to issue web certificates with a typical 24-hour TTL while ensuring they never exceed 7 days. Which configuration is most appropriate?
正解: A
PKI TTLs are controlled across three layers (mount.max-lease-ttl, role.max_ttl, and the request ttl). A satisfies both the 24-hour typical issuance and the 7-day cap. B locks the maximum at 24h and fails the requirement. C is wrong because token TTL is unrelated to certificate TTL. D is wrong because CRL configuration does not control certificate TTL.
What's the difference between issue and sign, and which should I use?
issue/<role> has Vault generate the private key and return it together with the certificate. sign/<role> is the endpoint for signing a CSR generated externally. Pick based on your key custody requirements and application key-management policy (use sign when an external HSM or the application itself must hold the key).
I'm getting TTL errors on issuance. What should I check?
Check three values: the issuance ttl, the role's max_ttl, and the mount's max-lease-ttl. If any of them is too small you get an error. The general rule is to design so that mount.max-lease-ttl ≥ role.max_ttl ≥ issuance ttl.
What's the minimum CRL/OCSP setup for production?
First, make sure CRL auto-rebuild (auto_rebuild) and externally reachable URLs (config/urls) are configured. OCSP availability and delivery vary by Vault version and requirements, so verify support based on your validation latency targets and infrastructure constraints before adopting it.
Practice with certification-focused question sets
無料で問題を解いてみるNicheeLab Editorial Team
NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.
Vault Core Concepts: Sealed/Unsealed, Auth, Secrets (2026)
Vault fundamentals — sealed/unsealed state, auth methods, se...
Vault Operations Professional (VOP-003): Complete Guide (2026)
Pass the Vault Operations Professional exam — enterprise pat...
Vault Path-Based Routing: API URL Structure (2026)
How Vault's path-based routing works — mount points, sub-pat...
Vault Tokens: Auth Token Mechanics (2026)
Token fundamentals — service vs. batch tokens, accessor, ren...
Vault Token Types: Service, Batch, Periodic (2026)
Service vs. batch tokens compared — performance, ACL behavio...