Fedora 15
Sponsored Link

Basic Auth + LDAP2011/05/29

Configure httpd 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] It needs 'mod_authnz_ldap7 module, but it's loaded by default. If your httpd does not load it, add following lines in your httpd.conf.
LoadModule ldap_module modules/mod_ldap.so

LoadModule authnz_ldap_module modules/mod_authnz_ldap.so

Following example shows 'test' directory requires an authentication.
[root@www ~]#
vi /etc/httpd/conf.d/auth.conf
# create new

<IfModule authnz_ldap_module>
   <Directory /var/www/html/test>
      AuthName "Authentication"
      AuthType Basic
      AuthBasicProvider ldap
      AuthLDAPURL ldap://,dc=world?uid?sub?(objectClass=*)
      Require ldap-filter objectClass=posixAccount

[root@www ~]#
/etc/rc.d/init.d/httpd restart

Restarting httpd (via systemctl): Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[ OK ]
[root@www ~]#
vi /var/www/html/test/index.html
# create a test page

<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Test Page for LDAP Auth
  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