LDAP authentication for Nginx
1.8K
LDAP authentication for Nginx.
docker-nginx-ldap is a modified version of sepa/nginx-ldap that adds compatibility with OpenLDAP and the memberOf schema.
# docker-compose.yml
services:
auth:
container_name: nginx-auth
expose:
- "8888"
image: krautsalad/nginx-ldap
mem_limit: 64m
restart: unless-stopped
volumes:
- ./config/pam_ldap.conf:/etc/pam_ldap.conf:ro
Create a ./config/pam_ldap.conf file with your LDAP server details:
base ou=users,dc=example,dc=com
binddn cn=search,dc=example,dc=com
bindpw VerySecurePassword
host ldap.example.com:636
ssl on
Integrate LDAP authentication into your Nginx site with the following example:
server {
server_name server.example.com;
location / {
auth_request /auth-proxy;
}
location = /auth-proxy {
set $auth nginx-auth:8888;
proxy_set_header X-Ldap-Allowed-Grp cn=server.example.com,ou=groups,dc=example,dc=com;
include custom/defaults_auth.conf;
}
}
Note: For proper name resolution of Docker containers, ensure you have a DNS server running. See krautsalad/dnsmasq for more details on setting up a DNS service.
You can find the full source code on GitHub.
Content type
Image
Digest
sha256:3168349e7…
Size
329.2 MB
Last updated
6 months ago
docker pull krautsalad/nginx-ldap