2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
7 Licensed to the Apache Software Foundation (ASF) under one or more
8 contributor license agreements. See the NOTICE file distributed with
9 this work for additional information regarding copyright ownership.
10 The ASF licenses this file to You under the Apache License, Version 2.0
11 (the "License"); you may not use this file except in compliance with
12 the License. You may obtain a copy of the License at
14 http://www.apache.org/licenses/LICENSE-2.0
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
23 <modulesynopsis metafile="mod_authnz_ldap.xml.meta">
25 <name>mod_authnz_ldap</name>
26 <description>Allows an LDAP directory to be used to store the database
27 for HTTP Basic authentication.</description>
28 <status>Extension</status>
29 <sourcefile>mod_authnz_ldap.c</sourcefile>
30 <identifier>authnz_ldap_module</identifier>
33 <p>This module allows authentication front-ends such as
34 <module>mod_auth_basic</module> to authenticate users through
35 an ldap directory.</p>
37 <p><module>mod_authnz_ldap</module> supports the following features:</p>
40 <li>Known to support the <a
41 href="http://www.openldap.org/">OpenLDAP SDK</a> (both 1.x
42 and 2.x), <a href="http://developer.novell.com/ndk/cldap.htm">
43 Novell LDAP SDK</a> and the <a
44 href="http://www.iplanet.com/downloads/developer/">iPlanet
45 (Netscape)</a> SDK.</li>
47 <li>Complex authorization policies can be implemented by
48 representing the policy with LDAP filters.</li>
50 <li>Uses extensive caching of LDAP operations via <a
51 href="mod_ldap.html">mod_ldap</a>.</li>
53 <li>Support for LDAP over SSL (requires the Netscape SDK) or
54 TLS (requires the OpenLDAP 2.x SDK or Novell LDAP SDK).</li>
57 <p>When using <module>mod_auth_basic</module>, this module is invoked
58 via the <directive module="mod_auth_basic">AuthBasicProvider</directive>
59 directive with the <code>ldap</code> value.</p>
62 <seealso><module>mod_ldap</module></seealso>
63 <seealso><module>mod_auth_basic</module></seealso>
64 <seealso><module>mod_authz_user</module></seealso>
65 <seealso><module>mod_authz_groupfile</module></seealso>
67 <section id="contents"><title>Contents</title>
71 <a href="#operation">Operation</a>
74 <li><a href="#authenphase">The Authentication
77 <li><a href="#authorphase">The Authorization
83 <a href="#requiredirectives">The Require Directives</a>
86 <li><a href="#requser">Require ldap-user</a></li>
87 <li><a href="#reqgroup">Require ldap-group</a></li>
88 <li><a href="#reqdn">Require ldap-dn</a></li>
89 <li><a href="#reqattribute">Require ldap-attribute</a></li>
90 <li><a href="#reqfilter">Require ldap-filter</a></li>
91 <li><a href="#reqsearch">Require ldap-search</a></li>
95 <li><a href="#examples">Examples</a></li>
96 <li><a href="#usingtls">Using TLS</a></li>
97 <li><a href="#usingssl">Using SSL</a></li>
98 <li><a href="#exposed">Exposing Login Information</a></li>
99 <li><a href="#activedirectory">Using Active Directory</a></li>
101 <a href="#frontpage">Using Microsoft FrontPage with
102 <module>mod_authnz_ldap</module></a>
105 <li><a href="#howitworks">How It Works</a></li>
106 <li><a href="#fpcaveats">Caveats</a></li>
112 <section id="operation"><title>Operation</title>
114 <p>There are two phases in granting access to a user. The first
115 phase is authentication, in which the <module>mod_authnz_ldap</module>
116 authentication provider verifies that the user's credentials are valid.
117 This is also called the <em>search/bind</em> phase. The second phase is
118 authorization, in which <module>mod_authnz_ldap</module> determines
119 if the authenticated user is allowed access to the resource in
120 question. This is also known as the <em>compare</em>
123 <p><module>mod_authnz_ldap</module> registers both an authn_ldap authentication
124 provider and an authz_ldap authorization handler. The authn_ldap
125 authentication provider can be enabled through the
126 <directive module="mod_auth_basic">AuthBasicProvider</directive> directive
127 using the <code>ldap</code> value. The authz_ldap handler extends the
128 <directive module="mod_authz_core">Require</directive> directive's authorization types
129 by adding <code>ldap-user</code>, <code>ldap-dn</code> and <code>ldap-group</code>
132 <section id="authenphase"><title>The Authentication
135 <p>During the authentication phase, <module>mod_authnz_ldap</module>
136 searches for an entry in the directory that matches the username
137 that the HTTP client passes. If a single unique match is found,
138 then <module>mod_authnz_ldap</module> attempts to bind to the
139 directory server using the DN of the entry plus the password
140 provided by the HTTP client. Because it does a search, then a
141 bind, it is often referred to as the search/bind phase. Here are
142 the steps taken during the search/bind phase.</p>
145 <li>Generate a search filter by combining the attribute and
146 filter provided in the <directive module="mod_authnz_ldap"
147 >AuthLDAPURL</directive> directive with
148 the username passed by the HTTP client.</li>
150 <li>Search the directory using the generated filter. If the
151 search does not return exactly one entry, deny or decline
154 <li>Fetch the distinguished name of the entry retrieved from
155 the search and attempt to bind to the LDAP server using that
156 DN and the password passed by the HTTP client. If the bind is
157 unsuccessful, deny or decline access.</li>
160 <p>The following directives are used during the search/bind
164 <columnspec><column width=".3"/><column width=".7"/></columnspec>
166 <td><directive module="mod_authnz_ldap">AuthLDAPURL</directive></td>
168 <td>Specifies the LDAP server, the
169 base DN, the attribute to use in the search, as well as the
170 extra search filter to use.</td>
174 <td><directive module="mod_authnz_ldap">AuthLDAPBindDN</directive></td>
176 <td>An optional DN to bind with
177 during the search phase.</td>
182 module="mod_authnz_ldap">AuthLDAPBindPassword</directive></td>
184 <td>An optional password to bind
185 with during the search phase.</td>
190 <section id="authorphase"><title>The Authorization Phase</title>
192 <p>During the authorization phase, <module>mod_authnz_ldap</module>
193 attempts to determine if the user is authorized to access the
194 resource. Many of these checks require
195 <module>mod_authnz_ldap</module> to do a compare operation on the
196 LDAP server. This is why this phase is often referred to as the
197 compare phase. <module>mod_authnz_ldap</module> accepts the
198 following <directive module="mod_authz_core">Require</directive>
199 directives to determine if the credentials are acceptable:</p>
202 <li>Grant access if there is a <a
203 href="#reqgroup"><code>Require ldap-user</code></a> directive, and the
204 username in the directive matches the username passed by the
207 <li>Grant access if there is a <a href="#reqdn"><code>Require
208 ldap-dn</code></a> directive, and the DN in the directive matches
209 the DN fetched from the LDAP directory.</li>
211 <li>Grant access if there is a <a
212 href="#reqgroup"><code>Require ldap-group</code></a> directive, and
213 the DN fetched from the LDAP directory (or the username
214 passed by the client) occurs in the LDAP group or, potentially, in
215 one of its sub-groups.</li>
217 <li>Grant access if there is a <a href="#reqattribute">
218 <code>Require ldap-attribute</code></a>
219 directive, and the attribute fetched from the LDAP directory
220 matches the given value.</li>
222 <li>Grant access if there is a <a href="#reqfilter">
223 <code>Require ldap-filter</code></a>
224 directive, and the search filter successfully finds a single user
225 object that matches the dn of the authenticated user.</li>
227 <li>Grant access if there is a <a href="#reqsearch">
228 <code>Require ldap-search</code></a>
229 directive, and the search filter successfully returns a single
230 matching object with any distinguished name.</li>
232 <li>otherwise, deny or decline access</li>
235 <p>Other <directive module="mod_authz_core">Require</directive> values may also
236 be used which may require loading additional authorization modules.</p>
239 <li>Grant access to all successfully authenticated users if
240 there is a <a href="#requser"><code>Require valid-user</code></a>
241 directive. (requires <module>mod_authz_user</module>)</li>
243 <li>Grant access if there is a <a
244 href="#reqgroup"><code>Require group</code></a> directive, and
245 <module>mod_authz_groupfile</module> has been loaded with the
246 <directive module="mod_authz_groupfile">AuthGroupFile</directive>
253 <p><module>mod_authnz_ldap</module> uses the following directives during the
257 <columnspec><column width=".4"/><column width=".6"/></columnspec>
259 <td><directive module="mod_authnz_ldap">AuthLDAPURL</directive> </td>
261 <td>The attribute specified in the
262 URL is used in compare operations for the <code>Require
263 ldap-user</code> operation.</td>
268 module="mod_authnz_ldap">AuthLDAPCompareDNOnServer</directive></td>
270 <td>Determines the behavior of the
271 <code>Require ldap-dn</code> directive.</td>
276 module="mod_authnz_ldap">AuthLDAPGroupAttribute</directive></td>
278 <td>Determines the attribute to
279 use for comparisons in the <code>Require ldap-group</code>
285 module="mod_authnz_ldap">AuthLDAPGroupAttributeIsDN</directive></td>
287 <td>Specifies whether to use the
288 user DN or the username when doing comparisons for the
289 <code>Require ldap-group</code> directive.</td>
294 module="mod_authnz_ldap">AuthLDAPMaxSubGroupDepth</directive></td>
296 <td>Determines the maximum depth of sub-groups that will be evaluated
297 during comparisons in the <code>Require ldap-group</code> directive.</td>
302 module="mod_authnz_ldap">AuthLDAPSubGroupAttribute</directive></td>
304 <td>Determines the attribute to use when obtaining sub-group members
305 of the current group during comparisons in the <code>Require ldap-group</code>
311 module="mod_authnz_ldap">AuthLDAPSubGroupClass</directive></td>
313 <td>Specifies the LDAP objectClass values used to identify if queried directory
314 objects really are group objects (as opposed to user objects) during the
315 <code>Require ldap-group</code> directive's sub-group processing.</td>
321 <section id="requiredirectives"><title>The Require Directives</title>
323 <p>Apache's <directive module="mod_authz_core">Require</directive>
324 directives are used during the authorization phase to ensure that
325 a user is allowed to access a resource. mod_authnz_ldap extends the
326 authorization types with <code>ldap-user</code>, <code>ldap-dn</code>,
327 <code>ldap-group</code>, <code>ldap-attribute</code> and
328 <code>ldap-filter</code>. Other authorization types may also be
329 used but may require that additional authorization modules be loaded.</p>
331 <p>Since v2.4.8, <a href="../expr.html">expressions</a> are supported
332 within the LDAP require directives.</p>
334 <section id="requser"><title>Require ldap-user</title>
336 <p>The <code>Require ldap-user</code> directive specifies what
337 usernames can access the resource. Once
338 <module>mod_authnz_ldap</module> has retrieved a unique DN from the
339 directory, it does an LDAP compare operation using the username
340 specified in the <code>Require ldap-user</code> to see if that username
341 is part of the just-fetched LDAP entry. Multiple users can be
342 granted access by putting multiple usernames on the line,
343 separated with spaces. If a username has a space in it, then it
344 must be surrounded with double quotes. Multiple users can also be
345 granted access by using multiple <code>Require ldap-user</code>
346 directives, with one user per line. For example, with a <directive
347 module="mod_authnz_ldap">AuthLDAPURL</directive> of
348 <code>ldap://ldap/o=Example?cn</code> (i.e., <code>cn</code> is
349 used for searches), the following Require directives could be used
350 to restrict access:</p>
351 <highlight language="config">
352 Require ldap-user "Barbara Jenson"
353 Require ldap-user "Fred User"
354 Require ldap-user "Joe Manager"
357 <p>Because of the way that <module>mod_authnz_ldap</module> handles this
358 directive, Barbara Jenson could sign on as <em>Barbara
359 Jenson</em>, <em>Babs Jenson</em> or any other <code>cn</code> that
360 she has in her LDAP entry. Only the single <code>Require
361 ldap-user</code> line is needed to support all values of the attribute
362 in the user's entry.</p>
364 <p>If the <code>uid</code> attribute was used instead of the
365 <code>cn</code> attribute in the URL above, the above three lines
366 could be condensed to</p>
367 <highlight language="config">Require ldap-user bjenson fuser jmanager</highlight>
370 <section id="reqgroup"><title>Require ldap-group</title>
372 <p>This directive specifies an LDAP group whose members are
373 allowed access. It takes the distinguished name of the LDAP
374 group. Note: Do not surround the group name with quotes.
375 For example, assume that the following entry existed in
376 the LDAP directory:</p>
378 dn: cn=Administrators, o=Example
379 objectClass: groupOfUniqueNames
380 uniqueMember: cn=Barbara Jenson, o=Example
381 uniqueMember: cn=Fred User, o=Example
384 <p>The following directive would grant access to both Fred and
386 <highlight language="config">Require ldap-group cn=Administrators, o=Example</highlight>
388 <p>Members can also be found within sub-groups of a specified LDAP group
389 if <directive module="mod_authnz_ldap">AuthLDAPMaxSubGroupDepth</directive>
390 is set to a value greater than 0. For example, assume the following entries
391 exist in the LDAP directory:</p>
393 dn: cn=Employees, o=Example
394 objectClass: groupOfUniqueNames
395 uniqueMember: cn=Managers, o=Example
396 uniqueMember: cn=Administrators, o=Example
397 uniqueMember: cn=Users, o=Example
399 dn: cn=Managers, o=Example
400 objectClass: groupOfUniqueNames
401 uniqueMember: cn=Bob Ellis, o=Example
402 uniqueMember: cn=Tom Jackson, o=Example
404 dn: cn=Administrators, o=Example
405 objectClass: groupOfUniqueNames
406 uniqueMember: cn=Barbara Jenson, o=Example
407 uniqueMember: cn=Fred User, o=Example
409 dn: cn=Users, o=Example
410 objectClass: groupOfUniqueNames
411 uniqueMember: cn=Allan Jefferson, o=Example
412 uniqueMember: cn=Paul Tilley, o=Example
413 uniqueMember: cn=Temporary Employees, o=Example
415 dn: cn=Temporary Employees, o=Example
416 objectClass: groupOfUniqueNames
417 uniqueMember: cn=Jim Swenson, o=Example
418 uniqueMember: cn=Elliot Rhodes, o=Example
421 <p>The following directives would allow access for Bob Ellis, Tom Jackson,
422 Barbara Jensen, Fred User, Allan Jefferson, and Paul Tilley but would not
423 allow access for Jim Swenson, or Elliot Rhodes (since they are at a
424 sub-group depth of 2):</p>
425 <highlight language="config">
426 Require ldap-group cn=Employees, o-Example
427 AuthLDAPMaxSubGroupDepth 1
430 <p>Behavior of this directive is modified by the <directive
431 module="mod_authnz_ldap">AuthLDAPGroupAttribute</directive>, <directive
432 module="mod_authnz_ldap">AuthLDAPGroupAttributeIsDN</directive>, <directive
433 module="mod_authnz_ldap">AuthLDAPMaxSubGroupDepth</directive>, <directive
434 module="mod_authnz_ldap">AuthLDAPSubGroupAttribute</directive>, and <directive
435 module="mod_authnz_ldap">AuthLDAPSubGroupClass</directive>
439 <section id="reqdn"><title>Require ldap-dn</title>
441 <p>The <code>Require ldap-dn</code> directive allows the administrator
442 to grant access based on distinguished names. It specifies a DN
443 that must match for access to be granted. If the distinguished
444 name that was retrieved from the directory server matches the
445 distinguished name in the <code>Require ldap-dn</code>, then
446 authorization is granted. Note: do not surround the distinguished
447 name with quotes.</p>
449 <p>The following directive would grant access to a specific
451 <highlight language="config">Require ldap-dn cn=Barbara Jenson, o=Example</highlight>
453 <p>Behavior of this directive is modified by the <directive
454 module="mod_authnz_ldap">AuthLDAPCompareDNOnServer</directive>
458 <section id="reqattribute"><title>Require ldap-attribute</title>
460 <p>The <code>Require ldap-attribute</code> directive allows the
461 administrator to grant access based on attributes of the authenticated
462 user in the LDAP directory. If the attribute in the directory
463 matches the value given in the configuration, access is granted.</p>
465 <p>The following directive would grant access to anyone with
466 the attribute employeeType = active</p>
468 <highlight language="config">Require ldap-attribute employeeType=active</highlight>
470 <p>Multiple attribute/value pairs can be specified on the same line
471 separated by spaces or they can be specified in multiple
472 <code>Require ldap-attribute</code> directives. The effect of listing
473 multiple attribute/values pairs is an OR operation. Access will be
474 granted if any of the listed attribute values match the value of the
475 corresponding attribute in the user object. If the value of the
476 attribute contains a space, only the value must be within double quotes.</p>
478 <p>The following directive would grant access to anyone with
479 the city attribute equal to "San Jose" or status equal to "Active"</p>
481 <highlight language="config">Require ldap-attribute city="San Jose" status=active</highlight>
485 <section id="reqfilter"><title>Require ldap-filter</title>
487 <p>The <code>Require ldap-filter</code> directive allows the
488 administrator to grant access based on a complex LDAP search filter.
489 If the dn returned by the filter search matches the authenticated user
490 dn, access is granted.</p>
492 <p>The following directive would grant access to anyone having a cell phone
493 and is in the marketing department</p>
495 <highlight language="config">Require ldap-filter &(cell=*)(department=marketing)</highlight>
497 <p>The difference between the <code>Require ldap-filter</code> directive and the
498 <code>Require ldap-attribute</code> directive is that <code>ldap-filter</code>
499 performs a search operation on the LDAP directory using the specified search
500 filter rather than a simple attribute comparison. If a simple attribute
501 comparison is all that is required, the comparison operation performed by
502 <code>ldap-attribute</code> will be faster than the search operation
503 used by <code>ldap-filter</code> especially within a large directory.</p>
505 <p>When using an <a href="../expr.html">expression</a> within the filter, care
506 must be taken to ensure that LDAP filters are escaped correctly to guard against
507 LDAP injection. The ldap function can be used for this purpose.</p>
509 <highlight language="config">
510 <LocationMatch ^/dav/(?<SITENAME>[^/]+)/>
511 Require ldap-filter (memberOf=cn=%{ldap:%{unescape:%{env:MATCH_SITENAME}},ou=Websites,o=Example)
512 </LocationMatch>
517 <section id="reqsearch"><title>Require ldap-search</title>
519 <p>The <code>Require ldap-search</code> directive allows the
520 administrator to grant access based on a generic LDAP search filter using an
521 <a href="../expr.html">expression</a>. If there is exactly one match to the search filter,
522 regardless of the distinguished name, access is granted.</p>
524 <p>The following directive would grant access to URLs that match the given objects in the
527 <highlight language="config">
528 <LocationMatch ^/dav/(?<SITENAME>[^/]+)/>
529 Require ldap-search (cn=%{ldap:%{unescape:%{env:MATCH_SITENAME}} Website)
530 </LocationMatch>
533 <p>Note: care must be taken to ensure that any expressions are properly escaped to guard
534 against LDAP injection. The <strong>ldap</strong> function can be used as per the example
541 <section id="examples"><title>Examples</title>
545 Grant access to anyone who exists in the LDAP directory,
546 using their UID for searches.
547 <highlight language="config">
548 AuthLDAPURL "ldap://ldap1.example.com:389/ou=People, o=Example?uid?sub?(objectClass=*)"
554 The next example is the same as above; but with the fields
555 that have useful defaults omitted. Also, note the use of a
556 redundant LDAP server.
557 <highlight language="config">AuthLDAPURL "ldap://ldap1.example.com ldap2.example.com/ou=People, o=Example"
563 The next example is similar to the previous one, but it
564 uses the common name instead of the UID. Note that this
565 could be problematical if multiple people in the directory
566 share the same <code>cn</code>, because a search on <code>cn</code>
567 <strong>must</strong> return exactly one entry. That's why
568 this approach is not recommended: it's a better idea to
569 choose an attribute that is guaranteed unique in your
570 directory, such as <code>uid</code>.
571 <highlight language="config">
572 AuthLDAPURL "ldap://ldap.example.com/ou=People, o=Example?cn"
578 Grant access to anybody in the Administrators group. The
579 users must authenticate using their UID.
580 <highlight language="config">
581 AuthLDAPURL ldap://ldap.example.com/o=Example?uid
582 Require ldap-group cn=Administrators, o=Example
587 Grant access to anybody in the group whose name matches the
588 hostname of the virtual host. In this example an
589 <a href="../expr.html">expression</a> is used to build the filter.
590 <highlight language="config">
591 AuthLDAPURL ldap://ldap.example.com/o=Example?uid
592 Require ldap-group cn=%{SERVER_NAME}, o=Example
597 The next example assumes that everyone at Example who
598 carries an alphanumeric pager will have an LDAP attribute
599 of <code>qpagePagerID</code>. The example will grant access
600 only to people (authenticated via their UID) who have
602 <highlight language="config">
603 AuthLDAPURL ldap://ldap.example.com/o=Example?uid??(qpagePagerID=*)
609 <p>The next example demonstrates the power of using filters
610 to accomplish complicated administrative requirements.
611 Without filters, it would have been necessary to create a
612 new LDAP group and ensure that the group's members remain
613 synchronized with the pager users. This becomes trivial
614 with filters. The goal is to grant access to anyone who has
615 a pager, plus grant access to Joe Manager, who doesn't
616 have a pager, but does need to access the same
618 <highlight language="config">
619 AuthLDAPURL ldap://ldap.example.com/o=Example?uid??(|(qpagePagerID=*)(uid=jmanager))
623 <p>This last may look confusing at first, so it helps to
624 evaluate what the search filter will look like based on who
625 connects, as shown below. If
626 Fred User connects as <code>fuser</code>, the filter would look
629 <example>(&(|(qpagePagerID=*)(uid=jmanager))(uid=fuser))</example>
631 <p>The above search will only succeed if <em>fuser</em> has a
632 pager. When Joe Manager connects as <em>jmanager</em>, the
633 filter looks like</p>
635 <example>(&(|(qpagePagerID=*)(uid=jmanager))(uid=jmanager))</example>
637 <p>The above search will succeed whether <em>jmanager</em>
638 has a pager or not.</p>
643 <section id="usingtls"><title>Using TLS</title>
645 <p>To use TLS, see the <module>mod_ldap</module> directives <directive
646 module="mod_ldap">LDAPTrustedClientCert</directive>, <directive
647 module="mod_ldap">LDAPTrustedGlobalCert</directive> and <directive
648 module="mod_ldap">LDAPTrustedMode</directive>.</p>
650 <p>An optional second parameter can be added to the
651 <directive module="mod_authnz_ldap">AuthLDAPURL</directive> to override
652 the default connection type set by <directive module="mod_ldap">LDAPTrustedMode</directive>.
653 This will allow the connection established by an <em>ldap://</em> Url
654 to be upgraded to a secure connection on the same port.</p>
657 <section id="usingssl"><title>Using SSL</title>
659 <p>To use SSL, see the <module>mod_ldap</module> directives <directive
660 module="mod_ldap">LDAPTrustedClientCert</directive>, <directive
661 module="mod_ldap">LDAPTrustedGlobalCert</directive> and <directive
662 module="mod_ldap">LDAPTrustedMode</directive>.</p>
664 <p>To specify a secure LDAP server, use <em>ldaps://</em> in the
665 <directive module="mod_authnz_ldap">AuthLDAPURL</directive>
666 directive, instead of <em>ldap://</em>.</p>
669 <section id="exposed"><title>Exposing Login Information</title>
671 <p>when this module performs <em>authentication</em>, ldap attributes specified
672 in the <directive module="mod_authnz_ldap">authldapurl</directive>
673 directive are placed in environment variables with the prefix "AUTHENTICATE_".</p>
675 <p>when this module performs <em>authorization</em>, ldap attributes specified
676 in the <directive module="mod_authnz_ldap">authldapurl</directive>
677 directive are placed in environment variables with the prefix "AUTHORIZE_".</p>
679 <p>If the attribute field contains the username, common name
680 and telephone number of a user, a CGI program will have access to
681 this information without the need to make a second independent LDAP
682 query to gather this additional information.</p>
684 <p>This has the potential to dramatically simplify the coding and
685 configuration required in some web applications.</p>
689 <section id="activedirectory"><title>Using Active Directory</title>
691 <p>An Active Directory installation may support multiple domains at the
692 same time. To distinguish users between domains, an identifier called
693 a User Principle Name (UPN) can be added to a user's entry in the
694 directory. This UPN usually takes the form of the user's account
695 name, followed by the domain components of the particular domain,
696 for example <em>somebody@nz.example.com</em>.</p>
698 <p>You may wish to configure the <module>mod_authnz_ldap</module>
699 module to authenticate users present in any of the domains making up
700 the Active Directory forest. In this way both
701 <em>somebody@nz.example.com</em> and <em>someone@au.example.com</em>
702 can be authenticated using the same query at the same time.</p>
704 <p>To make this practical, Active Directory supports the concept of
705 a Global Catalog. This Global Catalog is a read only copy of selected
706 attributes of all the Active Directory servers within the Active
707 Directory forest. Querying the Global Catalog allows all the domains
708 to be queried in a single query, without the query spanning servers
709 over potentially slow links.</p>
711 <p>If enabled, the Global Catalog is an independent directory server
712 that runs on port 3268 (3269 for SSL). To search for a user, do a
713 subtree search for the attribute <em>userPrincipalName</em>, with
714 an empty search root, like so:</p>
716 <highlight language="config">
717 AuthLDAPBindDN apache@example.com
718 AuthLDAPBindPassword password
719 AuthLDAPURL ldap://10.0.0.1:3268/?userPrincipalName?sub
722 <p>Users will need to enter their User Principal Name as a login, in
723 the form <em>somebody@nz.example.com</em>.</p>
727 <section id="frontpage"><title>Using Microsoft
728 FrontPage with mod_authnz_ldap</title>
730 <p>Normally, FrontPage uses FrontPage-web-specific user/group
731 files (i.e., the <module>mod_authn_file</module> and
732 <module>mod_authz_groupfile</module> modules) to handle all
733 authentication. Unfortunately, it is not possible to just
734 change to LDAP authentication by adding the proper directives,
735 because it will break the <em>Permissions</em> forms in
736 the FrontPage client, which attempt to modify the standard
737 text-based authorization files.</p>
739 <p>Once a FrontPage web has been created, adding LDAP
740 authentication to it is a matter of adding the following
741 directives to <em>every</em> <code>.htaccess</code> file
742 that gets created in the web</p>
743 <highlight language="config">
744 AuthLDAPURL "the url"
745 AuthGroupFile mygroupfile
746 Require group mygroupfile
749 <section id="howitworks"><title>How It Works</title>
751 <p>FrontPage restricts access to a web by adding the <code>Require
752 valid-user</code> directive to the <code>.htaccess</code>
753 files. The <code>Require valid-user</code> directive will succeed for
754 any user who is valid <em>as far as LDAP is
755 concerned</em>. This means that anybody who has an entry in
756 the LDAP directory is considered a valid user, whereas FrontPage
757 considers only those people in the local user file to be
758 valid. By substituting the ldap-group with group file authorization,
759 Apache is allowed to consult the local user file (which is managed by
760 FrontPage) - instead of LDAP - when handling authorizing the user.</p>
762 <p>Once directives have been added as specified above,
763 FrontPage users will be able to perform all management
764 operations from the FrontPage client.</p>
767 <section id="fpcaveats"><title>Caveats</title>
770 <li>When choosing the LDAP URL, the attribute to use for
771 authentication should be something that will also be valid
772 for putting into a <module>mod_authn_file</module> user file.
773 The user ID is ideal for this.</li>
775 <li>When adding users via FrontPage, FrontPage administrators
776 should choose usernames that already exist in the LDAP
777 directory (for obvious reasons). Also, the password that the
778 administrator enters into the form is ignored, since Apache
779 will actually be authenticating against the password in the
780 LDAP database, and not against the password in the local user
781 file. This could cause confusion for web administrators.</li>
783 <!-- XXX is that true? was mod_auth before the aaa change -->
784 <li>Apache must be compiled with <module>mod_auth_basic</module>,
785 <module>mod_authn_file</module> and
786 <module>mod_authz_groupfile</module> in order to
787 use FrontPage support. This is because Apache will still use
788 the <module>mod_authz_groupfile</module> group file for determine
789 the extent of a user's access to the FrontPage web.</li>
791 <li>The directives must be put in the <code>.htaccess</code>
792 files. Attempting to put them inside <directive module="core"
793 type="section">Location</directive> or <directive module="core"
794 type="section">Directory</directive> directives won't work. This
795 is because <module>mod_authnz_ldap</module> has to be able to grab
796 the <directive module="mod_authz_groupfile">AuthGroupFile</directive>
797 directive that is found in FrontPage <code>.htaccess</code>
798 files so that it knows where to look for the valid user list. If
799 the <module>mod_authnz_ldap</module> directives aren't in the same
800 <code>.htaccess</code> file as the FrontPage directives, then
801 the hack won't work, because <module>mod_authnz_ldap</module> will
802 never get a chance to process the <code>.htaccess</code> file,
803 and won't be able to find the FrontPage-managed user file.</li>
809 <name>AuthLDAPAuthorizePrefix</name>
810 <description>Specifies the prefix for environment variables set during
811 authorization</description>
812 <syntax>AuthLDAPAuthorizePrefix <em>prefix</em></syntax>
813 <default>AuthLDAPAuthorizePrefix AUTHORIZE_</default>
814 <contextlist><context>directory</context><context>.htaccess</context>
816 <override>AuthConfig</override>
817 <compatibility>Available in version 2.3.6 and later</compatibility>
819 <p>This directive allows you to override the prefix used for environment
820 variables set during LDAP authorization. If <em>AUTHENTICATE_</em> is
821 specified, consumers of these environment variables see the same information
822 whether LDAP has performed authentication, authorization, or both.</p>
824 <note><title>Note</title>
825 No authorization variables are set when a user is authorized on the basis of
826 <code>Require valid-user</code>.
833 <name>AuthLDAPBindAuthoritative</name>
834 <description>Determines if other authentication providers are used when a user can be mapped to a DN but the server cannot successfully bind with the user's credentials.</description>
835 <syntax>AuthLDAPBindAuthoritative<em>off|on</em></syntax>
836 <default>AuthLDAPBindAuthoritative on</default>
837 <contextlist><context>directory</context><context>.htaccess</context>
839 <override>AuthConfig</override>
841 <p>By default, subsequent authentication providers are only queried if a
842 user cannot be mapped to a DN, but not if the user can be mapped to a DN and their
843 password cannot be verified with an LDAP bind.
844 If <directive module="mod_authnz_ldap">AuthLDAPBindAuthoritative</directive>
845 is set to <em>off</em>, other configured authentication modules will have
846 a chance to validate the user if the LDAP bind (with the current user's credentials)
847 fails for any reason.</p>
848 <p> This allows users present in both LDAP and
849 <directive module="mod_authn_file">AuthUserFile</directive> to authenticate
850 when the LDAP server is available but the user's account is locked or password
851 is otherwise unusable.</p>
853 <seealso><directive module="mod_authn_file">AuthUserFile</directive></seealso>
854 <seealso><directive module="mod_auth_basic">AuthBasicProvider</directive></seealso>
858 <name>AuthLDAPInitialBindAsUser</name>
859 <description>Determines if the server does the initial DN lookup using the basic authentication users'
860 own username, instead of anonymously or with hard-coded credentials for the server</description>
861 <syntax>AuthLDAPInitialBindAsUser <em>off|on</em></syntax>
862 <default>AuthLDAPInitialBindAsUser off</default>
863 <contextlist><context>directory</context><context>.htaccess</context>
865 <override>AuthConfig</override>
866 <compatibility>Available in version 2.3.6 and later</compatibility>
868 <p>By default, the server either anonymously, or with a dedicated user and
869 password, converts the basic authentication username into an LDAP
870 distinguished name (DN). This directive forces the server to use the verbatim username
871 and password provided by the incoming user to perform the initial DN
874 <p> If the verbatim username can't directly bind, but needs some
875 cosmetic transformation, see <directive module="mod_authnz_ldap">
876 AuthLDAPInitialBindPattern</directive>.</p>
878 <p> This directive should only be used when your LDAP server doesn't
879 accept anonymous searches and you cannot use a dedicated
880 <directive module="mod_authnz_ldap">AuthLDAPBindDN</directive>.
883 <note><title>Not available with authorization-only</title>
884 This directive can only be used if this module authenticates the user, and
885 has no effect when this module is used exclusively for authorization.
888 <seealso><directive module="mod_authnz_ldap">AuthLDAPInitialBindPattern</directive></seealso>
889 <seealso><directive module="mod_authnz_ldap">AuthLDAPBindDN</directive></seealso>
890 <seealso><directive module="mod_authnz_ldap">AuthLDAPCompareAsUser</directive></seealso>
891 <seealso><directive module="mod_authnz_ldap">AuthLDAPSearchAsUser</directive></seealso>
895 <name>AuthLDAPInitialBindPattern</name>
896 <description>Specifies the transformation of the basic authentication username to be used when binding to the LDAP server
897 to perform a DN lookup</description>
898 <syntax>AuthLDAPInitialBindPattern<em><var>regex</var> <var>substitution</var></em></syntax>
899 <default>AuthLDAPInitialBindPattern (.*) $1 (remote username used verbatim)</default>
900 <contextlist><context>directory</context><context>.htaccess</context>
902 <override>AuthConfig</override>
903 <compatibility>Available in version 2.3.6 and later</compatibility>
905 <p>If <directive module="mod_authnz_ldap">AuthLDAPInitialBindAsUser</directive> is set to
906 <em>ON</em>, the basic authentication username will be transformed according to the
907 regular expression and substituion arguments.</p>
909 <p> The regular expression argument is compared against the current basic authentication username.
910 The substitution argument may contain backreferences, but has no other variable interpolation.</p>
912 <p> This directive should only be used when your LDAP server doesn't
913 accept anonymous searches and you cannot use a dedicated
914 <directive module="mod_authnz_ldap">AuthLDAPBindDN</directive>.
917 <highlight language="config"> AuthLDAPInitialBindPattern (.+) $1@example.com </highlight>
918 <highlight language="config"> AuthLDAPInitialBindPattern (.+) cn=$1,dc=example,dc=com</highlight>
920 <note><title>Not available with authorization-only</title>
921 This directive can only be used if this module authenticates the user, and
922 has no effect when this module is used exclusively for authorization.
924 <note><title>debugging</title>
925 The substituted DN is recorded in the environment variable
926 <em>LDAP_BINDASUSER</em>. If the regular expression does not match the input,
927 the verbatim username is used.
930 <seealso><directive module="mod_authnz_ldap">AuthLDAPInitialBindAsUser</directive></seealso>
931 <seealso><directive module="mod_authnz_ldap">AuthLDAPBindDN</directive></seealso>
935 <name>AuthLDAPBindDN</name>
936 <description>Optional DN to use in binding to the LDAP server</description>
937 <syntax>AuthLDAPBindDN <em>distinguished-name</em></syntax>
938 <contextlist><context>directory</context><context>.htaccess</context>
940 <override>AuthConfig</override>
943 <p>An optional DN used to bind to the server when searching for
944 entries. If not provided, <module>mod_authnz_ldap</module> will use
945 an anonymous bind.</p>
950 <name>AuthLDAPBindPassword</name>
951 <description>Password used in conjuction with the bind DN</description>
952 <syntax>AuthLDAPBindPassword <em>password</em></syntax>
953 <contextlist><context>directory</context><context>.htaccess</context>
955 <override>AuthConfig</override>
956 <compatibility><em>exec:</em> was added in 2.4.5.</compatibility>
959 <p>A bind password to use in conjunction with the bind DN. Note
960 that the bind password is probably sensitive data, and should be
961 properly protected. You should only use the <directive
962 module="mod_authnz_ldap">AuthLDAPBindDN</directive> and <directive
963 module="mod_authnz_ldap">AuthLDAPBindPassword</directive> if you
964 absolutely need them to search the directory.</p>
966 <p>If the value begins with exec: the resulting command will be
967 executed and the first line returned to standard output by the
968 program will be used as the password.</p>
969 <highlight language="config">
971 AuthLDAPBindPassword secret
973 #Run /path/to/program to get my password
974 AuthLDAPBindPassword exec:/path/to/program
976 #Run /path/to/otherProgram and provide arguments
977 AuthLDAPBindPassword "exec:/path/to/otherProgram argument1"
984 <name>AuthLDAPCharsetConfig</name>
985 <description>Language to charset conversion configuration file</description>
986 <syntax>AuthLDAPCharsetConfig <em>file-path</em></syntax>
987 <contextlist><context>server config</context>
991 <p>The <directive>AuthLDAPCharsetConfig</directive> directive sets the location
992 of the language to charset conversion configuration file. <var>File-path</var> is relative
993 to the <directive module="core">ServerRoot</directive>. This file specifies
994 the list of language extensions to character sets.
995 Most administrators use the provided <code>charset.conv</code>
996 file, which associates common language extensions to character sets.</p>
998 <p>The file contains lines in the following format:</p>
1001 <var>Language-Extension</var> <var>charset</var> [<var>Language-String</var>] ...
1004 <p>The case of the extension does not matter. Blank lines, and lines
1005 beginning with a hash character (<code>#</code>) are ignored.</p>
1007 </directivesynopsis>
1010 <name>AuthLDAPCompareAsUser</name>
1011 <description>Use the authenticated user's credentials to perform authorization comparisons</description>
1012 <syntax>AuthLDAPCompareAsUser on|off</syntax>
1013 <default>AuthLDAPCompareAsUser off</default>
1014 <contextlist><context>directory</context><context>.htaccess</context>
1016 <override>AuthConfig</override>
1017 <compatibility>Available in version 2.3.6 and later</compatibility>
1020 <p>When set, and <module>mod_authnz_ldap</module> has authenticated the
1021 user, LDAP comparisons for authorization use the queried distinguished name (DN)
1022 and HTTP basic authentication password of the authenticated user instead of
1023 the servers configured credentials.</p>
1025 <p> The <em>ldap-attribute</em>, <em>ldap-user</em>, and <em>ldap-group</em> (single-level only)
1026 authorization checks use comparisons.</p>
1028 <p>This directive only has effect on the comparisons performed during
1029 nested group processing when <directive module="mod_authnz_ldap">
1030 AuthLDAPSearchAsUser</directive> is also enabled.</p>
1032 <p> This directive should only be used when your LDAP server doesn't
1033 accept anonymous comparisons and you cannot use a dedicated
1034 <directive module="mod_authnz_ldap">AuthLDAPBindDN</directive>.
1037 <seealso><directive module="mod_authnz_ldap">AuthLDAPInitialBindAsUser</directive></seealso>
1038 <seealso><directive module="mod_authnz_ldap">AuthLDAPSearchAsUser</directive></seealso>
1039 </directivesynopsis>
1042 <name>AuthLDAPCompareDNOnServer</name>
1043 <description>Use the LDAP server to compare the DNs</description>
1044 <syntax>AuthLDAPCompareDNOnServer on|off</syntax>
1045 <default>AuthLDAPCompareDNOnServer on</default>
1046 <contextlist><context>directory</context><context>.htaccess</context>
1048 <override>AuthConfig</override>
1051 <p>When set, <module>mod_authnz_ldap</module> will use the LDAP
1052 server to compare the DNs. This is the only foolproof way to
1053 compare DNs. <module>mod_authnz_ldap</module> will search the
1054 directory for the DN specified with the <a
1055 href="#reqdn"><code>Require dn</code></a> directive, then,
1056 retrieve the DN and compare it with the DN retrieved from the user
1057 entry. If this directive is not set,
1058 <module>mod_authnz_ldap</module> simply does a string comparison. It
1059 is possible to get false negatives with this approach, but it is
1060 much faster. Note the <module>mod_ldap</module> cache can speed up
1061 DN comparison in most situations.</p>
1063 </directivesynopsis>
1066 <name>AuthLDAPDereferenceAliases</name>
1067 <description>When will the module de-reference aliases</description>
1068 <syntax>AuthLDAPDereferenceAliases never|searching|finding|always</syntax>
1069 <default>AuthLDAPDereferenceAliases always</default>
1070 <contextlist><context>directory</context><context>.htaccess</context>
1072 <override>AuthConfig</override>
1075 <p>This directive specifies when <module>mod_authnz_ldap</module> will
1076 de-reference aliases during LDAP operations. The default is
1077 <code>always</code>.</p>
1079 </directivesynopsis>
1082 <name>AuthLDAPGroupAttribute</name>
1083 <description>LDAP attributes used to identify the user members of
1084 groups.</description>
1085 <syntax>AuthLDAPGroupAttribute <em>attribute</em></syntax>
1086 <default>AuthLDAPGroupAttribute member uniquemember</default>
1087 <contextlist><context>directory</context><context>.htaccess</context>
1089 <override>AuthConfig</override>
1092 <p>This directive specifies which LDAP attributes are used to
1093 check for user members within groups. Multiple attributes can be used
1094 by specifying this directive multiple times. If not specified,
1095 then <module>mod_authnz_ldap</module> uses the <code>member</code> and
1096 <code>uniquemember</code> attributes.</p>
1098 </directivesynopsis>
1101 <name>AuthLDAPGroupAttributeIsDN</name>
1102 <description>Use the DN of the client username when checking for
1103 group membership</description>
1104 <syntax>AuthLDAPGroupAttributeIsDN on|off</syntax>
1105 <default>AuthLDAPGroupAttributeIsDN on</default>
1106 <contextlist><context>directory</context><context>.htaccess</context>
1108 <override>AuthConfig</override>
1111 <p>When set <code>on</code>, this directive says to use the
1112 distinguished name of the client username when checking for group
1113 membership. Otherwise, the username will be used. For example,
1114 assume that the client sent the username <code>bjenson</code>,
1115 which corresponds to the LDAP DN <code>cn=Babs Jenson,
1116 o=Example</code>. If this directive is set,
1117 <module>mod_authnz_ldap</module> will check if the group has
1118 <code>cn=Babs Jenson, o=Example</code> as a member. If this
1119 directive is not set, then <module>mod_authnz_ldap</module> will
1120 check if the group has <code>bjenson</code> as a member.</p>
1122 </directivesynopsis>
1125 <name>AuthLDAPMaxSubGroupDepth</name>
1126 <description>Specifies the maximum sub-group nesting depth that will be
1127 evaluated before the user search is discontinued.</description>
1128 <syntax>AuthLDAPMaxSubGroupDepth <var>Number</var></syntax>
1129 <default>AuthLDAPMaxSubGroupDepth 0</default>
1130 <contextlist><context>directory</context><context>.htaccess</context>
1132 <override>AuthConfig</override>
1133 <compatibility>Available in version 2.3.0 and later, defaulted to 10 in 2.4.x and early 2.5</compatibility>
1136 <p>When this directive is set to a non-zero value <code>X</code>
1137 combined with use of the <code>Require ldap-group someGroupDN</code>
1138 directive, the provided user credentials will be searched for
1139 as a member of the <code>someGroupDN</code> directory object or of
1140 any group member of the current group up to the maximum nesting
1141 level <code>X</code> specified by this directive.</p>
1142 <p>See the <a href="#reqgroup"><code>Require ldap-group</code></a>
1143 section for a more detailed example.</p>
1145 <note><title>Nested groups performance</title>
1146 <p> When <directive>AuthLDAPSubGroupAttribute</directive> overlaps with
1147 <directive>AuthLDAPGroupAttribute</directive> (as it does by default and
1148 as required by common LDAP schemas), uncached searching for subgroups in
1149 large groups can be very slow. If you use large, non-nested groups, keep
1150 <directive>AuthLDAPMaxSubGroupDepth</directive> set to zero.</p>
1154 </directivesynopsis>
1157 <name>AuthLDAPRemoteUserAttribute</name>
1158 <description>Use the value of the attribute returned during the user
1159 query to set the REMOTE_USER environment variable</description>
1160 <syntax>AuthLDAPRemoteUserAttribute uid</syntax>
1161 <default>none</default>
1162 <contextlist><context>directory</context><context>.htaccess</context>
1164 <override>AuthConfig</override>
1167 <p>If this directive is set, the value of the
1168 <code>REMOTE_USER</code> environment variable will be set to the
1169 value of the attribute specified. Make sure that this attribute is
1170 included in the list of attributes in the AuthLDAPUrl definition,
1171 otherwise this directive will have no effect. This directive, if
1172 present, takes precedence over <directive module="mod_authnz_ldap"
1173 >AuthLDAPRemoteUserIsDN</directive>. This
1174 directive is useful should you want people to log into a website
1175 using an email address, but a backend application expects the
1176 username as a userid.</p>
1177 <p> This directive only has effect when this module is used for
1180 </directivesynopsis>
1183 <name>AuthLDAPRemoteUserIsDN</name>
1184 <description>Use the DN of the client username to set the REMOTE_USER
1185 environment variable</description>
1186 <syntax>AuthLDAPRemoteUserIsDN on|off</syntax>
1187 <default>AuthLDAPRemoteUserIsDN off</default>
1188 <contextlist><context>directory</context><context>.htaccess</context>
1190 <override>AuthConfig</override>
1193 <p>If this directive is set to on, the value of the
1194 <code>REMOTE_USER</code> environment variable will be set to the full
1195 distinguished name of the authenticated user, rather than just
1196 the username that was passed by the client. It is turned off by
1198 <p> This directive only has effect when this module is used for
1201 </directivesynopsis>
1204 <name>AuthLDAPSearchAsUser</name>
1205 <description>Use the authenticated user's credentials to perform authorization searches</description>
1206 <syntax>AuthLDAPSearchAsUser on|off</syntax>
1207 <default>AuthLDAPSearchAsUser off</default>
1208 <contextlist><context>directory</context><context>.htaccess</context>
1210 <override>AuthConfig</override>
1211 <compatibility>Available in version 2.3.6 and later</compatibility>
1214 <p>When set, and <module>mod_authnz_ldap</module> has authenticated the
1215 user, LDAP searches for authorization use the queried distinguished name (DN)
1216 and HTTP basic authentication password of the authenticated user instead of
1217 the servers configured credentials.</p>
1219 <p> The <em>ldap-filter</em> and <em>ldap-dn</em> authorization
1220 checks use searches.</p>
1222 <p>This directive only has effect on the comparisons performed during
1223 nested group processing when <directive module="mod_authnz_ldap">
1224 AuthLDAPCompareAsUser</directive> is also enabled.</p>
1226 <p> This directive should only be used when your LDAP server doesn't
1227 accept anonymous searches and you cannot use a dedicated
1228 <directive module="mod_authnz_ldap">AuthLDAPBindDN</directive>.
1231 <seealso><directive module="mod_authnz_ldap">AuthLDAPInitialBindAsUser</directive></seealso>
1232 <seealso><directive module="mod_authnz_ldap">AuthLDAPCompareAsUser</directive></seealso>
1233 </directivesynopsis>
1236 <name>AuthLDAPSubGroupAttribute</name>
1237 <description>Specifies the attribute labels, one value per
1238 directive line, used to distinguish the members of the current group that
1239 are groups.</description>
1240 <syntax>AuthLDAPSubGroupAttribute <em>attribute</em></syntax>
1241 <default>AuthLDAPSubgroupAttribute member uniquemember</default>
1242 <contextlist><context>directory</context><context>.htaccess</context>
1244 <override>AuthConfig</override>
1245 <compatibility>Available in version 2.3.0 and later</compatibility>
1248 <p>An LDAP group object may contain members that are users and
1249 members that are groups (called nested or sub groups). The
1250 <code>AuthLDAPSubGroupAttribute</code> directive identifies the
1251 labels of group members and the <code>AuthLDAPGroupAttribute</code>
1252 directive identifies the labels of the user members. Multiple
1253 attributes can be used by specifying this directive multiple times.
1254 If not specified, then <module>mod_authnz_ldap</module> uses the
1255 <code>member</code> and <code>uniqueMember</code> attributes.</p>
1257 </directivesynopsis>
1260 <name>AuthLDAPSubGroupClass</name>
1261 <description>Specifies which LDAP objectClass values identify directory
1262 objects that are groups during sub-group processing.</description>
1263 <syntax>AuthLDAPSubGroupClass <em>LdapObjectClass</em></syntax>
1264 <default>AuthLDAPSubGroupClass groupOfNames groupOfUniqueNames</default>
1265 <contextlist><context>directory</context><context>.htaccess</context>
1267 <override>AuthConfig</override>
1268 <compatibility>Available in version 2.3.0 and later</compatibility>
1271 <p>An LDAP group object may contain members that are users and
1272 members that are groups (called nested or sub groups). The
1273 <code>AuthLDAPSubGroupAttribute</code> directive identifies the
1274 labels of members that may be sub-groups of the current group
1275 (as opposed to user members). The <code>AuthLDAPSubGroupClass</code>
1276 directive specifies the LDAP objectClass values used in verifying that
1277 these potential sub-groups are in fact group objects. Verified sub-groups
1278 can then be searched for more user or sub-group members. Multiple
1279 attributes can be used by specifying this directive multiple times.
1280 If not specified, then <module>mod_authnz_ldap</module> uses the
1281 <code>groupOfNames</code> and <code>groupOfUniqueNames</code> values.</p>
1283 </directivesynopsis>
1286 <name>AuthLDAPUrl</name>
1287 <description>URL specifying the LDAP search parameters</description>
1288 <syntax>AuthLDAPUrl <em>url [NONE|SSL|TLS|STARTTLS]</em></syntax>
1289 <contextlist><context>directory</context><context>.htaccess</context>
1291 <override>AuthConfig</override>
1294 <p>An RFC 2255 URL which specifies the LDAP search parameters
1295 to use. The syntax of the URL is</p>
1296 <example>ldap://host:port/basedn?attribute?scope?filter</example>
1297 <p>If you want to specify more than one LDAP URL that Apache should try in turn, the syntax is:</p>
1298 <highlight language="config">AuthLDAPUrl "ldap://ldap1.example.com ldap2.example.com/dc=..."</highlight>
1299 <p><em><strong>Caveat: </strong>If you specify multiple servers, you need to enclose the entire URL string in quotes;
1300 otherwise you will get an error: "AuthLDAPURL takes one argument, URL to define LDAP connection.." </em>
1301 You can of course use search parameters on each of these.</p>
1306 <dd>For regular ldap, use the
1307 string <code>ldap</code>. For secure LDAP, use <code>ldaps</code>
1308 instead. Secure LDAP is only available if Apache was linked
1309 to an LDAP library with SSL support.</dd>
1314 <p>The name/port of the ldap server (defaults to
1315 <code>localhost:389</code> for <code>ldap</code>, and
1316 <code>localhost:636</code> for <code>ldaps</code>). To
1317 specify multiple, redundant LDAP servers, just list all
1318 servers, separated by spaces. <module>mod_authnz_ldap</module>
1319 will try connecting to each server in turn, until it makes a
1320 successful connection. If multiple ldap servers are specified,
1321 then entire LDAP URL must be encapsulated in double quotes.</p>
1323 <p>Once a connection has been made to a server, that
1324 connection remains active for the life of the
1325 <program>httpd</program> process, or until the LDAP server goes
1328 <p>If the LDAP server goes down and breaks an existing
1329 connection, <module>mod_authnz_ldap</module> will attempt to
1330 re-connect, starting with the primary server, and trying
1331 each redundant server in turn. Note that this is different
1332 than a true round-robin search.</p>
1337 <dd>The DN of the branch of the
1338 directory where all searches should start from. At the very
1339 least, this must be the top of your directory tree, but
1340 could also specify a subtree in the directory.</dd>
1344 <dd>The attribute to search for.
1345 Although RFC 2255 allows a comma-separated list of
1346 attributes, only the first attribute will be used, no
1347 matter how many are provided. If no attributes are
1348 provided, the default is to use <code>uid</code>. It's a good
1349 idea to choose an attribute that will be unique across all
1350 entries in the subtree you will be using. All attributes
1351 listed will be put into the environment with an AUTHENTICATE_ prefix
1352 for use by other modules.</dd>
1356 <dd>The scope of the search. Can be either <code>one</code> or
1357 <code>sub</code>. Note that a scope of <code>base</code> is
1358 also supported by RFC 2255, but is not supported by this
1359 module. If the scope is not provided, or if <code>base</code> scope
1360 is specified, the default is to use a scope of
1361 <code>sub</code>.</dd>
1365 <dd>A valid LDAP search filter. If
1366 not provided, defaults to <code>(objectClass=*)</code>, which
1367 will search for all objects in the tree. Filters are
1368 limited to approximately 8000 characters (the definition of
1369 <code>MAX_STRING_LEN</code> in the Apache source code). This
1370 should be more than sufficient for any application. The keyword
1371 <code>none</code> disables the use of a filter; this is required
1372 by some primitive LDAP servers.</dd>
1375 <p>When doing searches, the attribute, filter and username passed
1376 by the HTTP client are combined to create a search filter that
1378 <code>(&(<em>filter</em>)(<em>attribute</em>=<em>username</em>))</code>.</p>
1380 <p>For example, consider an URL of
1381 <code>ldap://ldap.example.com/o=Example?cn?sub?(posixid=*)</code>. When
1382 a client attempts to connect using a username of <code>Babs
1383 Jenson</code>, the resulting search filter will be
1384 <code>(&(posixid=*)(cn=Babs Jenson))</code>.</p>
1386 <p>An optional parameter can be added to allow the LDAP Url to override
1387 the connection type. This parameter can be one of the following:</p>
1391 <dd>Establish an unsecure connection on the default LDAP port. This
1392 is the same as <code>ldap://</code> on port 389.</dd>
1394 <dd>Establish a secure connection on the default secure LDAP port.
1395 This is the same as <code>ldaps://</code></dd>
1396 <dt>TLS | STARTTLS</dt>
1397 <dd>Establish an upgraded secure connection on the default LDAP port.
1398 This connection will be initiated on port 389 by default and then
1399 upgraded to a secure connection on the same port.</dd>
1402 <p>See above for examples of <directive
1403 module="mod_authnz_ldap">AuthLDAPURL</directive> URLs.</p>
1405 </directivesynopsis>