nginx LDAP with Foxpass

1. Install the nginx module

This is the module: https://github.com/kvspb/nginx-auth-ldap

Here are the instructions: http://deezx.github.io/blog/2015/04/24/how-to-configure-nginx-with-ldap-authentication/

2. Set up your nginx config

(Assuming our foxpass binder is "cn=nginx,dc=example,dc=com")

Add this in the 'http' section on the main nginx.conf

http {
...
...
...

ldap_server foxpass {
    url "ldaps://ldap.foxpass.com:636/dc=example,dc=com?uid?sub?";
    binddn "cn=myapp,dc=example,dc=com";
    binddn_passwd "YOURPASSWORD";
    group_attribute groups;
    group_attribute_is_dn on;
    require valid_user;
}

include /etc/nginx/conf.d/*.conf;

}

Then in a 'server' section in another conf or in nginx.conf, you can reference the LDAP name

server {

listen 443 default ssl;
...
...
...
...
...

location / {
auth_ldap "Please enter your Foxpass credentials";
auth_ldap_servers foxpass;
...
...
}
}

3. Restart nginx

(make sure no previous processes are running) and you should be prompted for credentials in your browser