Join our Newsletter — 33% off our NHI Course
Home› Guides› How to issue short-lived certificates with the Vault…
Guide Secrets Management

How to issue short-lived certificates with the Vault PKI secrets engine: Roles, intermediates and auto-renewal

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 18 November 2026 15 min read
On this page

To issue short-lived certificates with the Vault PKI secrets engine, mount a dedicated PKI path for an intermediate CA signed by a root kept elsewhere, define narrow roles with short ttl and max_ttl values, and let Vault Agent fetch and renew certificates automatically before they expire. Done well, certificates for services and workloads live for hours or days instead of a year, revocation becomes the exception rather than the plan, and no person has to remember a renewal date.

This guide is for platform, PKI and security engineers who run HashiCorp Vault and want to move internal TLS and mutual TLS certificates to short lifetimes. It covers mount layout, intermediate set-up, role design, issuing and renewing with Vault Agent, CRL and tidy settings for high-volume issuance, verification and the mistakes that cause outages. It does not repeat CA hierarchy design, which is covered in the Enterprise PKI Design and CA Hierarchy Guide, or general Vault hardening, which is covered in the HashiCorp Vault Guide.

This is an independent guide from NHI Mgmt Group, based on HashiCorp's public documentation as of November 2026. It is not sponsored or reviewed by HashiCorp. Product features change, so confirm settings against HashiCorp's current documentation.

Key takeaways

  • Keep the root CA out of Vault. HashiCorp's own guidance is to issue a shorter-lived intermediate and import or generate that in Vault, with the intermediate's private key never leaving Vault.
  • Roles are where short lifetimes are enforced. Set max_ttl on every role; the defaults fall back to the mount maximum, which is 30 days unless tuned.
  • Several role defaults are permissive for a service certificate: allow_ip_sans, server_flag and client_flag are all true by default. Set them explicitly.
  • For high-volume, short-lived issuance, set no_store=true and leave generate_lease=false. This keeps storage and CRLs small and lets standby nodes issue.
  • Use the Vault Agent pkiCert template function for renewal. It renews at a fraction of the certificate lifetime set by lease_renewal_threshold (default 0.9) and can run a reload command when the file changes.
  • Turn on auto-tidy and scheduled CRL rebuilds. Both are off by default.

When you need this

Short-lived certificates are becoming the norm on two fronts. Public TLS lifetimes are being cut in stages, which is pushing organisations to automate renewal everywhere, as described in the Certificate Expiry Outages and 47-Day TLS Certificates Guide. Internally, teams adopting mutual TLS and zero trust service-to-service authentication want workload certificates that expire before a stolen key is worth much. The trade-offs are set out in Short-Lived vs Long-Lived Certificates.

Vault PKI is a common route for the internal side when:

  • Vault is already the secrets platform, and workloads already authenticate to it through Kubernetes, AppRole, cloud or JWT auth methods.
  • Certificates are needed for internal service names, pod or VM identities, database client authentication or message brokers that a public CA will not issue for.
  • An existing internal CA issues one-year or multi-year certificates by hand request, and expiry outages or forgotten keys keep recurring.
  • Applications can reload a certificate from disk, or can be fronted by a sidecar or proxy that can.

Each certificate is a machine identity credential. Moving to short lifetimes reduces exposure from a leaked key, but only if issuance is tightly scoped: a Vault role that will sign any name for any caller turns Vault into a credential factory for attackers.

Before you start

  • Decide the lifetimes. HashiCorp suggests a cascading model, with roots of roughly two to ten years, intermediates of six months to two years and leaves of 30 to 90 days. For internal workload certificates, NHI Mgmt Group recommends going well below that leaf range where applications can reload: 24 to 72 hours is common for service mesh and mTLS use. The issuing intermediate must outlive every leaf it signs.
  • Decide where the root lives. An offline root, an existing enterprise root or a separate Vault mount used only for signing intermediates. Do not use the same mount for the root and for leaf issuance.
  • List the names. For each role, write down the DNS domains, whether subdomains or bare domains are needed, whether IP or URI SANs (for example SPIFFE IDs) are required, and whether the certificate is for servers, clients or both.
  • Know your consumers. Identify how each application loads its certificate and how it can be told to reload: a signal, a service reload, an API call or a restart.
  • Check auth methods. Each workload needs an auth method and a Vault policy that allows update on only the issue or sign path of its own role. Review existing auth methods first; the page How to audit HashiCorp Vault tokens, policies and auth methods covers that.
  • Plan revocation. Decide whether relying parties will check CRLs, OCSP or neither. With very short lifetimes, many teams rely on expiry, which changes how you configure CRL storage.

Step-by-step

1. Mount and tune a PKI path for the intermediate

Mount a dedicated path for issuing, for example pki_int, and raise its maximum lease TTL to cover the intermediate's lifetime. HashiCorp's set-up guide uses:

1 Sample only, based on the public documentation cited. Assess it independently against the current official documentation, test outside production and back up first.

Sample 1
vault secrets enable -path=pki_int pki
vault secrets tune -max-lease-ttl=8760h pki_int

The mount default maximum is 30 days, which is too short for an intermediate. The tune value is the ceiling; each role sets the real leaf limit.

2. Generate the intermediate CSR inside Vault and sign it with the root

Generate the intermediate key and CSR with the internal type so the private key is never returned:

Sample 1
vault write -field=csr pki_int/intermediate/generate/internal \
    common_name="Example Services Issuing CA 2026" \
    key_type=ec key_bits=256 > pki_int.csr

The default key type is RSA with 2048 bits. HashiCorp notes that RSA issuance and key generation are slower and more variable than EC or Ed25519, which matters at high issuance rates. Check that your relying parties support the algorithm before choosing.

Sign the CSR with your root. If the root is another Vault mount, use root/sign-intermediate; its default max_path_length is -1, meaning no limit, so set a path length of zero if this intermediate should not sign further CAs. Apply name constraints such as permitted_dns_domains when generating or signing the intermediate so that, even if a role is misconfigured, the CA cannot issue for names outside your internal domains. Then import the signed certificate with pki_int/intermediate/set-signed and make sure the mount has a default issuer.

3. Publish issuing and CRL locations

Set config/urls so leaf certificates carry the URLs where clients can fetch the issuing CA and CRL:

Sample 1
vault write pki_int/config/urls \
    issuing_certificates="https://vault.example.internal:8200/v1/pki_int/ca" \
    crl_distribution_points="https://vault.example.internal:8200/v1/pki_int/crl"

On Vault Enterprise with performance replication, issued certificates, revocations and CRLs stay local to the cluster that issued them, so every cluster needs its own URL configuration; HashiCorp notes that issuance, including ACME, fails without it.

4. Create narrow roles

Create one role per service family or trust boundary. Set every security-relevant parameter explicitly, because the defaults suit flexibility, not least privilege:

Sample 1
vault write pki_int/roles/payments-api \
    allowed_domains="payments.svc.example.internal" \
    allow_subdomains=false \
    allow_bare_domains=true \
    allow_glob_domains=false \
    allow_any_name=false \
    allow_wildcard_certificates=false \
    allow_localhost=false \
    enforce_hostnames=true \
    allow_ip_sans=false \
    server_flag=true \
    client_flag=false \
    key_type=ec key_bits=256 \
    ttl=24h max_ttl=72h \
    no_store=true generate_lease=false
ParameterDefaultShort-lived service setting
ttlEmpty: system default or max_ttl, whichever is shorterThe normal lifetime, for example 24h
max_ttlEmpty: mount maximum lease TTLHard ceiling, for example 72h
allow_any_namefalseKeep false
allow_subdomains, allow_glob_domainsfalseEnable only where a pattern is needed
enforce_hostnamestrueKeep true for TLS
allow_ip_sanstruefalse unless IP certificates are required
server_flag, client_flagBoth trueOnly the usage the service needs
key_usage, ext_key_usageDigitalSignature, KeyAgreement, KeyEncipherment; noneMinimum needed
no_storefalsetrue for TTLs under 30 days or high volume
generate_leasefalseKeep false
issuer_refdefaultThe intermediate, never a root

HashiCorp advises against attaching roles to a root issuer through issuer_ref: roots should only sign intermediates. For workload identity using URI SANs, set allowed_uri_sans to the exact pattern for that workload instead of enabling broad name options.

5. Bind the role to a policy and an auth method

Write a Vault policy that allows only update on pki_int/issue/payments-api (or pki_int/sign/payments-api if the workload generates its own key and sends a CSR) and attach it to the auth method role that the payments service uses. Using sign keeps the private key on the workload; using issue means Vault generates the key and returns it in the response, so it will also pass through Vault Agent and any logs you are not careful with. Keep the policy free of wildcards across roles so one compromised workload cannot request certificates for another.

6. Issue and renew with Vault Agent

A manual test confirms the role works:

Sample 1
vault write pki_int/issue/payments-api common_name=payments.svc.example.internal

For production, run Vault Agent beside the workload and render the certificate with the pkiCert template function, which HashiCorp recommends for PKI certificates because it avoids unnecessary reissuance on restart or re-authentication:

Sample 1
template {
  destination = "/etc/payments/tls/bundle.pem"
  contents    = <<EOT
{{ with pkiCert "pki_int/issue/payments-api" "common_name=payments.svc.example.internal" }}
{{ .Data.Key }}
{{ .Data.Cert }}
{{ .Data.CA }}
{{ end }}
EOT
  exec {
    command = ["systemctl", "reload", "payments"]
  }
}

With pkiCert, Agent fetches a new certificate on start-up only if none was rendered before or the rendered one has expired, and on re-authentication it skips fetching unless the certificate has expired. Renewal is driven by lease_renewal_threshold in template_config: for a certificate without a lease, Agent treats Not After as the end and rotates at that fraction (default 0.9) of the time between Not Before and Not After. For a 24-hour certificate that is roughly two hours and 24 minutes before expiry. If your reload path can fail, lower the threshold (for example 0.66) to leave time to notice and fix it.

The exec block runs only when the rendered output changes, has a default timeout of 30 seconds and should be given as an array to avoid command injection. The older command field is deprecated in favour of exec.

If clients cannot run Agent but speak ACME, Vault has provided an ACME server since version 1.14. ACME certificates are capped at 90 days by default, and unauthenticated ACME clients can request certificates under any role unless you restrict allowed_roles, allowed_issuers and default_directory_policy, or require external account binding. The ACME and Automated Certificate Management Guide covers client-side practice.

7. Configure CRL rebuilds and tidy for volume

Short lifetimes mean many certificates. Two settings that are off by default should be turned on:

  • Auto-tidy. config/auto-tidy has enabled=false by default with a 12-hour interval_duration. Enable it with tidy_cert_store=true and tidy_revoked_certs=true (both false by default); the default safety_buffer is 72 hours.
  • CRL auto-rebuild. config/crl has auto_rebuild=false and enable_delta=false by default, with a 72-hour CRL expiry and a 12-hour auto_rebuild_grace_period. Enabling scheduled and delta rebuilds avoids expensive rebuilds on every revocation. If relying parties use only OCSP, or no revocation check at all, disable=true stops CRL building.

HashiCorp notes that tens of thousands of stored certificates can cause problems, which is why no_store=true matters. With no_store, revocation by serial number alone is not possible; you must present the certificate. Make sure your audit device logs issuance requests so you still have a record of what was issued to whom. For the trade-offs between CRLs, OCSP and short lifetimes, see the Certificate Revocation Guide.

8. Plan intermediate rotation

The intermediate will expire too. HashiCorp describes two approaches: a new mount for a clean break, or multiple issuers in one mount so existing roles and trust remain in place. With multiple issuers, the old issuer can be restricted to CRL signing and removed once everything it issued has expired. Set leaf_not_after_behavior to err or truncate on intermediates so a leaf can never outlive its issuer. Schedule rotation when the intermediate reaches roughly two thirds of its lifetime, and distribute the new chain to trust stores before switching the default issuer.

Verify it worked

  • Lifetime. openssl x509 -in bundle.pem -noout -dates should show a validity period equal to the role ttl, and Vault should refuse a request for more than max_ttl.
  • Names. Request a certificate for a name outside allowed_domains, an IP SAN and a wildcard. All three should be denied.
  • Usage. openssl x509 -noout -text should show only the extended key usage you intended, for example TLS Web Server Authentication.
  • Chain. The certificate should chain to the intermediate and then to the root in your trust store, with no root issued directly.
  • Renewal. In a test environment, set a short TTL such as 15 minutes and watch Agent render a new file and run the reload before expiry. Confirm the application serves the new certificate without dropping connections.
  • Policy. From the workload's token, try to issue from another role. It should fail with permission denied.
  • Storage. After a day of traffic, the certificate list for the mount should not grow if no_store=true is in effect.

Rollback and common errors

  • Certificates still last 30 days. The role has no max_ttl and the request did not set ttl, so the mount default applied. Set both on the role.
  • Requested TTL rejected or truncated. The role max_ttl or the mount max-lease-ttl is lower than the request, or the leaf would outlive the intermediate and leaf_not_after_behavior is err.
  • Common name not allowed. The name is outside allowed_domains, or it is the bare domain and allow_bare_domains is false. require_cn defaults to true, so a request without a common name also fails.
  • Service keeps the old certificate. The file was renewed but the exec command did not reload the process, timed out after 30 seconds or exited non-zero. Check Agent logs.
  • Issuance fails on a performance replica. The per-cluster URL configuration is missing.
  • Vault storage grows quickly. no_store is false on a high-volume role, or tidy is not running.

To roll back a role change, write the previous role definition back; roles are configuration and are best kept in Terraform or another reviewed source. Certificates already issued keep their original lifetime, so a rollback from 24 hours to 30 days only affects new issuance. If a short TTL is causing outages, raise ttl temporarily while fixing the reload path rather than abandoning automation.

Hardening afterwards

  • Keep one issuer per mount where possible and separate the root mount from leaf mounts, as HashiCorp recommends, so audit and policy stay simple.
  • Restrict who can write to roles/, config/, issuers/ and root/ paths. A person who can edit a role can issue for any name it allows.
  • Send Vault audit logs to your SIEM and alert on issuance from unexpected auth method roles, requests for names outside the usual pattern and changes to PKI configuration.
  • Where relying parties check revocation, prefer OCSP over large CRLs and use POST requests, which HashiCorp notes are more reliable than GET.
  • Back the intermediate key with an HSM or managed key where your Vault edition supports it, and protect unseal and recovery keys accordingly.
  • Track each role as a machine identity issuer in your NHI inventory, with an owner and a review date.

Common failure patterns

  • Root in the issuing mount. The set-up tutorial's internal root is used for production leaves, so the root key sits online and every role chains directly to it.
  • Catch-all roles. A single role with allow_any_name=true or broad glob domains serves every team, and every workload policy can use it.
  • Short TTL, manual renewal. Lifetimes are cut to days but renewal is still a script someone runs, so outages increase instead of falling.
  • Renewal without reload. Agent writes the new file but the application only reads certificates at start-up.
  • Unbounded storage. Every short-lived certificate is stored and leased, CRLs grow and Vault performance falls.
  • Forgotten intermediate expiry. Leaf automation is perfect, but the intermediate expires and all issuance stops at once.
  • Open ACME directory. ACME is enabled for convenience with no role or EAB restrictions.

Practitioner checklist

  • Root CA held outside the issuing mount; intermediate key generated with the internal type.
  • Name constraints and path length set on the intermediate.
  • Every role sets ttl, max_ttl, allowed_domains, allow_ip_sans, server_flag and client_flag explicitly.
  • No roles reference a root issuer; no catch-all roles.
  • High-volume roles use no_store=true and generate_lease=false, with issuance captured in audit logs.
  • Workload policies allow only their own role's issue or sign path.
  • Vault Agent uses pkiCert with an exec reload and a tested lease_renewal_threshold.
  • Auto-tidy and scheduled CRL rebuilds enabled, or CRLs deliberately disabled.
  • Intermediate rotation scheduled, with leaf_not_after_behavior set to err or truncate.
  • ACME, if enabled, restricted by role, issuer and external account binding.

Standards and references

Related NHI Mgmt Group resources: Enterprise PKI Design and CA Hierarchy Guide · HashiCorp Vault Guide · Short-Lived vs Long-Lived Certificates · Certificate Revocation Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.