Ubuntu 10.04
Sponsored Link

Basic auth + LDAP2010/08/10

  Configure Apache2 and set a page that people must authenticate and the authentication is from LDAP server. Therefore it's necessarry to run LDAP server in your LAN.

[1] Following example shows 'test' directory requires an authentication.
root@www05:~#
a2enmod ldap authnz_ldap
# enable modules

Enabling module ldap.
Considering dependency ldap for authnz_ldap:
Module ldap already enabled
Enabling module authnz_ldap.
Run '/etc/init.d/apache2 restart' to activate new configuration!

root@www05:~#
vi /etc/apache2/conf.d/auth.conf


# create new

<IfModule authnz_ldap_module>
<Directory /var/www/test>

SSLRequireSSL

AuthName "Authentication"

AuthType Basic

AuthBasicProvider ldap

AuthLDAPURL ldap://10.0.0.50/dc=srv,dc=world?uid?sub?(objectClass=*)

Require ldap-filter objectClass=posixAccount

</Directory>

</IfModule>


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

  * Restarting web server apache2
  ... waiting ...done.

root@www05:~#
vi /var/www/test/index.html


# create a test page

<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Test Page for LDAP Auth
</div>
</body>
</html>
  Access to the test page with web browser, then authentication is required as a config. Input a LDAP user and authenticate here.
 
  Just accessed
 
Matched Content