LDAP (Lightweight Directory Access Protocol) is the backbone of enterprise identity management, powering authentication for thousands of applications. But connecting legacy applications directly to your LDAP directory exposes the entire directory tree to every connected service. An LDAP proxy sits between applications and your directory server, intercepting and filtering requests to enforce security policies, add multi-factor authentication, and mask sensitive directory data.
In this guide, we compare three open-source LDAP proxy solutions you can deploy on your own infrastructure: ldapx, privacyIDEA LDAP Proxy, and Kanidm LDAP Proxy. Each addresses different use cases, from packet inspection and transformation to MFA integration and identity federation.
What Is an LDAP Proxy?
An LDAP proxy is an intermediary service that receives LDAP requests from client applications, optionally transforms or validates them, and forwards them to the actual LDAP directory server. The proxy can:
- Filter queries — Restrict which directory attributes or subtrees applications can access
- Transform responses — Map attribute names, format values, or redact sensitive fields
- Add authentication layers — Inject MFA checks, token validation, or certificate verification
- Audit and log — Record all LDAP operations for compliance and forensic analysis
- Cache results — Reduce load on the directory server by caching frequently requested data
- Load balance — Distribute queries across multiple directory replicas
Why Use an LDAP Proxy?
Direct connections between applications and LDAP directories create several operational and security challenges:
Over-privileged access — Applications often receive full directory read access when they only need to validate user credentials. A proxy enforces least-privilege access per application.
Schema incompatibility — Legacy applications expect specific LDAP schemas. A proxy can translate between modern directory schemas and legacy application expectations without modifying the directory.
Audit compliance — Regulations like SOX, HIPAA, and PCI-DSS require detailed authentication logs. A proxy centralizes LDAP audit logging across all applications.
MFA enforcement — Many legacy applications don’t support modern MFA protocols. An LDAP proxy can intercept bind requests and enforce multi-factor authentication before forwarding to the directory.
Directory protection — A proxy shields the directory server from application-level issues like connection leaks, query storms, or malformed requests.
Comparison Table
| Feature | ldapx | privacyIDEA LDAP Proxy | Kanidm LDAP Proxy |
|---|---|---|---|
| Language | Python | Python | Rust |
| GitHub Stars | 210+ | 19+ | 15+ |
| Last Updated | Active (2026) | Active (2024) | Active (2026) |
| MFA Integration | No | privacyIDEA (built-in) | Kanidm (built-in) |
| Packet Inspection | Full packet-level | Bind-level only | Protocol-level |
| Attribute Mapping | Yes (runtime) | Limited | Via Kanidm schema |
| Query Filtering | Yes (transform rules) | Bind filtering | Scope-limited |
| TLS Support | Yes | Yes | Yes |
| Load Balancing | No | No | Via Kanidm cluster |
| Audit Logging | Yes (detailed) | Yes (auth events) | Yes (full audit) |
| Docker Support | Yes | Yes | Yes |
| Directory Support | Any LDAPv3 | Any LDAPv3 | Kanidm only |
| License | MIT | AGPL-3.0 | MPL-2.0 |
ldapx: Flexible LDAP Packet Inspector
ldapx is a flexible LDAP proxy written in Python that enables real-time inspection and transformation of all LDAP packets flowing between clients and directory servers. It uses a rule-based transformation engine that lets you modify requests and responses on the fly.
Installation
| |
Docker Compose Deployment
| |
Key Features
- Runtime transformation rules — Define Python-based rules that modify LDAP packets in real-time
- Full packet inspection — See and modify every LDAP operation: bind, search, modify, add, delete
- Attribute masking — Redact or hash sensitive attributes like passwords, SSNs, or phone numbers
- Query rewriting — Transform client queries to match different directory schemas
- No vendor lock-in — Works with any LDAPv3-compliant directory server
Example Configuration
| |
privacyIDEA LDAP Proxy: MFA for Legacy Applications
privacyIDEA LDAP Proxy is an LDAP proxy that integrates with the privacyIDEA multi-factor authentication platform. It intercepts LDAP bind requests and requires users to provide an OTP token value before forwarding authentication to the backend directory.
Installation
| |
Docker Compose Deployment
| |
Key Features
- OTP integration — Requires users to append their OTP to their password during LDAP bind
- privacyIDEA ecosystem — Leverages privacyIDEA’s extensive token types (HOTP, TOTP, Yubikey, SMS, email)
- Resolver-based — Maps LDAP users to privacyIDEA tokens via configurable resolvers
- Audit trail — Every authentication attempt is logged in privacyIDEA’s audit system
- Fallback modes — Configure grace periods or bypass rules for emergency access
Configuration Example
| |
Kanidm LDAP Proxy: Modern Identity Federation
Kanidm LDAP Proxy is a lightweight proxy that bridges legacy LDAP applications to the modern Kanidm identity platform. It translates LDAP protocol requests into Kanidm’s native API calls, allowing applications that only understand LDAP to authenticate against Kanidm’s modern identity store.
Installation
| |
Docker Compose Deployment
| |
Key Features
- Kanidm integration — Native support for Kanidm’s modern identity management features
- OAuth/OIDC backend — Uses Kanidm’s OAuth2/OIDC APIs for authentication
- SCIM support — Synchronizes user data via Kanidm’s SCIM interface
- Modern security — Inherits Kanidm’s security model including passkey and WebAuthn support
- Migration path — Enables gradual migration from legacy LDAP to modern identity platforms
Configuration
| |
Choosing the Right LDAP Proxy
| Use Case | Recommended Tool | Reason |
|---|---|---|
| Legacy app MFA enforcement | privacyIDEA LDAP Proxy | Purpose-built for OTP integration |
| Packet-level inspection | ldapx | Full LDAP packet transformation |
| Modern identity migration | Kanidm LDAP Proxy | Bridges LDAP to modern identity |
| Attribute masking | ldapx | Runtime rule-based transformations |
| Compliance auditing | privacyIDEA LDAP Proxy | Comprehensive auth audit trail |
| Schema translation | ldapx | Flexible query/response rewriting |
Security Best Practices
- TLS everywhere — Encrypt connections between clients, proxy, and directory server
- Service accounts — Use dedicated proxy bind accounts with minimal directory permissions
- Rate limiting — Protect against brute-force attacks by throttling bind requests
- Network segmentation — Place the proxy in a DMZ between applications and the directory
- Secret management — Store proxy credentials in a secrets manager, not configuration files
- Regular rotation — Rotate proxy bind passwords on a scheduled basis
Why Self-Host Your LDAP Proxy?
Deploying an LDAP proxy on your own infrastructure is essential for organizations that need to maintain control over authentication flows. When you self-host the proxy, every authentication decision, attribute mapping, and audit log stays within your security boundary. This is particularly important for compliance frameworks that require detailed authentication records — third-party proxy services often cannot provide the level of log retention and access control that auditors demand.
Integration with existing identity infrastructure is another key driver. Self-hosted LDAP proxies can connect to your internal PKI for mutual TLS authentication, integrate with your SIEM for real-time alerting on suspicious bind patterns, and leverage your internal secrets manager for credential storage. These integrations are typically impossible or severely limited with cloud-hosted alternatives.
Performance considerations also favor self-hosting. LDAP bind operations are latency-sensitive — even a few milliseconds of additional network round-trip time can impact user experience during login. Running the proxy on the same network segment as your applications and directory server minimizes latency and eliminates dependency on external network connectivity.
Customization is the final advantage. Every organization has unique directory schemas, attribute mappings, and authentication requirements. A self-hosted proxy can be tailored to your exact specifications — custom transformation rules, organization-specific audit formats, and integration with proprietary identity systems.
For identity management platforms, see our Logto vs SuperTokens vs Ory Kratos comparison. For multi-factor authentication servers, check our privacyIDEA vs LinOTP vs 2FAuth guide. For secrets management, our Vault vs SOPS vs Sealed Secrets article covers credential storage patterns.
FAQ
What is the difference between an LDAP proxy and an LDAP gateway?
An LDAP proxy operates at the protocol level, intercepting and forwarding LDAP packets while optionally transforming them. An LDAP gateway typically translates between LDAP and other protocols (like REST APIs or SAML). Proxies maintain LDAP compatibility; gateways enable protocol translation.
Can an LDAP proxy add MFA to applications that don’t support it?
Yes. The privacyIDEA LDAP Proxy specifically does this by intercepting LDAP bind requests and requiring an OTP token before forwarding authentication to the backend directory. Users append their OTP to their normal password, and the proxy validates it with the MFA server.
Does an LDAP proxy protect against LDAP injection attacks?
Yes, to some extent. Proxies like ldapx can inspect and sanitize LDAP search filters, removing or escaping characters that could be used in injection attacks. However, the primary defense should be proper input validation in the application itself.
Can I use an LDAP proxy with Active Directory?
All three tools support LDAPv3, which is the protocol used by Active Directory. However, AD-specific features like Kerberos authentication and Global Catalog queries may require additional configuration.
How does an LDAP proxy handle TLS/SSL connections?
LDAP proxies typically operate in one of two modes: they either terminate TLS from the client and establish a new TLS connection to the backend (TLS bridging), or they pass through encrypted traffic without inspection (TLS tunneling). The choice depends on whether the proxy needs to inspect packet contents.
What happens if the LDAP proxy goes down?
Most deployments configure applications with both the proxy address and the direct directory server address as a fallback. However, this bypasses the proxy’s security controls. For high availability, deploy multiple proxy instances behind a load balancer.