# nginx-ldap-auth

> Self-hosted reference for adding LDAP auth to NGINX via auth_request module, with Python daemon and sample config.

- **Category:** Authentication
- **Licence:** BSD-2-Clause
- **Latest version:** release-0.0.5
- **Open source:** oss
- **Languages:** Perl, Python
- **Platforms:** Docker
- **Tags:** Nginx, LDAP, Authentication, Docker, Python, Active Directory, Openldap, Auth Request, Reference Implementation

## Description

This NGINX, Inc. project shows how to add LDAP user authentication to applications behind NGINX or NGINX Plus. It supplies a Python daemon that sits between NGINX's auth_request module and an LDAP directory (OpenLDAP or Active Directory), a test backend, and a ready-to-use NGINX config. The code is a reference model, not production-ready, but demonstrates cookie and basic auth, STARTTLS, result caching, and flexible LDAP search filters. Default ports are 8888 for the daemon, 8081 for NGINX, and 9000 for the sample backend. You can run it via Docker, directly with Python 2 or 3, or with the included control script.

## Links

- [Homepage](https://github.com/nginxinc/nginx-ldap-auth)
- [GitHub Repository](https://github.com/nginxinc/nginx-ldap-auth)
- [NGINX Blog: LDAP Authentication Flow](https://nginx.com/blog/nginx-plus-authenticate-users#ldap-auth-flow)
- [NGINX Blog: Configuring the Reference Implementation](https://nginx.com/blog/nginx-plus-authenticate-users#ldap-auth-configure)

---
Source: https://selfhost.directory/project/nginx-ldap-auth