Nginx container image that uses ldap as basic authentication to a single upstream server
NOTE currently it has been tested only for AD setups
Version of the current stable container is placed in VERSION file. sematic versioning is used to version the container
Container behaivor can be adjusted using this environment variables
LDAP_URIdefault: None Ldap uri that is used for connecting to ldap serverLDAP_BASE_DNdefault: None Ldap base DN in which user search is performedLDAP_BIND_USER_DNdefault: None User DN that is used for binding to ldap serverLDAP_BIND_USER_PASSWORDdefault: None Bind user passwordLDAP_USER_FILTERdefault: ((objectClass=user) Ldap filter to use when searching for users.LDAP_GROUP_FILTERdefault: ((objectClass=group) Ldap filter to use when searching for group.LDAP_LOGIN_ATTRIBUTEdefault: None The LDAP attribute used for the authentication lookup, i.e. which attribute is matched to the username when you log in.LDAP_AUTH_GROUPdefault: None Only users of this group can accessNGINX_UPSTREAM_SERVERNGINX_UPSTREAM_SERVERdefault: None Server which needs ldap authenticationLDAP_AD_DOMAIN_SIDdefault: None. Optional. AD domain sid. If this environment variable is set - AD specificnslsdconfiguration is chosenNGINX_FORBIDDEN_LOCATIONSdefault: None. Optional. A list ofupstreamlocationsseparated by white space that should return403http status code
docker run -e LDAP_URI="ldap://ad.somecompany.com" -e LDAP_BASE_DN="ou=ad,dc=ad,dc=somecompany,dc=com" -e LDAP_BIND_USER_DN="cn=someuser,ou=users,ou=ad,dc=ad,dc=somecompany,dc=com" -e LDAP_BIND_USER_PASSWORD="SOME_PASSWORD" -e LDAP_LOGIN_ATTRIBUTE="userPrincipalName" -e LDAP_AUTH_GROUP="kibana-ops" -e NGINX_UPSTREAM_SERVER="http://localhost:5601" -e LDAP_AD_DOMAIN_SID="S-1-5-21-3623811015-3361044348-30300820" -e NGINX_FORBIDDEN_LOCATIONS="/api/console" ggramal/nginx-ldap-pam:0.1.0
This command
- Sets ldap uri to
ldap://ad.somecompany.com - Sets dn search path for users and groups to
ou=ad,dc=ad,dc=somecompany,dc=com - Uses
cn=someuser,ou=users,ou=ad,dc=ad,dc=somecompany,dc=comas bind user to bind to ldap server - Uses
SOME_PASSWORDstring for the bind user password - Uses
(objectClass=user)to authenticate only users withobjectClassattribute equal touservalue - Uses
(objectClass=group)for using only groups withobjectClassattribute equalgroup - Uses
userPrincipalNameattribute to check against basic auth login prompt - Uses
http://localhost:5601as a nginx upstream server - Only
kibana-opsldap group users can accessNGINX_UPSTREAM_SERVER - Uses
S-1-5-21-3623811015-3361044348-30300820as domain sid - Adds
location /api/console { deny all;return 403;}in nginx config
This nginx setup is based on couple of components:
- It uses
envsubstutil to configure files intemplates/folder based on environment variables - It uses
nss-pam-ldapdas NSS and PAM modules for authentication and identity management using LDAP server - It uses
nginx pam modulefor basic authentication based on pam config - It uses
pam_succeed_if.sopam module to check if the user is in the configured group