LDAP Apache: Difference between revisions

No edit summary
(Rewritten to include change of anon LDAP behaviour from zcs v5 to v6. Also give full working htaccess example)
Line 1: Line 1:
=LDAP Apache=
=LDAP Apache=


Very simple, install mod_auth_ldap, and then install a .htaccess file that looks like this:
For Apache versions < 2.2, then you need to install and load a module called mod_auth_ldap. For Apache 2.2 onwards this module was rewritten and became mod_authnz_ldap.


    AuthType Basic
Once you have the required module loaded, here's a .htaccess example for Apache 2.2:
    AuthName DDInternal
    AuthLDAPURL ldap://yourzimbraserver/dc=zimbra,dc=yourdomain,dc=com,dc=au
    require valid-user


The first part "yourzimbraserver" is the address of your Zimbra server running LDAP.
AuthName "LDAP Auth Example"
AuthType Basic
AuthBasicProvider ldap
AuthLDAPURL ldap://yourzimbraserver:389/ou=people,dc=yourdomain,dc=com?uid?sub?(objectClass=organizationalPerson)
AuthLDAPBindDN uid=zimbra,cn=admins,cn=zimbra
AuthLDAPBindPassword yourldappassword
AuthzLDAPAuthoritative off
require valid-user


The second part "dc=zimbra,dc=yourdomain,dc=com,dc=au" is the domain you would like to authenticate against.
The first part of "yourzimbraserver" is the address of your Zimbra server running LDAP.


==Other Domains==
The second part "dc=yourdomain,dc=com" is the domain and domain extension you would like to authenticate against.
If you want that your customers authenticate with their email address, you just have to use the mail attribute.


Example:
If you want users to have to enter their Zimbra e-mail address instead of their user ID then change "?uid" to "?mail" in the AuthLDAPURL directive.
<Location "/service">
AuthLDAPEnabled on
AuthType Basic
AuthName "Service"
AuthLDAPURL ldap://127.0.0.1/?mail
require valid-user
</Location>


If you have Apache 2.2 or later, AuthLDAPEnabled doesn't work - use "AuthBasicProvider ldap" instead. Example:
If you have Apache 2.0 then "AuthBasicProvider ldap" doesn't work. Change it to "AuthLDAPEnabled on" instead.
<Location "/service">
AuthBasicProvider ldap
AuthType Basic
AuthName "Service"
AuthLDAPURL ldap://127.0.0.1/?mail
require valid-user
</Location>


As of ZCS 6.0 anonymous LDAP bind was disabled by default for new installs. If upgrading from v5 to v6, anonymous LDAP bind is still enabled so you can dispense with the "AuthLDAPBindDN" and "AuthLDAPBindPassword" directives. See [http://bugzilla.zimbra.com/show_bug.cgi?id=15378#c39 bug 15378, comment #39] for further information.


You can limit the access to certain users by adding
You can limit the access to certain users by changing the require directive to:
  require user user@example.com
  require user user@example.com



Revision as of 16:46, 26 November 2010

LDAP Apache

For Apache versions < 2.2, then you need to install and load a module called mod_auth_ldap. For Apache 2.2 onwards this module was rewritten and became mod_authnz_ldap.

Once you have the required module loaded, here's a .htaccess example for Apache 2.2:

AuthName "LDAP Auth Example"
AuthType Basic
AuthBasicProvider ldap
AuthLDAPURL ldap://yourzimbraserver:389/ou=people,dc=yourdomain,dc=com?uid?sub?(objectClass=organizationalPerson)
AuthLDAPBindDN uid=zimbra,cn=admins,cn=zimbra
AuthLDAPBindPassword yourldappassword
AuthzLDAPAuthoritative off
require valid-user

The first part of "yourzimbraserver" is the address of your Zimbra server running LDAP.

The second part "dc=yourdomain,dc=com" is the domain and domain extension you would like to authenticate against.

If you want users to have to enter their Zimbra e-mail address instead of their user ID then change "?uid" to "?mail" in the AuthLDAPURL directive.

If you have Apache 2.0 then "AuthBasicProvider ldap" doesn't work. Change it to "AuthLDAPEnabled on" instead.

As of ZCS 6.0 anonymous LDAP bind was disabled by default for new installs. If upgrading from v5 to v6, anonymous LDAP bind is still enabled so you can dispense with the "AuthLDAPBindDN" and "AuthLDAPBindPassword" directives. See bug 15378, comment #39 for further information.

You can limit the access to certain users by changing the require directive to:

require user user@example.com

Performance

You may consider installing mod_ldap to cache your LDAP connections.

Single Login

You can then use [[1]Preauth] to do single sign on (sort of).


References

[[2]Apache mod_auth_ldap]

Verified Against: unknown Date Created: 3/28/2006
Article ID: https://wiki.zimbra.com/index.php?title=LDAP_Apache Date Modified: 2010-11-26



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »

Jump to: navigation, search