Tuesday, March 17, 2009

Apache 2.2 ldap setup

NameVirtualHost 192.168.x.x:80

<VirtualHost 192.168.x.x:80>
ServerName whatever.yoursite.com
DocumentRoot "/export/web/html"
ErrorLog logs/whatever.yoursite.com_error_log
CustomLog logs/whatever.yoursite.com_access_log common
##LogLevel debug

<Directory "/export/web/html">Options FollowSymlinks
AllowOverride None
Order allow,deny
Allow from all
AuthName "LDAP Authorization"
AuthType Basic

### The next 2 lines are required in Apache 2.2
AuthBasicProvider ldap
AuthzLDAPAuthoritative off

AuthLDAPBindDN "ldapusername@yourad"
AuthLDAPBindPassword "password"
AuthLDAPURL "ldap://fqdn_of_your_AD_server/ou=Users,dc=yoursite,dc=com?sAMAccountName?sub"

### Either use valid-user or ldap-user
#require valid-user
require ldap-user user1 user2 user3 user4
require ldap-user user5 user6 user7 user8

satisfy all

</Directory>
</VirtualHost>