LDAP Authentication in Apache HTTPD server

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

 vim /etc/httpd/conf.d/auth_ldap.conf
<Directory /var/www/html/>
# AuthName "LDAP Authentication"
AuthName "OnClick360"
AuthType Basic
AuthBasicProvider ldap
AuthLDAPURL "ldap://,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

Step 3 :- Create a Directory as below under html folder

mkdir /var/www/html/auth-ldap

Step 4 :- Add below line in httpd.conf to include the auth_ldap.conf

 vim /etc/httpd/conf/httpd.conf
 IncludeOptional conf.d/*.conf

Step 5 :- Create a test html page to test LDAP Authentication

 vim /var/www/html/index.html

Test Page for LDAP Auth

Step 6 :- Check the http syntax error and restart the service

 httpd -t
 systemctl restart httpd

Test your URL which is configured under /var/www/html/ it will ask LDAP username and password


Hope You Enjoy this Article.

You May Also Like

6 thoughts on “LDAP Authentication in Apache HTTPD server

  1. I have learn a few just right stuff here. Certainly price bookmarking for revisiting.
    I wonder how much attempt you set to make this sort of great informative website.

  2. Normally I don’t learn post on blogs, but I would like to say that
    this write-up very compelled me to try and do so! Your
    writing style has been amazed me. Thanks, quite great article.

  3. Thanks for the information.
    I am struggling with the below task.
    When a guy accesses HTML page with your setup he will get a pop up the login page.
    And I didn’t find a way to store the login details in variables, can you give a clue to do that.
    Let me know if you don’t understand my question.

  4. fantastic submit, very informative. I wonder why the other experts of this sector don’t realize this. You must proceed your writing. I’m confident, you have a huge readers’ base already!|

Leave a Reply

Your email address will not be published. Required fields are marked *