Saturday 14 May 2011

Linux Apache Directories With LDAP Authentication Setup.

                                     SETUP

Ldap Server              : domain.mycompany.com
Ldap Server Port       : 3268
Organizational Units   : WEBUSERS
Admin User               : webadmin@domain.mycompany.com
webadmin Password : password


Step 1: Copy your project to /var/www/html directory.

"cp -R myproject /var/www/html/projectone"

Step 2: Give the project permission for Apache User.

"chmod 755 /var/www/html/projectone/* -R"
"chown apache:apache /var/www/html/projectone/* -R"

Step 3: Edit httpd.conf and enable ldap modules.

edit "/etc/httpd/conf/httpd.conf"

Enable the lines:
"LoadModule ldap_module modules/mod_ldap.so"
"LoadModule authnz_ldap_module modules/mod_authnz_ldap.so"


Step 4: Create ldap authentication settings for projectone directory.

edit "/etc/httpd/conf/httpd.conf"

Add line:

<Location /projectone/>
  AuthType Basic
  AuthName "ProjectOne"
  AuthBasicProvider "ldap"
  AuthLDAPURL "
ldap://domain.mycompany.com:3268/DC=domain,DC=mycompany,DC=com?sAMAccountName?sub?(objectClass=user)"
  AuthLDAPBindDN      
webadmin@domain.mycompany.com
  AuthLDAPBindPassword password
  authzldapauthoritative Off
  require valid-user
  require ldap-group CN=WEBUSERS,CN=Users,DC=domain,DC=mycompany,DC=com
</Location>


Step 5: Restart Apache web server.

"service httpd restart"

Apache Ldap based directory access is ready.

No comments:

Post a Comment