Vault's cert auth method lets a client log in by presenting a client certificate and receive a token bound to a policy. The certificate is presented over mTLS, and the auth method handles the mapping between certificates and policies.
This article gives you a fast overview of the minimal setup aligned with official behavior, the key design points, how to think about revocation and rotation, and the spots that are easily confused on the exam.
With Vault's cert auth, the client presents a TLS client certificate to /auth/cert/login, Vault validates the certificate, and a policy-bound token is issued. Authentication itself is handled by the cert auth method, while transport encryption and server authentication are handled by the usual TLS configuration.
Certificate trust is rooted either in the specific client certificate registered with the cert auth method, or in the issuing CA certificate. When you trust at the CA level, narrowing the allowed range with attributes such as CN, SAN, and OU becomes essential (attribute names and detailed parameters can vary by version, so check the documentation when you deploy).
On the exam, the flow of "client certificate presented over mTLS → verified and mapped by Vault's cert auth method → token issued" is tested frequently, along with when to choose cert vs. AppRole, Kubernetes, or OIDC.
Minimal login example (CLI and curl)
export VAULT_ADDR=https://vault.example.com:8200
export VAULT_CACERT=/path/to/vault-ca.pem
export VAULT_CLIENT_CERT=/path/to/client.pem
export VAULT_CLIENT_KEY=/path/to/client.key
# Login via CLI (cert auth)
vault login -method=cert
# Direct HTTP (mTLS required)
curl --cacert /path/to/vault-ca.pem \
--cert /path/to/client.pem --key /path/to/client.key \
https://vault.example.com:8200/v1/auth/cert/loginThe minimal configuration is three steps: 1) enable the auth method, 2) register the client certificate or CA (tied to a policy), 3) log in over mTLS. Start in dev/test, then for production narrow the allowed range with attributes and design token TTL / Max TTL / Period.
Pinning to a specific certificate makes loss and revocation response explicit. Trusting at the CA level is more convenient but makes revocation propagation and attribute scope design much more important.
Minimal configuration example (both certificate pinning and CA trust patterns)
# Enable the auth method
vault auth enable cert
# Pattern A: pin a specific client certificate (register the certificate itself)
# client.pem is the public-key certificate (PEM). Attach the dev-app policy.
auth_path="auth/cert/certs/dev-client"
vault write ${auth_path} \
certificate=@/path/to/client.pem \
policies="dev-app" \
display_name="dev-client"
# Pattern B: trust the issuing CA (accept any client certificate signed by the CA)
auth_path="auth/cert/certs/ci-clients-ca"
vault write ${auth_path} \
certificate=@/path/to/ci-clients-ca.pem \
policies="ci-build" \
display_name="ci-clients"
# Add options to narrow the allowed range via attributes such as CN/SAN/OU (names vary by Vault version)
# e.g. allowed_common_names=..., allowed_dns_sans=..., allowed_organizational_units=...
# Login (specify the entry explicitly)
vault login -method=cert name=dev-clientThe client connects to Vault over mTLS and presents the client certificate during the TLS handshake. Vault secures the traffic with server TLS, and the cert auth method inspects the certificate associated with the connection, matching it against pre-registered mappings.
A token bearing the policies tied to the matched entry is issued and used for subsequent Vault API calls.
| Auth method | Typical use cases | Rotation, risks, and caveats |
|---|---|---|
| cert (client certificate) | CI/CD, internal automation, machine-to-machine communication | Certificate management is critical. With CA trust, attribute scoping and revocation design are mandatory |
| AppRole | Headless authentication from servers and jobs | Protect and rotate RoleID/SecretID. Do not rely on network alone for protection |
| Kubernetes (SA JWT) | Workloads running on Kubernetes | Binding to ServiceAccount JWTs and restricting by namespaces / service accounts |
| OIDC/JWT | Both humans and apps (federation via an IdP) | Browser flow / trust configuration. Mapping token claims to identities |
Flow of mTLS and the cert auth method
Client Vault
| TLS ClientHello |
|------------------------------>|
| presents client certificate |
|<------------------------------|
| TLS handshake complete |
| |
| POST /auth/cert/login (mTLS) |
|------------------------------>|
| verify cert → match mapping |
| issue token with policies |
|<------------------------------|
| use token for secrets/API |
|------------------------------>|Using the token after login (example: reading from KV)
# Set the token from login into an environment variable
export VAULT_TOKEN="s.xxxxx"
# Read a KV v2 secret
auth_header="X-Vault-Token: ${VAULT_TOKEN}"
curl --cacert /path/to/vault-ca.pem \
-H "${auth_header}" \
https://vault.example.com:8200/v1/secret/data/app/configRegistering a CA to accept a wide range is operationally easy, but insufficient revocation checks or attribute scoping become risks. Strictly limit what is allowed with CN, SAN (DNS/URI/Email), and organization/unit (O/OU), and keep policies at least privilege.
Vault's cert auth decides based on whether the presented certificate is consistent with a pre-registered entry. It is safer not to assume external CRL/OCSP will be consulted automatically. Aim for fast revocation by issuing short-lived client certificates, pinning, and deleting mappings.
By leveraging token TTL / Max TTL / Period, you can keep access short-lived even if the certificate is long-lived. This is especially effective for machine-centric use cases rather than human authentication.
Example of narrowing the allowed range via attributes (conceptual)
# Register the CA but restrict CN/SAN/OU (verify actual parameter names against your Vault version)
vault write auth/cert/certs/ci-clients-ca \
certificate=@/path/to/ci-clients-ca.pem \
policies="ci-build,artifact-read" \
display_name="ci-clients" \
# The following is conceptual (verify the names of allowed_* / required_* against your Vault)
allowed_common_names="ci-*,build-*" \
allowed_dns_sans="*.corp.local" \
allowed_organizational_units="CI,Build"Think about rotation in two layers: the certificate (the client key material) and the Vault token. Automate short-lived issuance and renewal for the certificate, and shrink the blast radius on the Vault side with token TTL/Period and least-privilege policies.
Triage connection failures across two layers: TLS and the auth method. Rejections at TLS are usually caused by missing certificate presentation, broken chains, or key mismatch; rejections at the auth method usually mean an unregistered mapping or an attribute mismatch.
Inspection command set
# List all registered entries
vault list auth/cert/certs
# Inspect a single entry
vault read auth/cert/certs/dev-client
# Immediate revocation (delete the mapping)
vault delete auth/cert/certs/dev-client
# Verify the TLS handshake (check certificate presentation)
openssl s_client -connect vault.example.com:8200 \
-cert /path/to/client.pem -key /path/to/client.key \
-CAfile /path/to/vault-ca.pem -quietCert auth issues "client certificate → policy-bound token". TLS itself (its lifetime and server certificate) is managed separately, and exam choices often try to conflate these.
AppRole fits environments where you can distribute and manage a secret (SecretID); cert fits machine-to-machine traffic with PKI and mTLS already in place. For human logins, OIDC/SAML are the appropriate choice — a framing the exam asks about often.
One-liner to test your understanding
# Specify name to log in via a specific entry (avoid conflicts)
vault login -method=cert name=ci-clients-caAssociate
問題 1
After enabling Vault's cert auth at the CA level, an unexpected client certificate was able to log in. Which is the most appropriate corrective action?
正解: A
When trusting at the CA level, the fundamental fix is to narrow the scope of client certificate attributes (CN/SAN/OU and so on). Rotating server TLS or changing KV settings is unrelated to the root cause, and switching auth methods is a viable design option but excessive as an immediate corrective action.
Does cert auth automatically check CRL/OCSP for revocation?
Vault's cert auth is built around matching against the registered certificates or CAs, so you cannot assume it will automatically consult external revocation status. Design fast revocation through short-lived certificates, pinning, and removing the mapping entry.
If the same certificate matches multiple entries, which policy applies?
You should avoid designs where multiple matches are possible, but if they do happen in practice, the reliable approach is to specify the entry explicitly with vault login -method=cert name=<entry>.
Is cert auth a good fit for human logins?
It is possible, but IdP integrations such as OIDC/SAML are generally better suited for humans in terms of auditing, lifecycle, and UX. Cert auth is mainly designed for machine-to-machine traffic and automation like CI/CD.
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...