robbyt.com
Apache 2.2 and Active Directory
on 30-04-2007 07:57

Apache 2.2 has introduced a new authentication framework: Authn/Authz
With this new framework, comes a new mod_authz_ldap module! Like every good UNIX software release, a torrent of esoteric, incompatible, and confusing configuration options present themselves! Read on for my experiences with Apache 2.2/mod_authz_ldap and Active Directory... First off, this article isn't really much of a A-Z how to get Apache/AD working. It's meant more as a reference for people who have worked with apache 2.0/mod_auth_ldap and are upgrading to Apache 2.2/mod_authz_ldap. If you need help getting things going from scratch, i recommend doing some Googling to get you going.

So to get started, here is my configuration template for the inpatient:
items that are new to apache 2.2/mod_authz_ldap are in bold

order allow,deny
allow from all
AuthName "AD Authorize Me!"
AuthType Basic
AuthBasicProvider ldap

AuthzLDAPAuthoritative On

AuthLDAPBindDN This e-mail address is being protected from spam bots, you need JavaScript enabled to view it

AuthLDAPBindPassword your-plain-text-ldap-pass
AuthLDAPURL ldap://domain.local:389/OU=Corporate,OU=company,
DC=domain,DC=local?sAMAccountName?sub?(objectCategory=person)
require ldap-group CN=Domain Admins,OU=Windows Groups,OU=Groups,OU=Corporate,OU=company,DC=domain,DC=local

REQUIRE valid-user

So lets go over what some of this means.

AuthBasicProvider ldap
is fairly self explanatory for Apache veterans. AuthType basic is a classic option that everyone knows and loves, but now you can list multiple "Providers" for each location if necessary. This option is required for every location, otherwise Apache won't know what auth plugin to use.

AuthzLDAPAuthoritative On
there are some howto's and postings on the internet that say to turn this off. If you listen to them and turn this off, you'll lose the ability to filter groups. Since you want your authentication to be strictly by LDAP the AuthzLDAPAuthoritative needs to be set to "on". If this option is set to Off, authentication will pass down to the GroupFile (or similar) mechanisms, and you might not have any other handlers set. So setting the LDAPAuthoritative to ON forces LDAP to do all the work (and avoids any "backup" authentication mechanisms.)

AuthLDAPBindDN This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
is also new. Formating your BindDN this way isn't required, but it's recommended (somewhere) in the Apache documentation. I guess what this gives you is the ability to have directory agnostic binding authentication, when some noob decides to reorganize the structure of the Active Directory tree on their lunch break. (sure beats playing solitaire i suppose)

require ldap-group
Require groups has an additional syntax option. Other documentation and howto's on the internet were ambiguous about this. The only way I could get group filtering to work was to use "require ldap-group" and not the 2.0 formatted "require group"

Well, that's all of the major stuff. I'm sure there are other surprises along the way. Best of luck, and enjoy Apache 2.2!!!
Published in : Computer Stuff, HowTo

Users' Comments (5)
Posted by Jeff Pennington, on 12-03-2008 04:20, IP 159.14.243.254, Guest
1. global cache
Our AD instance has a 'messy' tree - there are multiple DN paths to users. Apache can't look in more than one location, apparently it tries to follow referrals from one path to another anonymously, without using the bind user. I solved the problem by using AD's 'global cache' which is a read-only 'index' of the tree, used for looking stuff up. You use port 3268 instead of 389 in AuthLDAPUrl (assuming that the defaults haven't been changed) and otherwise query the same. More info: http://blog.dkorunic.net/2007/ 05/26/apache-auth-with- microsoft-ad/
 
» Reply to this comment...

Posted by Brian, on 14-06-2007 11:04, IP 139.72.158.28, Guest
2. ...
One missing note is how to support nested groups that AD is famous for.  
I've found to use mm_mod_auth_ldap3.11, are there any other solutions you know of?
 
» Reply to this comment...

Posted by Brandon, on 17-05-2007 08:47, IP 208.49.13.130, Guest
3. ...
post more shit, gayfer
 
» Reply to this comment...

Posted by robbyt, on 02-05-2007 06:29, IP 70.90.77.201, Guest
4. ...
thing is, PAM isn't OS agnostic. don't forget about your solaris broz!  
 
additionally, mod_auth_pam isn't maintained any longer: http://pam.sourceforge.net/ mod_auth_pam/
 
» Reply to this comment...

Posted by Brandon, on 30-04-2007 13:15, IP 208.49.13.130, Guest
5. ...
it seems like using PAM is preferable since you don't have to mess around with plain text passwords in the conf file and/or passwords in other similarly stupid files... 
 
what say you?
 
» Reply to this comment...

Add your comment



mXcomment 1.0.5 © 2007-2009 - visualclinic.fr
License Creative Commons - Some rights reserved
 
< Prev