LDAP auth integrates Vault token issuance with an existing corporate directory (Active Directory or OpenLDAP). The biggest benefit is that you can assign policies through existing groups without adding new local users.
Based on HashiCorp Vault's official behavior, this article covers the concepts most often tested on the Vault Associate exam alongside the points teams commonly miss in real deployments.
LDAP is one of Vault's auth methods. It delegates password verification to the directory and issues a Vault token on successful authentication. By mapping directory groups to Vault policies, you can centralize authorization management.
Stable prerequisites: an LDAP/LDAPS connection, a bind account for searches (avoid anonymous bind), clearly defined user and group DN scopes, and configured TLS trust. The exam frequently asks where policies are attached and what gets configured at which endpoint.
High-level LDAP authentication flow
URL and TLS: use ldaps:// or ldap:// + starttls=true. Either way, pass a trusted CA via certificate and keep insecure_tls set to false.
Bind for searching: specify binddn and bindpass to search for users and groups. Set deny_null_bind=true to explicitly reject anonymous binds.
User and group scope: configure userdn (e.g. ou=Users,dc=example,dc=com) and groupdn. userattr is typically uid for OpenLDAP and sAMAccountName for AD. Enabling discoverdn=true makes it easier to resolve a DN from a username.
1) Enable the auth method: enable it with an explicit path (e.g. auth/ldap/).
2) Configure the connection: set the LDAP/LDAPS URL, binddn, search scope, and TLS trust.
3) Map policies: associate directory group names with Vault policies (by group as the default).
CLI example for configuration and testing
vault auth enable -path=ldap ldap
vault write auth/ldap/config \
url="ldaps://ldap.example.com:636" \
binddn="cn=vault-bind,ou=svc,dc=example,dc=com" \
bindpass="s3cr3t" \
userdn="ou=users,dc=example,dc=com" \
userattr="uid" \
groupdn="ou=groups,dc=example,dc=com" \
groupfilter="(&(objectClass=groupOfNames)(member={{.UserDN}}))" \
starttls=false \
insecure_tls=false \
certificate=@/etc/ssl/certs/ldap-ca.pem \
discoverdn=true \
deny_null_bind=true
# Map groups to policies
vault write auth/ldap/groups/platform-admin policies="admin,kv-ro"
vault write auth/ldap/groups/dev policies="default,kv-ro"
# Optionally override per user (keep to a minimum)
# vault write auth/ldap/users/alice policies="breakglass"
# Login test
echo "<password>" | vault login -method=ldap -format=json username=alice
# Tune the auth method (e.g. token type)
vault auth tune -token-type=default-service ldap/Because schemas and attribute names differ, the right userattr and groupfilter are not the same for AD and OpenLDAP. AD typically uses sAMAccountName or UPN, the group member attribute, and the matching rule for nested groups (1.2.840.113556.1.4.1941). For OpenLDAP, the filter depends on whether you use groupOfNames or posixGroup along with uid.
Vault searches for groups using groupfilter and attaches policies via the auth/ldap/groups/<name> mapping against the returned group names. Whether you use the {{.UserDN}} or {{.Username}} template variable in groupfilter depends on what the directory's group entries contain (DN vs. name).
| Item | Active Directory example | OpenLDAP example | Notes |
|---|---|---|---|
| userattr | sAMAccountName | uid | Corresponds to the login username |
| group object | group | groupOfNames / posixGroup | Varies by deployment |
| groupfilter (basic) | (&(objectClass=group)(member={{.UserDN}})) | (&(objectClass=groupOfNames)(member={{.UserDN}})) | For posixGroup use memberUid={{.Username}} |
| Nested groups | (&(objectClass=group)(member:1.2.840.113556.1.4.1941:={{.UserDN}})) | Implementation-dependent (not supported by the standard) | AD-specific in-chain matching rule |
| UPN login | userattr=userPrincipalName (can be combined with upndomain) | — | Choose based on environment requirements |
Filter examples by use case
# AD: direct group membership
(&(objectClass=group)(member={{.UserDN}}))
# AD: membership including nested groups (in-chain)
(&(objectClass=group)(member:1.2.840.113556.1.4.1941:={{.UserDN}}))
# OpenLDAP: groupOfNames
(&(objectClass=groupOfNames)(member={{.UserDN}}))
# OpenLDAP: posixGroup (match by username)
(&(objectClass=posixGroup)(memberUid={{.Username}}))Credential rotation: rotate bindpass on a schedule and automate login tests after applying the change to detect failures early. Provide a mechanism to safely run vault write from CI/CD.
Certificate operations: when the LDAP server's CA changes, update the certificate parameter before switching over to avoid disruption. Avoid the pattern of temporarily setting insecure_tls=true to muddle through.
Auditing: enable a Vault audit device (file/syslog/etc.) and record events for writes to auth/ldap/login. If failures persist, correlate against the LDAP server's logs.
Representative operational commands
# Rotate the bind password
vault write auth/ldap/config \
binddn="cn=vault-bind,ou=svc,dc=example,dc=com" \
bindpass="<new-password>"
# Detailed list of LDAP auth methods
vault auth list -detailed
# Audit (example: file output)
vault audit enable file file_path=/var/log/vault_audit.logCan you name where policies are attached? You write policies at auth/ldap/groups/<groupname> or users/<username>. groupfilter itself is just a search condition; policy attachment is a separate concept.
Login path: users log in with vault login -method=ldap username=<name> (or auth/ldap/login/<name>). The user's password is not stored in Vault (it is verified by LDAP).
TLS basics: do not use insecure_tls in production; provide trust via certificate. If you use ldap://, set starttls=true.
Associate
問題 1
You want to integrate Vault with an existing LDAP and attach Vault policies per LDAP group. Which is the correct configuration location?
正解: A
Policies are attached at auth/ldap/groups/<name> (or users/<name>). groupfilter is a group search condition, not the place to define policies.
Does Vault store LDAP user passwords?
No. At login time Vault binds to and searches LDAP, using only the success/failure result of the bind. On success, Vault issues a token.
Should I use StartTLS or LDAPS?
Either is fine, but always enable TLS in production. Match your existing operations: use ldap:// + starttls=true (389/TCP) or ldaps:// (636/TCP), and supply a trusted CA via the certificate parameter.
Our groups are nested. Can Vault handle that?
This is expressed in the LDAP groupfilter, not by a Vault feature. For Active Directory, configure a filter using the in-chain matching rule (1.2.840.113556.1.4.1941), then create auth/ldap/groups mappings for the returned group names.
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...