Skip to content

The official Nginx Docker image with the kvspb/nginx-auth-ldap module included.

License

Notifications You must be signed in to change notification settings

AxisCommunications/docker-nginx-ldap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nginx-ldap

The official Nginx Docker image with the kvspb/nginx-auth-ldap module included, in order to add the functionality of authenticating users via an LDAP server.

If you are not building this directly yourself you may find information about available tags over on Docker Hub.

Usage

The LDAP module is added in such a way that everything else inside the container is exactly as it is inside the official Nginx image. This means that how to use this image is basically identical to the parent, but with this you also have the ability to authenticate users via LDAP if you want to.

However, if you intend to overwrite the /etc/nginx/nginx.conf file, inside the image, you must include the following line at the top of your custom one:

load_module modules/ngx_http_auth_ldap_module.so;

otherwise the dynamic LDAP module will not be loaded.

The LDAP server(s) then needs to be added to the http block of the configuration, before it is used inside the server blocks.

Example

http {
    ldap_server test1 {
        url ldaps://192.168.0.1:3269/DC=test,DC=local?sAMAccountName?sub?(objectClass=person);

        binddn "TEST\\LDAPUSER";
        binddn_passwd LDAPPASSWORD;

        require valid_user;
        satisfy all;

        max_down_retries_count 3;
    }

    server {
        listen       8080;
        server_name  localhost;

        auth_ldap "Forbidden";
        auth_ldap_servers test1;

        location / {
            root   html;
            index  index.html index.htm;
        }
    }
}

More details about all possible configuration options are available in the kvspb/nginx-auth-ldap repository.

NOTE: Nginx loads files from the conf.d/ folder in alphabetical order, so to split the above configuration into two files the one containing the LDAP settings should be named similar to "00-ldap.conf".

Acknowledgments and Thanks

Inspiration for this project has been collected from the following sources:

and the GitHub Actions configurations have been reused from the original author's personal project: