LDAP authentication for users
LDAP authentication in Apache HTTPD is very much important from a security perspective, By default, LDAP authentication is not enabled, Once Apache installation is successfully completed, need to install separate packages called mod_ldap.
In this Article we cover Limit accesses on specific web pages and uses LDAP users for authentication with SSL connection, Apache httpd server is used an open source web server. By default, the web applications deployed in this server will be open to the network and can be accessed without any authentication.
Apache httpd server provides many ways to add authentication, but I am explaining a basic configuration by using httpd.conf
Step 1: – Install mod_ldap via YUM
yum -y install mod_ldap
Step 2:- Create a file and past the below code
<Directory /var/www/html/> # AuthName "LDAP Authentication" AuthName "OnClick360" AuthType Basic AuthBasicProvider ldap AuthLDAPURL "ldap://220.127.116.11:389/DC=domain,dc=com?sAMAccountName?sub?(objectClass=*)" NONE AuthLDAPBindDN "CN=myuser,CN=Users,DC=my-domain,DC=domain,dc=com" AuthLDAPBindPassword "password123" Require ldap-user user1 user </Directory>
Step 3 :- Create a Directory as below under html folder
Step 4 :- Add below line in httpd.conf to include the auth_ldap.conf
Step 5 :- Create a test html page to test LDAP Authentication
Test Page for LDAP Auth
Step 6 :- Check the http syntax error and restart the service
systemctl restart httpd
Test your URL which is configured under /var/www/html/ it will ask LDAP username and password