Vault
HomeDocumentationTutorialsTry Cloud!
  • Vault
  • Documentation
    • What is Vault?
    • Use Cases
    • Setup
      • Install
      • Configuration
    • Get Started
      • Starting the server
      • Your first secret
      • Deploying Vault on VMs with Let's encrypt! TLS certs
    • Concepts
      • Operations
        • Seal/Unseal
        • "Dev" server mode
        • Namespace lock and unlock
        • Lease, renew, and revoke
        • Lease Explosions
        • Mount migration
        • Client count
        • Resource quotas
        • Response wrapping
      • Authentication
        • Identity
        • Tokens
        • OIDC provider
        • Username templating
        • Passwordless
      • Secrets
      • Storage
        • Integrated storage
        • High availability mode (HA)
        • Recovery mode
      • Policies
  • Tutorials
    • CLI
      • Operations
        • Deploy Vault
        • Using the HTTP API
        • Unseal/Seal
      • Authentication
        • Token
        • GitHub authentication
        • Username/Password
        • TLS Client Certificates
        • SSH Keys
        • AWS, Azure, GCP and external auth methods
          • Azure
          • AWS
          • GCP
          • Github
          • Terraform
      • Secrets
        • Secrets engines
        • Built-in help
      • Access Control
        • Policies
    • UI
      • Authentication
        • Username/Password
        • Passwordless
      • Operations
        • Unseal / Seal
        • API Explorer
      • Secrets
        • Secrets engines
      • Access Control
        • Policies
    • Use Cases
      • Namespaces
      • MongoDB admin password
      • VM Disk Encryption Keys
      • VM SSH Keys
      • Kubernetes Configuration
      • GitHub Actions
      • Dynamic credentials for cloud providers
        • AWS
        • Azure
        • GCP
  • CLI
    • agent
    • audit
    • auth
    • debug
    • delete
    • events
    • kv
    • lease
    • license
    • list
    • login
    • monitor
    • namespace
    • operator
    • patch
    • path-help
    • pki
    • plugin
    • policy
    • print
    • proxy
    • read
    • secrets
    • server
    • ssh
    • status
    • token
    • transit
    • unwrap
    • version
    • version-history
    • write
  • API
    • Secrets engines
      • AliCloud secrets engine (API)
      • AWS secrets engine (API)
      • Azure secrets engine (API)
      • Cubbyhole secrets engine (API)
      • Database
        • Cassandra database plugin HTTP API
        • Elasticsearch database plugin HTTP API
        • Influxdb database plugin HTTP API
        • MongoDB database plugin HTTP API
        • MSSQL database plugin HTTP API
        • MySQL/MariaDB database plugin HTTP API
        • Oracle database plugin HTTP API
        • PostgreSQL database plugin HTTP API
        • Redis database plugin HTTP API
        • Redis ElastiCache database plugin HTTP API
        • Redshift database plugin HTTP API
        • Snowflake database plugin HTTP API
      • Google Cloud secrets engine (API)
      • Google Cloud KMS secrets engine (API)
      • Identity
        • entity
        • entity-alias
        • group
        • group-alias
        • tokens
        • lookup
        • oidc-provider
        • MFA
          • duo
          • okta
          • pingid
          • totp
          • login-enforcement
      • KV secrets engine (API)
      • Buckypaper secrets engine
      • Kubernetes secrets engine (API)
      • Nomad secrets engine (API)
      • LDAP secrets engine (API)
      • PKI secrets engine (API)
      • RabbitMQ secrets engine (API)
      • SSH secrets engine (API)
      • TOTP secrets engine (API)
      • Transit secrets engine (API)
    • Auth engines
      • AliCloud auth method (API)
      • AppRole auth method (API)
      • AWS auth method (API)
      • Azure auth method (API)
      • Pivotal Cloud Foundry (CF) auth method (API)
      • GitHub auth method (API)
      • Google Cloud auth method (API)
      • JWT/OIDC auth method (API)
      • Kerberos auth method (API)
      • Kubernetes auth method (API)
      • LDAP auth method (API)
      • OCI auth method (API)
      • Okta auth method (API)
      • Passwordless auth method (API)
      • RADIUS auth method (API)
      • TLS certificate auth method (API)
      • Token auth method (API)
      • Userpass auth method (HTTP API)
    • Service engines
      • Licence Manager
    • System backend
      • /sys/audit
      • /sys/audit-hash
      • /sys/auth
      • /sys/capabilities
      • /sys/capabilities-accessor
      • /sys/capabilities-self
      • /sys/config/auditing/request-headers
      • /sys/config/control-group
      • /sys/config/cors
      • /sys/config/reload
      • /sys/config/state
      • /sys/config/ui
      • /sys/decode-token
      • /sys/experiments
      • /sys/generate-recovery-token
      • /sys/generate-root
      • /sys/health
      • /sys/host-info
      • /sys/in-flight-req
      • /sys/init
      • /sys/internal/counters
      • /sys/internal/inspect
        • /sys/internal/inspect/router
      • /sys/internal/specs/openapi
      • /sys/internal/ui/feature-flags
      • /sys/internal/ui/mounts
      • /sys/internal/ui/namespaces
      • /sys/internal/ui/resultant-acl
      • /sys/key-status
      • /sys/ha-status
      • /sys/leader
      • /sys/leases
      • /sys/license/status
      • /sys/locked-users
      • /sys/loggers
      • /sys/metrics
      • /sys/monitor
      • /sys/mounts
      • /sys/namespaces
      • /sys/plugins/reload/backend
      • /sys/plugins/catalog
      • /sys/plugins/runtimes/catalog
      • /sys/policy
      • /sys/policies/
      • /sys/policies/password/
      • /sys/pprof
      • /sys/quotas/config
      • /sys/quotas/rate-limit
      • /sys/quotas/lease-count
      • /sys/raw
      • /sys/rekey
      • /sys/rekey-recovery-key
      • /sys/remount
      • /sys/rotate
      • /sys/rotate/config
      • /sys/seal
      • /sys/seal-status
      • /sys/seal-backend-status
      • /sys/step-down
      • /sys/storage
        • /sys/storage/raft
        • /sys/storage/raft/autopilot
      • /sys/tools
      • /sys/unseal
      • /sys/version-history
      • /sys/wrapping/lookup
      • /sys/wrapping/rewrap
      • /sys/wrapping/unwrap
      • /sys/wrapping/wrap
  • Resources
    • Blog
    • GitHub
    • Youtube
    • CCx101
Powered by GitBook
On this page
  • Create CA certificate role
  • Read CA certificate role
  • List certificate roles
  • Delete certificate role
  • List CRLs
  • Create CRL
  • Read CRL
  • Delete CRL
  • Configure TLS certificate method
  • Login with TLS certificate method
  1. API
  2. Auth engines

TLS certificate auth method (API)

PreviousRADIUS auth method (API)NextToken auth method (API)

Last updated 1 year ago

This is the API documentation for the Vault TLS Certificate authentication method. For general information about the usage and operation of the TLS Certificate method, please see the Vault TLS Certificate method documentation.

This documentation assumes the TLS Certificate method is mounted at the /auth/cert path in Vault. Since it is possible to enable auth methods at any location, please update your API calls accordingly.

Create CA certificate role

Sets a CA cert and associated parameters in a role name.

Method
Path

POST

/auth/cert/certs/:name

Parameters

  • name (string: <required>) - The name of the certificate role.

  • certificate (string: <required>) - The PEM-format CA certificate.

  • allowed_names (string: "") - DEPRECATED: Please use the individual allowed_X_sans parameters instead. Constrain the Common and Alternative Names in the client certificate with a . Value is a comma-separated list of patterns. Authentication requires at least one Name matching at least one pattern. If not set, defaults to allowing all names.

  • allowed_common_names (string: "" or array: []) - Constrain the Common Names in the client certificate with a . Value is a comma-separated list of patterns. Authentication requires at least one Name matching at least one pattern. If not set, defaults to allowing all names.

  • allowed_dns_sans (string: "" or array: []) - Constrain the Alternative Names in the client certificate with a . Value is a comma-separated list of patterns. Authentication requires at least one DNS matching at least one pattern. If not set, defaults to allowing all dns.

  • allowed_email_sans (string: "" or array: []) - Constrain the Alternative Names in the client certificate with a . Value is a comma-separated list of patterns. Authentication requires at least one Email matching at least one pattern. If not set, defaults to allowing all emails.

  • allowed_uri_sans (string: "" or array: []) - Constrain the Alternative Names in the client certificate with a . Value is a comma-separated list of URI patterns. Authentication requires at least one URI matching at least one pattern. If not set, defaults to allowing all URIs.

  • allowed_organizational_units (string: "" or array: []) - Constrain the Organizational Units (OU) in the client certificate with a . Value is a comma-separated list of OU patterns. Authentication requires at least one OU matching at least one pattern. If not set, defaults to allowing all OUs.

  • required_extensions (string: "" or array: []) - Require specific Custom Extension OIDs to exist and match the pattern. Value is a comma separated string or array of oid:value. Expects the extension value to be some type of ASN1 encoded string. All conditions must be met. To match on the hex-encoded value of the extension, including non-string extensions, use the format hex:<oid>:<value>.Supports globbing on value.

  • allowed_metadata_extensions (array:[]) - A comma separated string or array of oid extensions. Upon successful authentication, these extensions will be added as metadata if they are present in the certificate. The metadata key will be the string consisting of the oid numbers separated by a dash (-) instead of a dot (.) to allow usage in ACL templates.

  • ocsp_enabled (bool: false) - If enabled, validate certificates' revocation status using OCSP.

  • ocsp_ca_certificates (string: "") Any additional CA certificates needed to verify OCSP responses. Provided as base64 encoded PEM data.

  • ocsp_servers_override (array: []): A comma-separated list of OCSP server addresses. If unset, the OCSP server is determined from the AuthorityInformationAccess extension on the certificate being inspected.

  • ocsp_fail_open (bool: false) - If true and an OCSP response cannot be fetched or is of an unknown status, the login will proceed as if the certificate has not been revoked.

  • ocsp_query_all_servers (bool: false) - If set to true, rather than accepting the first successful OCSP response, query all servers and consider the certificate valid only if all servers agree.

    ~> Note: When using Vault's PKI engine with Performance Replication clusters as the OCSP provider, and without unified_crls=true set on the source mount or when using cluster-local OCSP resolvers, we recommend enabling this option.

  • display_name (string: "") - The display_name to set on tokens issued when authenticating against this CA certificate. If not set, defaults to the name of the role.

@include 'tokenfields.mdx'

Sample payload

{
  "certificate": "-----BEGIN CERTIFICATE-----\nMIIEtzCCA5+.......ZRtAfQ6r\nwlW975rYa1ZqEdA=\n-----END CERTIFICATE-----",
  "display_name": "test",
  "bound_cidrs": ["127.0.0.1/32", "128.252.0.0/16"]
}

Sample request

$ curl \
    --header "X-Vault-Token: ..." \
    --request POST \
    --cacert vault-ca.pem \
    --data @payload.json
    https://127.0.0.1:8200/v1/auth/cert/certs/test-ca

Read CA certificate role

Gets information associated with the named role.

Method
Path

GET

/auth/cert/certs/:name

Parameters

  • name (string: <required>) - The name of the certificate role.

Sample request

$ curl \
    --header "X-Vault-Token: ..." \
    --cacert vault-ca.pem \
    https://127.0.0.1:8200/v1/auth/cert/certs/test-ca

Sample response

{
  "lease_id": "",
  "renewable": false,
  "lease_duration": 0,
  "data": {
    "certificate": "-----BEGIN CERTIFICATE-----\nMIIEtzCCA5+.......ZRtAfQ6r\nwlW975rYa1ZqEdA=\n-----END CERTIFICATE-----",
    "display_name": "test",
    "policies": "",
    "allowed_names": "",
    "required_extensions": "",
    "ttl": 2764800,
    "max_ttl": 2764800,
    "period": 0
  },
  "warnings": null,
  "auth": null
}

List certificate roles

Lists configured certificate names.

Method
Path

LIST

/auth/cert/certs

Sample request

$ curl \
    --header "X-Vault-Token: ..." \
    --request LIST \
    --cacert vault-ca.pem \
    https://127.0.0.1:8200/v1/auth/cert/certs

Sample response

{
  "auth": null,
  "warnings": null,
  "wrap_info": null,
  "data": {
    "keys": ["cert1", "cert2"]
  },
  "lease_duration": 0,
  "renewable": false,
  "lease_id": ""
}

Delete certificate role

Deletes the named role and CA cert from the method mount.

Method
Path

DELETE

/auth/cert/certs/:name

Parameters

  • name (string: <required>) - The name of the certificate role.

Sample request

$ curl \
    --header "X-Vault-Token: ..." \
    --request DELETE \
    --cacert vault-ca.pem \
    https://127.0.0.1:8200/v1/auth/cert/certs/cert1

List CRLs

Lists configured certificate revocation lists.

Method
Path

LIST

/auth/cert/crls

Sample request

$ curl \
    --header "X-Vault-Token: ..." \
    --request LIST \
    --cacert vault-ca.pem \
    https://127.0.0.1:8200/v1/auth/cert/crls

Sample response

{
  "auth": null,
  "warnings": null,
  "wrap_info": null,
  "data": {
    "keys": ["crl1", "crl2"]
  },
  "lease_duration": 0,
  "renewable": false,
  "lease_id": ""
}

Create CRL

Sets a named CRL.

Method
Path

POST

/auth/cert/crls/:name

Parameters

  • name (string: <required>) - The name of the CRL.

  • crl (string: "") - The PEM format CRL.

  • url (string: "") - The URL of a CRL distribution point.

Note: Either 'crl' or 'url' parameters must be provided, if both are provided, 'crl' is used.

Sample payload

{
  "crl": "-----BEGIN X509 CRL-----\n...\n-----END X509 CRL-----"
}

Sample request

$ curl \
    --header "X-Vault-Token: ..." \
    --request POST \
    --cacert vault-ca.pem \
    --data @payload.json \
    https://127.0.0.1:8200/v1/auth/cert/crls/custom-crl

Read CRL

Gets information associated with the named CRL (currently, the serial numbers contained within). As the serials can be integers up to an arbitrary size, these are returned as strings.

Method
Path

GET

/auth/cert/crls/:name

Parameters

  • name (string: <required>) - The name of the CRL.

Sample request

$ curl \
    --header "X-Vault-Token: ..." \
    --cacert vault-ca.pem \
    https://127.0.0.1:8200/v1/auth/cert/crls/custom-crl

Sample response

{
  "auth": null,
  "data": {
    "serials": {
      "13": {}
    }
  },
  "lease_duration": 0,
  "lease_id": "",
  "renewable": false,
  "warnings": null
}

Delete CRL

Deletes the named CRL from the auth method mount.

Method
Path

DELETE

/auth/cert/crls/:name

Parameters

  • name (string: <required>) - The name of the CRL.

Sample request

$ curl \
    --header "X-Vault-Token: ..." \
    --request DELETE \
    --cacert vault-ca.pem \
    https://127.0.0.1:8200/v1/auth/cert/crls/cert1

Configure TLS certificate method

Configuration options for the method.

Method
Path

POST

/auth/cert/config

Parameters

  • disable_binding (boolean: false) - If set, during renewal, skips the matching of presented client identity with the client identity used during login.

  • enable_identity_alias_metadata (boolean: false) - If set, metadata of the certificate including the metadata corresponding to allowed_metadata_extensions will be stored in the alias

  • ocsp_cache_size (int: 100) - The size of the OCSP response LRU cache. Note that this cache is used for all configured certificates.

Sample payload

{
  "disable_binding": true
}

Sample request

$ curl \
    --header "X-Vault-Token: ..." \
    --request POST \
    --cacert vault-ca.pem \
    --data @payload.json \
    https://127.0.0.1:8200/v1/auth/cert/certs/cert1

Login with TLS certificate method

Log in and fetch a token. If there is a valid chain to a CA configured in the method and all role constraints are matched, a token will be issued. If the certificate has DNS SANs in it, each of those will be verified. If Common Name is required to be verified, then it should be a fully qualified DNS domain name and must be duplicated as a DNS SAN (see https://tools.ietf.org/html/rfc6125#section-2.3)

Method
Path

POST

/auth/cert/login

Parameters

  • name (string: "") - Authenticate against only the named certificate role, returning its policy list if successful. If not set, defaults to trying all certificate roles and returning any one that matches.

Sample payload

{
  "name": "cert1"
}

Sample request

~> NOTE The --cacert value used here is for the Vault TLS Listener CA certificate, not the CA that issued the client authentication certificate. This can be omitted if the CA used to issue the Vault server certificate is trusted by the local system executing this command.

$ curl \
    --request POST \
    --cacert vault-ca.pem \
    --cert cert.pem \
    --key key.pem \
    --data @payload.json \
    https://127.0.0.1:8200/v1/auth/cert/login

Sample response

{
  "auth": {
    "client_token": "cf95f87d-f95b-47ff-b1f5-ba7bff850425",
    "policies": ["web", "stage"],
    "lease_duration": 3600,
    "renewable": true
  }
}
globbed pattern
globbed pattern
globbed pattern
globbed pattern
globbed pattern
globbed pattern