I've been trying to setup redundant LDAP servers with Apache 2.2.3.


<AuthnProviderAlias ldap master>
    AuthLDAPURL ldap://,dc=vn?cn
    AuthLDAPBindDN cn=anonymous,ou=it,dc=domain,dc=vn
    AuthLDAPBindPassword pa$$w0rd

<AuthnProviderAlias ldap slave>
    AuthLDAPURL ldap://,dc=vn?cn
    AuthLDAPBindDN cn=anonymous,ou=it,dc=domain,dc=vn
    AuthLDAPBindPassword pa$$w0rd


# mod_authz_ldap can be used to implement access control and 
# authenticate users against an LDAP database.

LoadModule authz_ldap_module modules/mod_authz_ldap.so

<IfModule mod_authz_ldap.c>
   <Location />
        AuthBasicProvider master slave
        AuthzLDAPAuthoritative Off
        AuthType Basic
        AuthName "Authorization required"

        AuthzLDAPMemberKey member
        AuthUserFile /home/setup/svn/auth-conf
        AuthzLDAPSetGroupAuth user
        require valid-user
        AuthzLDAPLogLevel error

If I understand correctly, mod_authz_ldap will try to search users in the second LDAP if the first server is down or OpenLDAP on it is not running.

But in practice, it does not happen. Tested by stopping LDAP on the master, I get the "500 Internal Server Error" when accessing to the Subversion repository. The error_log shows:

[11061] auth_ldap authenticate: user quanta authentication failed; URI / [LDAP: ldap_simple_bind_s() failed][Can't contact LDAP server]

Did I misunderstand? AuthBasicProvider ldap1 ldap2 only means that if mod_authz_ldap can't find the user in ldap1, it will continue with ldap2. It doesn't include the failover feature (ldap1 must be running and working fine)?


I'm far from beaing a specialist for LDAP but according to the mod_authnz_ldap docs you have to specify the failover LDAP server in the AuthLDAPUrl Directive like this

AuthLDAPURL "ldap://ldap1.airius.com ldap2.airius.com/ou=People, o=Airius"

Edit: Clarification

You cannot set different filters for the failovers. A failover has to be a mirror of the primary server to serve the same data.

  • Thanks. This works: AuthLDAPURL "ldap://ldap1:389 ldap2:389/dc=domain,dc=vn?cn?sub?(objectClass=*)" but this doesn't: AuthLDAPURL "ldap://ldap1:389/dc=domain,dc=vn?cn?sub?(objectClass=*) ldap2:389/dc=domain,dc=vn?cn?sub?(objectClass=*)" (Bad URL encountered while parsing LDAP URL). What happens if I want to specify different filter for 2 ldaps? Moreover, does anyone else get it working with mod_authz_ldap? – quanta Jul 2 '12 at 4:25
  • 1
    A failover should be a copy of the main ldap server. Otherwise it would be no failover. – Christopher Perrin Jul 2 '12 at 15:18

What Christopher Perrin said, but also the default timeout is ten seconds, which you may want to shorten so you 'fail fast' and people get a response back quicker.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.