1
- # LDAP Authentication module for nginx
2
- LDAP module for nginx which supports authentication against multiple LDAP servers.
1
+ # LDAP Authentication module for Nginx
2
+ LDAP module for Nginx which supports authentication against multiple LDAP servers.
3
3
4
4
# How to install
5
5
@@ -18,21 +18,47 @@ Check HTTP_AUTH_LDAP options
18
18
19
19
## Linux
20
20
21
- ``` bash
22
- cd ~ && git clone https://github.com/kvspb/nginx-auth-ldap.git
21
+ Clone this repo or download the ZIP archive.
22
+
23
+ Install ` libssl ` and ` libldap2 ` headers (on Debian/Ubuntu: ` apt install libssl-dev libldap2-dev ` ).
24
+
25
+ You can build this module as an SO, statically compile it into the main ` nginx ` binary or, if using Debian/Ubuntu, build
26
+ and install the deb package.
27
+
28
+ ### Build as an SO
29
+
30
+ - Obtain the Nginx source (on Debian/Ubuntu this can be done with ` apt-get source nginx ` )
31
+ - cd /path/to/nginx/source
32
+ ``` sh
33
+ ./configure ` nginx -V` --with-compat --add-dynamic-module=/path/to/nginx-auth-ldap/source
34
+ cp objs/ngx_http_auth_ldap_module.so /usr/share/nginx/modules/ngx_http_auth_ldap_module.so
35
+ ```
36
+ - Add the below config to Nginx so that it loads the module:
37
+ ``` nginx
38
+ load_module modules/ngx_http_auth_ldap_module.so;
23
39
```
24
40
25
- in nginx source folder
41
+ ### Build & install the deb package
26
42
27
- ``` bash
43
+ ``` sh
44
+ sudo apt install build-essential dpkg-dev libssl-dev libldap2-dev
45
+ cd /path/to/nginx-auth-ldap/source
46
+ dpkg-buildpackage -b -uc
47
+ sudo dpkg -i ../libnginx-mod-http-auth-ldap_1.0.0-1_amd64.deb
48
+ ```
49
+
50
+ ### Statically link into Nginx
51
+
52
+ ``` sh
53
+ cd /path/to/nginx/source
28
54
./configure --add-module=path_to_http_auth_ldap_module
29
55
make install
30
56
```
31
57
32
58
# Example configuration
33
59
Define list of your LDAP servers with required user/group requirements:
34
60
35
- ``` bash
61
+ ``` nginx
36
62
http {
37
63
ldap_server test1 {
38
64
url ldap://192.168.0.1:3268/DC=test,DC=local?sAMAccountName?sub?(objectClass=person);
@@ -55,7 +81,7 @@ Define list of your LDAP servers with required user/group requirements:
55
81
```
56
82
57
83
And add required servers in correct order into your location/server directive:
58
- ``` bash
84
+ ``` nginx
59
85
server {
60
86
listen 8000;
61
87
server_name localhost;
@@ -140,6 +166,6 @@ you'll basically need to run OpenSSL's c_rehash command in this directory.
140
166
expected value: on, off
141
167
142
168
LDAP library default is on. This option disables usage of referral messages from
143
- LDAP server. Usefull for authenticating against read only AD server without access
169
+ LDAP server. Useful for authenticating against read only AD server without access
144
170
to read write.
145
171
0 commit comments