Vault LDAP Auth

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up vault ldap auth by linking your secret server to a directory service. Then you map directory groups to secret policies so users log in with existing accounts. Teams often map whole job groups to broad read and write roles. When a role is too wide, any user in that group can pull every secret inside a shared folder. This creates risk when an engineer only needs one database credential for a quick fix. How vault ldap auth works HashiCorp Vault uses an auth method to check user logins

LDAP Directory Services + HashiCorp Vault: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

You set up vault ldap auth by linking your secret server to a directory service. Then you map directory groups to secret policies so users log in with existing accounts. Teams often map whole job groups to broad read and write roles. When a role is too wide, any user in that group can pull every secret inside a shared folder. This creates risk when an engineer only needs one database credential for a quick fix.

How vault ldap auth works

HashiCorp Vault uses an auth method to check user logins against an external directory. First, an admin enables the directory login method inside the secret store. Next, the admin sets the directory server address and the bind credentials. The secret server uses this bind account to search the directory for user records.

When an engineer tries to log in, they send their directory username and password. The secret server searches the directory to find the user object. Then it binds as that user to check the password. After the password check passes, the server queries the directory for the groups of that user.

Finally, the secret server matches those directory groups to internal policy names. It returns a client token with those policies attached. The user then uses this token to read keys or database passwords from the store.

Mapping directory groups to secret policies

Good group mapping keeps secret roles small and clear. Teams create directory groups that match specific teams or apps. For example, a payment team group maps to a payment policy. That policy only allows reading secrets under the payment folder path.

Admins also set token time limits on the auth method. A short time limit forces the user to log in again after a few hours. If an admin removes a user from the directory group, the next login fails. Current tokens still work until they expire or an admin revokes them.

Many teams struggle when directory groups grow too large over time. People change teams, or contractors join a general engineering group for one task. Soon, the base engineering group maps to policies for ten different databases. Everyone in that group can now fetch raw passwords for all ten databases.

LDAP Directory Services + HashiCorp Vault: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What directory login solves and what keeps the session active

Directory login stops teams from managing separate usernames and passwords inside the secret store. It lets security teams turn off an account in one central directory. It also ties secret retrieval logs back to a known directory user.

Still, this login method only checks who can pull a secret from the store. Once an engineer reads a database password or key, the secret store steps out. The engineer pastes that password into a local client and runs queries directly.

The secret store cannot see which SQL statements or shell commands the user runs next. It cannot block a drop table command or mask emails and card numbers in query results. To control live sessions, teams need controls at the command and query level, not just at secret retrieval.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

How does HashiCorp Vault check directory passwords?

The server uses a service bind account to find the user record in the directory. Then it performs a bind request using the distinguished name and password of that user.

What happens when a user leaves a directory group?

The user will not get that group policy on their next login. Still, any active token keeps its old policies until the token expires or gets revoked.

Does directory login control what users do with retrieved secrets?

No, directory login only controls who can sign in and read secrets from the store. Once a user copies a database password, the secret store cannot monitor or restrict their database queries.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.