Apache httpd server is a widely used open source webserver. By default, the applications deployed in this server will be open to the network and can be accessible without any authentication.
If we want to secure it using some credentials, what we will do .?
Apache httpd server provides several ways to add authentication.
Here I am explaining a basic configuration that enables ldap authentication with apache httpd server. Through this, we can integrate the applications deployed in the apache server with enterprise ldap. We can integrate apache server with LDAP in two steps. These steps are tested with apache httpd version 2.2
Open httpd.conf file and check for the below lines. If it is already present, we are good to go, else add these lines.
LoadModule ldap_module modules/mod_ldap.so LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
Add the following configuration at the end of the httpd.conf file
<Directory /var/www/html> AuthType Basic AuthName "Web Site: Login with user id" AuthBasicProvider ldap AuthzLDAPAuthoritative off AuthLDAPURL ldap://ldap.myserver.com:389/ou=people,dc=unix,dc=myserver,dc=com Require valid-user </Directory>
Now this will allow all the users present in the LDAP directory to access your application.
Now restart the httpd server and try using it. You will be asked for credentials while accessing the webpages 🙂