mirror of
https://github.com/mainnika/nginx-auth-ldap.git
synced 2026-05-22 15:53:39 +00:00
Merge pull request #12 from pavelbrylov/master
Added support for multiple ldap servers, contains non-backwards compatible changes to configuration
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
# LDAP Authentication module for nginx
|
||||
LDAP module for nginx which supports authentication against multiple LDAP servers.
|
||||
|
||||
#Warning
|
||||
This module blocks whole nginx worker while communicating with ldap servers, so it can easily make "bad apache" out of your awesome nginx. But is might be useful if you don't have apache in your stack and don't want to add it, but need ldap auth on separate host (say backoffice or admin panel).
|
||||
|
||||
So use carefully and consider the drawbacks.
|
||||
|
||||
# How to install
|
||||
|
||||
## FreeBSD
|
||||
@@ -25,3 +33,44 @@ in nginx source folder
|
||||
./configure --add-module=path_to_http_auth_ldap_module
|
||||
make install
|
||||
```
|
||||
|
||||
# Example configuration
|
||||
Define list of your LDAP servers with required user/group requirements:
|
||||
|
||||
```bash
|
||||
ldap_server test1 {
|
||||
url ldap://192.168.0.1:3268/DC=test,DC=local?sAMAccountName?sub?(objectClass=person);
|
||||
binddn "TEST\\LDAPUSER";
|
||||
binddn_passwd LDAPPASSWORD;
|
||||
group_attribute uniquemember;
|
||||
group_attribute_is_dn on;
|
||||
require user_valid;
|
||||
}
|
||||
|
||||
ldap_server test2 {
|
||||
url ldap://192.168.0.2:3268/DC=test,DC=local?sAMAccountName?sub?(objectClass=person);
|
||||
binddn "TEST\\LDAPUSER";
|
||||
binddn_passwd LDAPPASSWORD;
|
||||
group_attribute uniquemember;
|
||||
group_attribute_is_dn on;
|
||||
require user_valid;
|
||||
}
|
||||
```
|
||||
|
||||
And add required servers in correct order into your location/server directive:
|
||||
```bash
|
||||
server {
|
||||
listen 8000;
|
||||
server_name localhost;
|
||||
|
||||
auth_ldap "Forbidden";
|
||||
auth_ldap_servers test1;
|
||||
auth_ldap_servers test2;
|
||||
|
||||
location / {
|
||||
root html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
+548
-427
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user