LDAP MFA

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up ldap mfa by linking your directory to a second factor tool. The system checks a password and a one-time code before a user logs in. Most teams add a radius server or sync users to a cloud provider. This step stops stolen passwords from working on their own. Still, broad directory groups often give users too many rights after they log in. How ldap mfa works in your stack The standard directory protocol checks usernames and passwords through a simple bind request. It does not have a

LDAP Directory Services: 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 ldap mfa by linking your directory to a second factor tool. The system checks a password and a one-time code before a user logs in. Most teams add a radius server or sync users to a cloud provider. This step stops stolen passwords from working on their own. Still, broad directory groups often give users too many rights after they log in.

How ldap mfa works in your stack

The standard directory protocol checks usernames and passwords through a simple bind request. It does not have a built-in way to ask for a second code. To fix this, admins place a helper service in the login path. When a user tries to log in, the app talks to this service. The service checks the password against the main directory first. Next, it sends a push prompt or asks for a six-digit code. Some teams ask users to type their password and code in one field. Once both checks pass, the directory returns a success message to the app. The app then reads the user groups and grants the matching role. Teams also sync directory groups to modern identity providers using standard web flows. This setup lets older databases and internal tools use modern login checks.

What native directory checks solve and what they miss

Adding a second factor to directory logins solves a huge security problem. Attackers cannot use a leaked password alone to get into your network. It also helps security teams meet strict audit rules for user logins. Yet directory checks only work at the very start of a session. Once the bind succeeds, the directory steps out of the way. It cannot see what queries or commands the user runs next. Most teams map broad directory groups to high database roles for ease. A developer might log in with two factors and get full write rights. That person can still drop a table or read a million rows. Native logs only show that the user logged in at a certain time. They do not record the actual SQL statements or shell commands run. Also, shared service accounts often bypass two-factor prompts so scripts do not break. If someone steals a service password, they skip the second check. Also, sensitive data like emails, phone numbers, and card numbers flows back in plain text. You need controls that inspect each command and mask sensitive fields in results.

How to keep directory roles tight and safe

Start by auditing every group in your directory tree. Remove users from broad admin groups that they do not need each day. Split read roles from write roles for every database and server. Put service accounts in their own unit and watch their login logs. Set short session times so users must check in again often. Pair your login checks with tools that watch queries in flight. When you control the command level, a wide group role causes less harm. Masking rules can also rewrite national IDs and card numbers in query results.

LDAP Directory Services: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

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 sits inline in the wire protocol beside those services as an open-source proxy, a sidecar for your Postgres or API. On every query an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run, and hoop.dev data masking rewrites matched sensitive values in responses 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

Can standard LDAP ask for a second factor by itself?

No, the base protocol only checks a username and password in a bind request. You must link it to a radius service or an identity provider for codes.

How do users enter one-time codes with older database clients?

Many setups let users type their password followed by the six-digit code together. Other setups trigger an automatic push alert to the user phone during login.

Does ldap mfa protect data after a database session starts?

No, it only checks who logs in at the start of the session. It does not block bad queries or rewrite emails and card numbers in results.

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.