Ubuntu 14.04
Sponsored Link

Basic Auth + LDAP2014/04/30

 
Limit accesses on specific web pages and use LDAP users for authentication with SSL connection. It's necessarry to be running LDAP server in your LAN.
[1] For example, set Basic Auth under the [/var/www/html/auth-ldap] directory.
root@www:~#
a2enmod ldap authnz_ldap

Enabling module ldap.
Considering dependency ldap for authnz_ldap:
Module ldap already enabled
Enabling module authnz_ldap.
To activate the new configuration, you need to run:
  service apache2 restart

root@www:~#
vi /etc/apache2/sites-available/auth-ldap.conf
# create new

<Directory /var/www/html/auth-ldap>
    SSLRequireSSL
    AuthName "LDAP Authentication"
    AuthType Basic
    AuthBasicProvider ldap
    AuthLDAPURL ldap://dlp.srv.world/dc=srv,dc=world?uid?sub?(objectClass=*)
    Require ldap-filter objectClass=posixAccount
</Directory>

root@www:~#
mkdir /var/www/html/auth-ldap

root@www:~#
a2ensite auth-ldap

Enabling site auth-ldap.
To activate the new configuration, you need to run:
  service apache2 reload

root@www:~#
/etc/init.d/apache2 restart

 * Restarting web server apache2
   ...done.

# create a test page

root@www:~#
vi /var/www/html/auth-ldap/index.html
<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Test Page for LDAP Auth
</div>
</body>
</html>
[2] Access to the test page with a Web browser on Client and authenticate with a user which is on LDAP.
[3] Just accessed.
Matched Content