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>
70 <li> <a href="#gcaveats">General caveats</a> </li>
71 <li> <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="gcaveats"><title>General caveats</title>
113 <p> This module caches authentication and authorization results based
114 on the configuration of <module>mod_ldap</module>. Changes
115 made to the backing LDAP server will not be immediately reflected on the
116 HTTP Server, including but not limited to user lockouts/revocations,
117 password changes, or changes to group memberships. Consult the directives
118 in <module>mod_ldap</module> for details of the cache tunables.
122 <section id="operation"><title>Operation</title>
124 <p>There are two phases in granting access to a user. The first
125 phase is authentication, in which the <module>mod_authnz_ldap</module>
126 authentication provider verifies that the user's credentials are valid.
127 This is also called the <em>search/bind</em> phase. The second phase is
128 authorization, in which <module>mod_authnz_ldap</module> determines
129 if the authenticated user is allowed access to the resource in
130 question. This is also known as the <em>compare</em>
133 <p><module>mod_authnz_ldap</module> registers both an authn_ldap authentication
134 provider and an authz_ldap authorization handler. The authn_ldap
135 authentication provider can be enabled through the
136 <directive module="mod_auth_basic">AuthBasicProvider</directive> directive
137 using the <code>ldap</code> value. The authz_ldap handler extends the
138 <directive module="mod_authz_core">Require</directive> directive's authorization types
139 by adding <code>ldap-user</code>, <code>ldap-dn</code> and <code>ldap-group</code>
142 <section id="authenphase"><title>The Authentication
145 <p>During the authentication phase, <module>mod_authnz_ldap</module>
146 searches for an entry in the directory that matches the username
147 that the HTTP client passes. If a single unique match is found,
148 then <module>mod_authnz_ldap</module> attempts to bind to the
149 directory server using the DN of the entry plus the password
150 provided by the HTTP client. Because it does a search, then a
151 bind, it is often referred to as the search/bind phase. Here are
152 the steps taken during the search/bind phase.</p>
155 <li>Generate a search filter by combining the attribute and
156 filter provided in the <directive module="mod_authnz_ldap"
157 >AuthLDAPURL</directive> directive with
158 the username passed by the HTTP client.</li>
160 <li>Search the directory using the generated filter. If the
161 search does not return exactly one entry, deny or decline
164 <li>Fetch the distinguished name of the entry retrieved from
165 the search and attempt to bind to the LDAP server using that
166 DN and the password passed by the HTTP client. If the bind is
167 unsuccessful, deny or decline access.</li>
170 <p>The following directives are used during the search/bind
174 <columnspec><column width=".3"/><column width=".7"/></columnspec>
176 <td><directive module="mod_authnz_ldap">AuthLDAPURL</directive></td>
178 <td>Specifies the LDAP server, the
179 base DN, the attribute to use in the search, as well as the
180 extra search filter to use.</td>
184 <td><directive module="mod_authnz_ldap">AuthLDAPBindDN</directive></td>
186 <td>An optional DN to bind with
187 during the search phase.</td>
192 module="mod_authnz_ldap">AuthLDAPBindPassword</directive></td>
194 <td>An optional password to bind
195 with during the search phase.</td>
200 <section id="authorphase"><title>The Authorization Phase</title>
202 <p>During the authorization phase, <module>mod_authnz_ldap</module>
203 attempts to determine if the user is authorized to access the
204 resource. Many of these checks require
205 <module>mod_authnz_ldap</module> to do a compare operation on the
206 LDAP server. This is why this phase is often referred to as the
207 compare phase. <module>mod_authnz_ldap</module> accepts the
208 following <directive module="mod_authz_core">Require</directive>
209 directives to determine if the credentials are acceptable:</p>
212 <li>Grant access if there is a <a
213 href="#reqgroup"><code>Require ldap-user</code></a> directive, and the
214 username in the directive matches the username passed by the
217 <li>Grant access if there is a <a href="#reqdn"><code>Require
218 ldap-dn</code></a> directive, and the DN in the directive matches
219 the DN fetched from the LDAP directory.</li>
221 <li>Grant access if there is a <a
222 href="#reqgroup"><code>Require ldap-group</code></a> directive, and
223 the DN fetched from the LDAP directory (or the username
224 passed by the client) occurs in the LDAP group or, potentially, in
225 one of its sub-groups.</li>
227 <li>Grant access if there is a <a href="#reqattribute">
228 <code>Require ldap-attribute</code></a>
229 directive, and the attribute fetched from the LDAP directory
230 matches the given value.</li>
232 <li>Grant access if there is a <a href="#reqfilter">
233 <code>Require ldap-filter</code></a>
234 directive, and the search filter successfully finds a single user
235 object that matches the dn of the authenticated user.</li>
237 <li>Grant access if there is a <a href="#reqsearch">
238 <code>Require ldap-search</code></a>
239 directive, and the search filter successfully returns a single
240 matching object with any distinguished name.</li>
242 <li>otherwise, deny or decline access</li>
245 <p>Other <directive module="mod_authz_core">Require</directive> values may also
246 be used which may require loading additional authorization modules.</p>
249 <li>Grant access to all successfully authenticated users if
250 there is a <a href="#requser"><code>Require valid-user</code></a>
251 directive. (requires <module>mod_authz_user</module>)</li>
253 <li>Grant access if there is a <a
254 href="#reqgroup"><code>Require group</code></a> directive, and
255 <module>mod_authz_groupfile</module> has been loaded with the
256 <directive module="mod_authz_groupfile">AuthGroupFile</directive>
263 <p><module>mod_authnz_ldap</module> uses the following directives during the
267 <columnspec><column width=".4"/><column width=".6"/></columnspec>
269 <td><directive module="mod_authnz_ldap">AuthLDAPURL</directive> </td>
271 <td>The attribute specified in the
272 URL is used in compare operations for the <code>Require
273 ldap-user</code> operation.</td>
278 module="mod_authnz_ldap">AuthLDAPCompareDNOnServer</directive></td>
280 <td>Determines the behavior of the
281 <code>Require ldap-dn</code> directive.</td>
286 module="mod_authnz_ldap">AuthLDAPGroupAttribute</directive></td>
288 <td>Determines the attribute to
289 use for comparisons in the <code>Require ldap-group</code>
295 module="mod_authnz_ldap">AuthLDAPGroupAttributeIsDN</directive></td>
297 <td>Specifies whether to use the
298 user DN or the username when doing comparisons for the
299 <code>Require ldap-group</code> directive.</td>
304 module="mod_authnz_ldap">AuthLDAPMaxSubGroupDepth</directive></td>
306 <td>Determines the maximum depth of sub-groups that will be evaluated
307 during comparisons in the <code>Require ldap-group</code> directive.</td>
312 module="mod_authnz_ldap">AuthLDAPSubGroupAttribute</directive></td>
314 <td>Determines the attribute to use when obtaining sub-group members
315 of the current group during comparisons in the <code>Require ldap-group</code>
321 module="mod_authnz_ldap">AuthLDAPSubGroupClass</directive></td>
323 <td>Specifies the LDAP objectClass values used to identify if queried directory
324 objects really are group objects (as opposed to user objects) during the
325 <code>Require ldap-group</code> directive's sub-group processing.</td>
331 <section id="requiredirectives"><title>The Require Directives</title>
333 <p>Apache's <directive module="mod_authz_core">Require</directive>
334 directives are used during the authorization phase to ensure that
335 a user is allowed to access a resource. mod_authnz_ldap extends the
336 authorization types with <code>ldap-user</code>, <code>ldap-dn</code>,
337 <code>ldap-group</code>, <code>ldap-attribute</code> and
338 <code>ldap-filter</code>. Other authorization types may also be
339 used but may require that additional authorization modules be loaded.</p>
341 <p>Since v2.4.8, <a href="../expr.html">expressions</a> are supported
342 within the LDAP require directives.</p>
344 <section id="requser"><title>Require ldap-user</title>
346 <p>The <code>Require ldap-user</code> directive specifies what
347 usernames can access the resource. Once
348 <module>mod_authnz_ldap</module> has retrieved a unique DN from the
349 directory, it does an LDAP compare operation using the username
350 specified in the <code>Require ldap-user</code> to see if that username
351 is part of the just-fetched LDAP entry. Multiple users can be
352 granted access by putting multiple usernames on the line,
353 separated with spaces. If a username has a space in it, then it
354 must be surrounded with double quotes. Multiple users can also be
355 granted access by using multiple <code>Require ldap-user</code>
356 directives, with one user per line. For example, with a <directive
357 module="mod_authnz_ldap">AuthLDAPURL</directive> of
358 <code>ldap://ldap/o=Example?cn</code> (i.e., <code>cn</code> is
359 used for searches), the following Require directives could be used
360 to restrict access:</p>
361 <highlight language="config">
362 Require ldap-user "Barbara Jenson"
363 Require ldap-user "Fred User"
364 Require ldap-user "Joe Manager"
367 <p>Because of the way that <module>mod_authnz_ldap</module> handles this
368 directive, Barbara Jenson could sign on as <em>Barbara
369 Jenson</em>, <em>Babs Jenson</em> or any other <code>cn</code> that
370 she has in her LDAP entry. Only the single <code>Require
371 ldap-user</code> line is needed to support all values of the attribute
372 in the user's entry.</p>
374 <p>If the <code>uid</code> attribute was used instead of the
375 <code>cn</code> attribute in the URL above, the above three lines
376 could be condensed to</p>
377 <highlight language="config">
378 Require ldap-user bjenson fuser jmanager
382 <section id="reqgroup"><title>Require ldap-group</title>
384 <p>This directive specifies an LDAP group whose members are
385 allowed access. It takes the distinguished name of the LDAP
386 group. Note: Do not surround the group name with quotes.
387 For example, assume that the following entry existed in
388 the LDAP directory:</p>
390 dn: cn=Administrators, o=Example
391 objectClass: groupOfUniqueNames
392 uniqueMember: cn=Barbara Jenson, o=Example
393 uniqueMember: cn=Fred User, o=Example
396 <p>The following directive would grant access to both Fred and
398 <highlight language="config">
399 Require ldap-group cn=Administrators, o=Example
402 <p>Members can also be found within sub-groups of a specified LDAP group
403 if <directive module="mod_authnz_ldap">AuthLDAPMaxSubGroupDepth</directive>
404 is set to a value greater than 0. For example, assume the following entries
405 exist in the LDAP directory:</p>
407 dn: cn=Employees, o=Example
408 objectClass: groupOfUniqueNames
409 uniqueMember: cn=Managers, o=Example
410 uniqueMember: cn=Administrators, o=Example
411 uniqueMember: cn=Users, o=Example
413 dn: cn=Managers, o=Example
414 objectClass: groupOfUniqueNames
415 uniqueMember: cn=Bob Ellis, o=Example
416 uniqueMember: cn=Tom Jackson, o=Example
418 dn: cn=Administrators, o=Example
419 objectClass: groupOfUniqueNames
420 uniqueMember: cn=Barbara Jenson, o=Example
421 uniqueMember: cn=Fred User, o=Example
423 dn: cn=Users, o=Example
424 objectClass: groupOfUniqueNames
425 uniqueMember: cn=Allan Jefferson, o=Example
426 uniqueMember: cn=Paul Tilley, o=Example
427 uniqueMember: cn=Temporary Employees, o=Example
429 dn: cn=Temporary Employees, o=Example
430 objectClass: groupOfUniqueNames
431 uniqueMember: cn=Jim Swenson, o=Example
432 uniqueMember: cn=Elliot Rhodes, o=Example
435 <p>The following directives would allow access for Bob Ellis, Tom Jackson,
436 Barbara Jenson, Fred User, Allan Jefferson, and Paul Tilley but would not
437 allow access for Jim Swenson, or Elliot Rhodes (since they are at a
438 sub-group depth of 2):</p>
439 <highlight language="config">
440 Require ldap-group cn=Employees, o=Example
441 AuthLDAPMaxSubGroupDepth 1
444 <p>Behavior of this directive is modified by the <directive
445 module="mod_authnz_ldap">AuthLDAPGroupAttribute</directive>, <directive
446 module="mod_authnz_ldap">AuthLDAPGroupAttributeIsDN</directive>, <directive
447 module="mod_authnz_ldap">AuthLDAPMaxSubGroupDepth</directive>, <directive
448 module="mod_authnz_ldap">AuthLDAPSubGroupAttribute</directive>, and <directive
449 module="mod_authnz_ldap">AuthLDAPSubGroupClass</directive>
453 <section id="reqdn"><title>Require ldap-dn</title>
455 <p>The <code>Require ldap-dn</code> directive allows the administrator
456 to grant access based on distinguished names. It specifies a DN
457 that must match for access to be granted. If the distinguished
458 name that was retrieved from the directory server matches the
459 distinguished name in the <code>Require ldap-dn</code>, then
460 authorization is granted. Note: do not surround the distinguished
461 name with quotes.</p>
463 <p>The following directive would grant access to a specific
465 <highlight language="config">
466 Require ldap-dn cn=Barbara Jenson, o=Example
469 <p>Behavior of this directive is modified by the <directive
470 module="mod_authnz_ldap">AuthLDAPCompareDNOnServer</directive>
474 <section id="reqattribute"><title>Require ldap-attribute</title>
476 <p>The <code>Require ldap-attribute</code> directive allows the
477 administrator to grant access based on attributes of the authenticated
478 user in the LDAP directory. If the attribute in the directory
479 matches the value given in the configuration, access is granted.</p>
481 <p>The following directive would grant access to anyone with
482 the attribute employeeType = active</p>
484 <highlight language="config">
485 Require ldap-attribute employeeType="active"
488 <p>Multiple attribute/value pairs can be specified on the same line
489 separated by spaces or they can be specified in multiple
490 <code>Require ldap-attribute</code> directives. The effect of listing
491 multiple attribute/values pairs is an OR operation. Access will be
492 granted if any of the listed attribute values match the value of the
493 corresponding attribute in the user object. If the value of the
494 attribute contains a space, only the value must be within double quotes.</p>
496 <p>The following directive would grant access to anyone with
497 the city attribute equal to "San Jose" or status equal to "Active"</p>
499 <highlight language="config">
500 Require ldap-attribute city="San Jose" status="active"
505 <section id="reqfilter"><title>Require ldap-filter</title>
507 <p>The <code>Require ldap-filter</code> directive allows the
508 administrator to grant access based on a complex LDAP search filter.
509 If the dn returned by the filter search matches the authenticated user
510 dn, access is granted.</p>
512 <p>The following directive would grant access to anyone having a cell phone
513 and is in the marketing department</p>
515 <highlight language="config">
516 Require ldap-filter "&(cell=*)(department=marketing)"
519 <p>The difference between the <code>Require ldap-filter</code> directive and the
520 <code>Require ldap-attribute</code> directive is that <code>ldap-filter</code>
521 performs a search operation on the LDAP directory using the specified search
522 filter rather than a simple attribute comparison. If a simple attribute
523 comparison is all that is required, the comparison operation performed by
524 <code>ldap-attribute</code> will be faster than the search operation
525 used by <code>ldap-filter</code> especially within a large directory.</p>
527 <p>When using an <a href="../expr.html">expression</a> within the filter, care
528 must be taken to ensure that LDAP filters are escaped correctly to guard against
529 LDAP injection. The ldap function can be used for this purpose.</p>
531 <highlight language="config">
532 <LocationMatch "^/dav/(?<SITENAME>[^/]+)/">
533 Require ldap-filter "(memberOf=cn=%{ldap:%{unescape:%{env:MATCH_SITENAME}},ou=Websites,o=Example)"
534 </LocationMatch>
539 <section id="reqsearch"><title>Require ldap-search</title>
541 <p>The <code>Require ldap-search</code> directive allows the
542 administrator to grant access based on a generic LDAP search filter using an
543 <a href="../expr.html">expression</a>. If there is exactly one match to the search filter,
544 regardless of the distinguished name, access is granted.</p>
546 <p>The following directive would grant access to URLs that match the given objects in the
549 <highlight language="config">
550 <LocationMatch "^/dav/(?<SITENAME>[^/]+)/">
551 Require ldap-search "(cn=%{ldap:%{unescape:%{env:MATCH_SITENAME}} Website)"
552 </LocationMatch>
555 <p>Note: care must be taken to ensure that any expressions are properly escaped to guard
556 against LDAP injection. The <strong>ldap</strong> function can be used as per the example
563 <section id="examples"><title>Examples</title>
567 Grant access to anyone who exists in the LDAP directory,
568 using their UID for searches.
569 <highlight language="config">
570 AuthLDAPURL "ldap://ldap1.example.com:389/ou=People, o=Example?uid?sub?(objectClass=*)"
576 The next example is the same as above; but with the fields
577 that have useful defaults omitted. Also, note the use of a
578 redundant LDAP server.
579 <highlight language="config">
580 AuthLDAPURL "ldap://ldap1.example.com ldap2.example.com/ou=People, o=Example"
586 The next example is similar to the previous one, but it
587 uses the common name instead of the UID. Note that this
588 could be problematical if multiple people in the directory
589 share the same <code>cn</code>, because a search on <code>cn</code>
590 <strong>must</strong> return exactly one entry. That's why
591 this approach is not recommended: it's a better idea to
592 choose an attribute that is guaranteed unique in your
593 directory, such as <code>uid</code>.
594 <highlight language="config">
595 AuthLDAPURL "ldap://ldap.example.com/ou=People, o=Example?cn"
601 Grant access to anybody in the Administrators group. The
602 users must authenticate using their UID.
603 <highlight language="config">
604 AuthLDAPURL ldap://ldap.example.com/o=Example?uid
605 Require ldap-group cn=Administrators, o=Example
610 Grant access to anybody in the group whose name matches the
611 hostname of the virtual host. In this example an
612 <a href="../expr.html">expression</a> is used to build the filter.
613 <highlight language="config">
614 AuthLDAPURL ldap://ldap.example.com/o=Example?uid
615 Require ldap-group cn=%{SERVER_NAME}, o=Example
620 The next example assumes that everyone at Example who
621 carries an alphanumeric pager will have an LDAP attribute
622 of <code>qpagePagerID</code>. The example will grant access
623 only to people (authenticated via their UID) who have
625 <highlight language="config">
626 AuthLDAPURL ldap://ldap.example.com/o=Example?uid??(qpagePagerID=*)
632 <p>The next example demonstrates the power of using filters
633 to accomplish complicated administrative requirements.
634 Without filters, it would have been necessary to create a
635 new LDAP group and ensure that the group's members remain
636 synchronized with the pager users. This becomes trivial
637 with filters. The goal is to grant access to anyone who has
638 a pager, plus grant access to Joe Manager, who doesn't
639 have a pager, but does need to access the same
641 <highlight language="config">
642 AuthLDAPURL ldap://ldap.example.com/o=Example?uid??(|(qpagePagerID=*)(uid=jmanager))
646 <p>This last may look confusing at first, so it helps to
647 evaluate what the search filter will look like based on who
648 connects, as shown below. If
649 Fred User connects as <code>fuser</code>, the filter would look
652 <example>(&(|(qpagePagerID=*)(uid=jmanager))(uid=fuser))</example>
654 <p>The above search will only succeed if <em>fuser</em> has a
655 pager. When Joe Manager connects as <em>jmanager</em>, the
656 filter looks like</p>
658 <example>(&(|(qpagePagerID=*)(uid=jmanager))(uid=jmanager))</example>
660 <p>The above search will succeed whether <em>jmanager</em>
661 has a pager or not.</p>
666 <section id="usingtls"><title>Using TLS</title>
668 <p>To use TLS, see the <module>mod_ldap</module> directives <directive
669 module="mod_ldap">LDAPTrustedClientCert</directive>, <directive
670 module="mod_ldap">LDAPTrustedGlobalCert</directive> and <directive
671 module="mod_ldap">LDAPTrustedMode</directive>.</p>
673 <p>An optional second parameter can be added to the
674 <directive module="mod_authnz_ldap">AuthLDAPURL</directive> to override
675 the default connection type set by <directive module="mod_ldap">LDAPTrustedMode</directive>.
676 This will allow the connection established by an <em>ldap://</em> Url
677 to be upgraded to a secure connection on the same port.</p>
680 <section id="usingssl"><title>Using SSL</title>
682 <p>To use SSL, see the <module>mod_ldap</module> directives <directive
683 module="mod_ldap">LDAPTrustedClientCert</directive>, <directive
684 module="mod_ldap">LDAPTrustedGlobalCert</directive> and <directive
685 module="mod_ldap">LDAPTrustedMode</directive>.</p>
687 <p>To specify a secure LDAP server, use <em>ldaps://</em> in the
688 <directive module="mod_authnz_ldap">AuthLDAPURL</directive>
689 directive, instead of <em>ldap://</em>.</p>
692 <section id="exposed"><title>Exposing Login Information</title>
694 <p>when this module performs <em>authentication</em>, ldap attributes specified
695 in the <directive module="mod_authnz_ldap">AuthLDAPURL</directive>
696 directive are placed in environment variables with the prefix "AUTHENTICATE_".</p>
698 <p>when this module performs <em>authorization</em>, ldap attributes specified
699 in the <directive module="mod_authnz_ldap">AuthLDAPURL</directive>
700 directive are placed in environment variables with the prefix "AUTHORIZE_".</p>
702 <p>If the attribute field contains the username, common name
703 and telephone number of a user, a CGI program will have access to
704 this information without the need to make a second independent LDAP
705 query to gather this additional information.</p>
707 <p>This has the potential to dramatically simplify the coding and
708 configuration required in some web applications.</p>
712 <section id="activedirectory"><title>Using Active Directory</title>
714 <p>An Active Directory installation may support multiple domains at the
715 same time. To distinguish users between domains, an identifier called
716 a User Principle Name (UPN) can be added to a user's entry in the
717 directory. This UPN usually takes the form of the user's account
718 name, followed by the domain components of the particular domain,
719 for example <em>somebody@nz.example.com</em>.</p>
721 <p>You may wish to configure the <module>mod_authnz_ldap</module>
722 module to authenticate users present in any of the domains making up
723 the Active Directory forest. In this way both
724 <em>somebody@nz.example.com</em> and <em>someone@au.example.com</em>
725 can be authenticated using the same query at the same time.</p>
727 <p>To make this practical, Active Directory supports the concept of
728 a Global Catalog. This Global Catalog is a read only copy of selected
729 attributes of all the Active Directory servers within the Active
730 Directory forest. Querying the Global Catalog allows all the domains
731 to be queried in a single query, without the query spanning servers
732 over potentially slow links.</p>
734 <p>If enabled, the Global Catalog is an independent directory server
735 that runs on port 3268 (3269 for SSL). To search for a user, do a
736 subtree search for the attribute <em>userPrincipalName</em>, with
737 an empty search root, like so:</p>
739 <highlight language="config">
740 AuthLDAPBindDN apache@example.com
741 AuthLDAPBindPassword password
742 AuthLDAPURL ldap://10.0.0.1:3268/?userPrincipalName?sub
745 <p>Users will need to enter their User Principal Name as a login, in
746 the form <em>somebody@nz.example.com</em>.</p>
750 <section id="frontpage"><title>Using Microsoft
751 FrontPage with mod_authnz_ldap</title>
753 <p>Normally, FrontPage uses FrontPage-web-specific user/group
754 files (i.e., the <module>mod_authn_file</module> and
755 <module>mod_authz_groupfile</module> modules) to handle all
756 authentication. Unfortunately, it is not possible to just
757 change to LDAP authentication by adding the proper directives,
758 because it will break the <em>Permissions</em> forms in
759 the FrontPage client, which attempt to modify the standard
760 text-based authorization files.</p>
762 <p>Once a FrontPage web has been created, adding LDAP
763 authentication to it is a matter of adding the following
764 directives to <em>every</em> <code>.htaccess</code> file
765 that gets created in the web</p>
766 <highlight language="config">
767 AuthLDAPURL "the url"
768 AuthGroupFile "mygroupfile"
769 Require group "mygroupfile"
772 <section id="howitworks"><title>How It Works</title>
774 <p>FrontPage restricts access to a web by adding the <code>Require
775 valid-user</code> directive to the <code>.htaccess</code>
776 files. The <code>Require valid-user</code> directive will succeed for
777 any user who is valid <em>as far as LDAP is
778 concerned</em>. This means that anybody who has an entry in
779 the LDAP directory is considered a valid user, whereas FrontPage
780 considers only those people in the local user file to be
781 valid. By substituting the ldap-group with group file authorization,
782 Apache is allowed to consult the local user file (which is managed by
783 FrontPage) - instead of LDAP - when handling authorizing the user.</p>
785 <p>Once directives have been added as specified above,
786 FrontPage users will be able to perform all management
787 operations from the FrontPage client.</p>
790 <section id="fpcaveats"><title>Caveats</title>
793 <li>When choosing the LDAP URL, the attribute to use for
794 authentication should be something that will also be valid
795 for putting into a <module>mod_authn_file</module> user file.
796 The user ID is ideal for this.</li>
798 <li>When adding users via FrontPage, FrontPage administrators
799 should choose usernames that already exist in the LDAP
800 directory (for obvious reasons). Also, the password that the
801 administrator enters into the form is ignored, since Apache
802 will actually be authenticating against the password in the
803 LDAP database, and not against the password in the local user
804 file. This could cause confusion for web administrators.</li>
806 <!-- XXX is that true? was mod_auth before the aaa change -->
807 <li>Apache must be compiled with <module>mod_auth_basic</module>,
808 <module>mod_authn_file</module> and
809 <module>mod_authz_groupfile</module> in order to
810 use FrontPage support. This is because Apache will still use
811 the <module>mod_authz_groupfile</module> group file for determine
812 the extent of a user's access to the FrontPage web.</li>
814 <li>The directives must be put in the <code>.htaccess</code>
815 files. Attempting to put them inside <directive module="core"
816 type="section">Location</directive> or <directive module="core"
817 type="section">Directory</directive> directives won't work. This
818 is because <module>mod_authnz_ldap</module> has to be able to grab
819 the <directive module="mod_authz_groupfile">AuthGroupFile</directive>
820 directive that is found in FrontPage <code>.htaccess</code>
821 files so that it knows where to look for the valid user list. If
822 the <module>mod_authnz_ldap</module> directives aren't in the same
823 <code>.htaccess</code> file as the FrontPage directives, then
824 the hack won't work, because <module>mod_authnz_ldap</module> will
825 never get a chance to process the <code>.htaccess</code> file,
826 and won't be able to find the FrontPage-managed user file.</li>
832 <name>AuthLDAPAuthorizePrefix</name>
833 <description>Specifies the prefix for environment variables set during
834 authorization</description>
835 <syntax>AuthLDAPAuthorizePrefix <em>prefix</em></syntax>
836 <default>AuthLDAPAuthorizePrefix AUTHORIZE_</default>
837 <contextlist><context>directory</context><context>.htaccess</context>
839 <override>AuthConfig</override>
840 <compatibility>Available in version 2.3.6 and later</compatibility>
842 <p>This directive allows you to override the prefix used for environment
843 variables set during LDAP authorization. If <em>AUTHENTICATE_</em> is
844 specified, consumers of these environment variables see the same information
845 whether LDAP has performed authentication, authorization, or both.</p>
847 <note><title>Note</title>
848 No authorization variables are set when a user is authorized on the basis of
849 <code>Require valid-user</code>.
856 <name>AuthLDAPBindAuthoritative</name>
857 <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>
858 <syntax>AuthLDAPBindAuthoritative off|on</syntax>
859 <default>AuthLDAPBindAuthoritative on</default>
860 <contextlist><context>directory</context><context>.htaccess</context>
862 <override>AuthConfig</override>
864 <p>By default, subsequent authentication providers are only queried if a
865 user cannot be mapped to a DN, but not if the user can be mapped to a DN and their
866 password cannot be verified with an LDAP bind.
867 If <directive>AuthLDAPBindAuthoritative</directive>
868 is set to <em>off</em>, other configured authentication modules will have
869 a chance to validate the user if the LDAP bind (with the current user's credentials)
870 fails for any reason.</p>
871 <p> This allows users present in both LDAP and
872 <directive module="mod_authn_file">AuthUserFile</directive> to authenticate
873 when the LDAP server is available but the user's account is locked or password
874 is otherwise unusable.</p>
876 <seealso><directive module="mod_authn_file">AuthUserFile</directive></seealso>
877 <seealso><directive module="mod_auth_basic">AuthBasicProvider</directive></seealso>
881 <name>AuthLDAPInitialBindAsUser</name>
882 <description>Determines if the server does the initial DN lookup using the basic authentication users'
883 own username, instead of anonymously or with hard-coded credentials for the server</description>
884 <syntax>AuthLDAPInitialBindAsUser off|on</syntax>
885 <default>AuthLDAPInitialBindAsUser off</default>
886 <contextlist><context>directory</context><context>.htaccess</context>
888 <override>AuthConfig</override>
889 <compatibility>Available in version 2.3.6 and later</compatibility>
891 <p>By default, the server either anonymously, or with a dedicated user and
892 password, converts the basic authentication username into an LDAP
893 distinguished name (DN). This directive forces the server to use the verbatim username
894 and password provided by the incoming user to perform the initial DN
897 <p> If the verbatim username can't directly bind, but needs some
898 cosmetic transformation, see <directive module="mod_authnz_ldap">
899 AuthLDAPInitialBindPattern</directive>.</p>
901 <p> This directive should only be used when your LDAP server doesn't
902 accept anonymous searches and you cannot use a dedicated
903 <directive module="mod_authnz_ldap">AuthLDAPBindDN</directive>.
906 <note><title>Not available with authorization-only</title>
907 This directive can only be used if this module authenticates the user, and
908 has no effect when this module is used exclusively for authorization.
911 <seealso><directive module="mod_authnz_ldap">AuthLDAPInitialBindPattern</directive></seealso>
912 <seealso><directive module="mod_authnz_ldap">AuthLDAPBindDN</directive></seealso>
913 <seealso><directive module="mod_authnz_ldap">AuthLDAPCompareAsUser</directive></seealso>
914 <seealso><directive module="mod_authnz_ldap">AuthLDAPSearchAsUser</directive></seealso>
918 <name>AuthLDAPInitialBindPattern</name>
919 <description>Specifies the transformation of the basic authentication username to be used when binding to the LDAP server
920 to perform a DN lookup</description>
921 <syntax>AuthLDAPInitialBindPattern <em><var>regex</var> <var>substitution</var></em></syntax>
922 <default>AuthLDAPInitialBindPattern (.*) $1 (remote username used verbatim)</default>
923 <contextlist><context>directory</context><context>.htaccess</context>
925 <override>AuthConfig</override>
926 <compatibility>Available in version 2.3.6 and later</compatibility>
928 <p>If <directive module="mod_authnz_ldap">AuthLDAPInitialBindAsUser</directive> is set to
929 <em>ON</em>, the basic authentication username will be transformed according to the
930 regular expression and substitution arguments.</p>
932 <p> The regular expression argument is compared against the current basic authentication username.
933 The substitution argument may contain backreferences, but has no other variable interpolation.</p>
935 <p> This directive should only be used when your LDAP server doesn't
936 accept anonymous searches and you cannot use a dedicated
937 <directive module="mod_authnz_ldap">AuthLDAPBindDN</directive>.
940 <highlight language="config">
941 AuthLDAPInitialBindPattern (.+) $1@example.com
943 <highlight language="config">
944 AuthLDAPInitialBindPattern (.+) cn=$1,dc=example,dc=com
947 <note><title>Not available with authorization-only</title>
948 This directive can only be used if this module authenticates the user, and
949 has no effect when this module is used exclusively for authorization.
951 <note><title>debugging</title>
952 The substituted DN is recorded in the environment variable
953 <em>LDAP_BINDASUSER</em>. If the regular expression does not match the input,
954 the verbatim username is used.
957 <seealso><directive module="mod_authnz_ldap">AuthLDAPInitialBindAsUser</directive></seealso>
958 <seealso><directive module="mod_authnz_ldap">AuthLDAPBindDN</directive></seealso>
962 <name>AuthLDAPBindDN</name>
963 <description>Optional DN to use in binding to the LDAP server</description>
964 <syntax>AuthLDAPBindDN <em>distinguished-name</em></syntax>
965 <contextlist><context>directory</context><context>.htaccess</context>
967 <override>AuthConfig</override>
970 <p>An optional DN used to bind to the server when searching for
971 entries. If not provided, <module>mod_authnz_ldap</module> will use
972 an anonymous bind.</p>
977 <name>AuthLDAPBindPassword</name>
978 <description>Password used in conjunction with the bind DN</description>
979 <syntax>AuthLDAPBindPassword <em>password</em></syntax>
980 <contextlist><context>directory</context><context>.htaccess</context>
982 <override>AuthConfig</override>
983 <compatibility><em>exec:</em> was added in 2.4.5.</compatibility>
986 <p>A bind password to use in conjunction with the bind DN. Note
987 that the bind password is probably sensitive data, and should be
988 properly protected. You should only use the <directive
989 module="mod_authnz_ldap">AuthLDAPBindDN</directive> and <directive
990 >AuthLDAPBindPassword</directive> if you
991 absolutely need them to search the directory.</p>
993 <p>If the value begins with exec: the resulting command will be
994 executed and the first line returned to standard output by the
995 program will be used as the password.</p>
996 <highlight language="config">
998 AuthLDAPBindPassword secret
1000 #Run /path/to/program to get my password
1001 AuthLDAPBindPassword exec:/path/to/program
1003 #Run /path/to/otherProgram and provide arguments
1004 AuthLDAPBindPassword "exec:/path/to/otherProgram argument1"
1008 </directivesynopsis>
1011 <name>AuthLDAPCharsetConfig</name>
1012 <description>Language to charset conversion configuration file</description>
1013 <syntax>AuthLDAPCharsetConfig <em>file-path</em></syntax>
1014 <contextlist><context>server config</context>
1018 <p>The <directive>AuthLDAPCharsetConfig</directive> directive sets the location
1019 of the language to charset conversion configuration file. <var>File-path</var> is relative
1020 to the <directive module="core">ServerRoot</directive>. This file specifies
1021 the list of language extensions to character sets.
1022 Most administrators use the provided <code>charset.conv</code>
1023 file, which associates common language extensions to character sets.</p>
1025 <p>The file contains lines in the following format:</p>
1028 <var>Language-Extension</var> <var>charset</var> [<var>Language-String</var>] ...
1031 <p>The case of the extension does not matter. Blank lines, and lines
1032 beginning with a hash character (<code>#</code>) are ignored.</p>
1034 </directivesynopsis>
1037 <name>AuthLDAPCompareAsUser</name>
1038 <description>Use the authenticated user's credentials to perform authorization comparisons</description>
1039 <syntax>AuthLDAPCompareAsUser on|off</syntax>
1040 <default>AuthLDAPCompareAsUser off</default>
1041 <contextlist><context>directory</context><context>.htaccess</context>
1043 <override>AuthConfig</override>
1044 <compatibility>Available in version 2.3.6 and later</compatibility>
1047 <p>When set, and <module>mod_authnz_ldap</module> has authenticated the
1048 user, LDAP comparisons for authorization use the queried distinguished name (DN)
1049 and HTTP basic authentication password of the authenticated user instead of
1050 the servers configured credentials.</p>
1052 <p> The <em>ldap-attribute</em>, <em>ldap-user</em>, and <em>ldap-group</em> (single-level only)
1053 authorization checks use comparisons.</p>
1055 <p>This directive only has effect on the comparisons performed during
1056 nested group processing when <directive module="mod_authnz_ldap">
1057 AuthLDAPSearchAsUser</directive> is also enabled.</p>
1059 <p> This directive should only be used when your LDAP server doesn't
1060 accept anonymous comparisons and you cannot use a dedicated
1061 <directive module="mod_authnz_ldap">AuthLDAPBindDN</directive>.
1064 <seealso><directive module="mod_authnz_ldap">AuthLDAPInitialBindAsUser</directive></seealso>
1065 <seealso><directive module="mod_authnz_ldap">AuthLDAPSearchAsUser</directive></seealso>
1066 </directivesynopsis>
1069 <name>AuthLDAPCompareDNOnServer</name>
1070 <description>Use the LDAP server to compare the DNs</description>
1071 <syntax>AuthLDAPCompareDNOnServer on|off</syntax>
1072 <default>AuthLDAPCompareDNOnServer on</default>
1073 <contextlist><context>directory</context><context>.htaccess</context>
1075 <override>AuthConfig</override>
1078 <p>When set, <module>mod_authnz_ldap</module> will use the LDAP
1079 server to compare the DNs. This is the only foolproof way to
1080 compare DNs. <module>mod_authnz_ldap</module> will search the
1081 directory for the DN specified with the <a
1082 href="#reqdn"><code>Require dn</code></a> directive, then,
1083 retrieve the DN and compare it with the DN retrieved from the user
1084 entry. If this directive is not set,
1085 <module>mod_authnz_ldap</module> simply does a string comparison. It
1086 is possible to get false negatives with this approach, but it is
1087 much faster. Note the <module>mod_ldap</module> cache can speed up
1088 DN comparison in most situations.</p>
1090 </directivesynopsis>
1093 <name>AuthLDAPDereferenceAliases</name>
1094 <description>When will the module de-reference aliases</description>
1095 <syntax>AuthLDAPDereferenceAliases never|searching|finding|always</syntax>
1096 <default>AuthLDAPDereferenceAliases always</default>
1097 <contextlist><context>directory</context><context>.htaccess</context>
1099 <override>AuthConfig</override>
1102 <p>This directive specifies when <module>mod_authnz_ldap</module> will
1103 de-reference aliases during LDAP operations. The default is
1104 <code>always</code>.</p>
1106 </directivesynopsis>
1109 <name>AuthLDAPGroupAttribute</name>
1110 <description>LDAP attributes used to identify the user members of
1111 groups.</description>
1112 <syntax>AuthLDAPGroupAttribute <em>attribute</em></syntax>
1113 <default>AuthLDAPGroupAttribute member uniqueMember</default>
1114 <contextlist><context>directory</context><context>.htaccess</context>
1116 <override>AuthConfig</override>
1119 <p>This directive specifies which LDAP attributes are used to
1120 check for user members within groups. Multiple attributes can be used
1121 by specifying this directive multiple times. If not specified,
1122 then <module>mod_authnz_ldap</module> uses the <code>member</code> and
1123 <code>uniqueMember</code> attributes.</p>
1125 </directivesynopsis>
1128 <name>AuthLDAPGroupAttributeIsDN</name>
1129 <description>Use the DN of the client username when checking for
1130 group membership</description>
1131 <syntax>AuthLDAPGroupAttributeIsDN on|off</syntax>
1132 <default>AuthLDAPGroupAttributeIsDN on</default>
1133 <contextlist><context>directory</context><context>.htaccess</context>
1135 <override>AuthConfig</override>
1138 <p>When set <code>on</code>, this directive says to use the
1139 distinguished name of the client username when checking for group
1140 membership. Otherwise, the username will be used. For example,
1141 assume that the client sent the username <code>bjenson</code>,
1142 which corresponds to the LDAP DN <code>cn=Babs Jenson,
1143 o=Example</code>. If this directive is set,
1144 <module>mod_authnz_ldap</module> will check if the group has
1145 <code>cn=Babs Jenson, o=Example</code> as a member. If this
1146 directive is not set, then <module>mod_authnz_ldap</module> will
1147 check if the group has <code>bjenson</code> as a member.</p>
1149 </directivesynopsis>
1152 <name>AuthLDAPMaxSubGroupDepth</name>
1153 <description>Specifies the maximum sub-group nesting depth that will be
1154 evaluated before the user search is discontinued.</description>
1155 <syntax>AuthLDAPMaxSubGroupDepth <var>Number</var></syntax>
1156 <default>AuthLDAPMaxSubGroupDepth 0</default>
1157 <contextlist><context>directory</context><context>.htaccess</context>
1159 <override>AuthConfig</override>
1160 <compatibility>Available in version 2.3.0 and later, defaulted to 10 in 2.4.x and early 2.5</compatibility>
1163 <p>When this directive is set to a non-zero value <code>X</code>
1164 combined with use of the <code>Require ldap-group someGroupDN</code>
1165 directive, the provided user credentials will be searched for
1166 as a member of the <code>someGroupDN</code> directory object or of
1167 any group member of the current group up to the maximum nesting
1168 level <code>X</code> specified by this directive.</p>
1169 <p>See the <a href="#reqgroup"><code>Require ldap-group</code></a>
1170 section for a more detailed example.</p>
1172 <note><title>Nested groups performance</title>
1173 <p> When <directive>AuthLDAPSubGroupAttribute</directive> overlaps with
1174 <directive>AuthLDAPGroupAttribute</directive> (as it does by default and
1175 as required by common LDAP schemas), uncached searching for subgroups in
1176 large groups can be very slow. If you use large, non-nested groups, keep
1177 <directive>AuthLDAPMaxSubGroupDepth</directive> set to zero.</p>
1181 </directivesynopsis>
1184 <name>AuthLDAPRemoteUserAttribute</name>
1185 <description>Use the value of the attribute returned during the user
1186 query to set the REMOTE_USER environment variable</description>
1187 <syntax>AuthLDAPRemoteUserAttribute uid</syntax>
1188 <default>none</default>
1189 <contextlist><context>directory</context><context>.htaccess</context>
1191 <override>AuthConfig</override>
1194 <p>If this directive is set, the value of the
1195 <code>REMOTE_USER</code> environment variable will be set to the
1196 value of the attribute specified. Make sure that this attribute is
1197 included in the list of attributes in the <directive module="mod_authnz_ldap"
1198 >AuthLDAPURL</directive> definition,
1199 otherwise this directive will have no effect. This directive, if
1200 present, takes precedence over <directive module="mod_authnz_ldap"
1201 >AuthLDAPRemoteUserIsDN</directive>. This
1202 directive is useful should you want people to log into a website
1203 using an email address, but a backend application expects the
1204 username as a userid.</p>
1205 <p> This directive only has effect when this module is used for
1208 </directivesynopsis>
1211 <name>AuthLDAPRemoteUserIsDN</name>
1212 <description>Use the DN of the client username to set the REMOTE_USER
1213 environment variable</description>
1214 <syntax>AuthLDAPRemoteUserIsDN on|off</syntax>
1215 <default>AuthLDAPRemoteUserIsDN off</default>
1216 <contextlist><context>directory</context><context>.htaccess</context>
1218 <override>AuthConfig</override>
1221 <p>If this directive is set to on, the value of the
1222 <code>REMOTE_USER</code> environment variable will be set to the full
1223 distinguished name of the authenticated user, rather than just
1224 the username that was passed by the client. It is turned off by
1226 <p> This directive only has effect when this module is used for
1229 </directivesynopsis>
1232 <name>AuthLDAPSearchAsUser</name>
1233 <description>Use the authenticated user's credentials to perform authorization searches</description>
1234 <syntax>AuthLDAPSearchAsUser on|off</syntax>
1235 <default>AuthLDAPSearchAsUser off</default>
1236 <contextlist><context>directory</context><context>.htaccess</context>
1238 <override>AuthConfig</override>
1239 <compatibility>Available in version 2.3.6 and later</compatibility>
1242 <p>When set, and <module>mod_authnz_ldap</module> has authenticated the
1243 user, LDAP searches for authorization use the queried distinguished name (DN)
1244 and HTTP basic authentication password of the authenticated user instead of
1245 the servers configured credentials.</p>
1247 <p> The <em>ldap-filter</em> and <em>ldap-dn</em> authorization
1248 checks use searches.</p>
1250 <p>This directive only has effect on the comparisons performed during
1251 nested group processing when <directive module="mod_authnz_ldap">
1252 AuthLDAPCompareAsUser</directive> is also enabled.</p>
1254 <p> This directive should only be used when your LDAP server doesn't
1255 accept anonymous searches and you cannot use a dedicated
1256 <directive module="mod_authnz_ldap">AuthLDAPBindDN</directive>.
1259 <seealso><directive module="mod_authnz_ldap">AuthLDAPInitialBindAsUser</directive></seealso>
1260 <seealso><directive module="mod_authnz_ldap">AuthLDAPCompareAsUser</directive></seealso>
1261 </directivesynopsis>
1264 <name>AuthLDAPSubGroupAttribute</name>
1265 <description>Specifies the attribute labels, one value per
1266 directive line, used to distinguish the members of the current group that
1267 are groups.</description>
1268 <syntax>AuthLDAPSubGroupAttribute <em>attribute</em></syntax>
1269 <default>AuthLDAPSubGroupAttribute member uniqueMember</default>
1270 <contextlist><context>directory</context><context>.htaccess</context>
1272 <override>AuthConfig</override>
1273 <compatibility>Available in version 2.3.0 and later</compatibility>
1276 <p>An LDAP group object may contain members that are users and
1277 members that are groups (called nested or sub groups). The
1278 <directive>AuthLDAPSubGroupAttribute</directive> directive identifies the
1279 labels of group members and the <directive module="mod_authnz_ldap"
1280 >AuthLDAPGroupAttribute</directive>
1281 directive identifies the labels of the user members. Multiple
1282 attributes can be used by specifying this directive multiple times.
1283 If not specified, then <module>mod_authnz_ldap</module> uses the
1284 <code>member</code> and <code>uniqueMember</code> attributes.</p>
1286 </directivesynopsis>
1289 <name>AuthLDAPSubGroupClass</name>
1290 <description>Specifies which LDAP objectClass values identify directory
1291 objects that are groups during sub-group processing.</description>
1292 <syntax>AuthLDAPSubGroupClass <em>LdapObjectClass</em></syntax>
1293 <default>AuthLDAPSubGroupClass groupOfNames groupOfUniqueNames</default>
1294 <contextlist><context>directory</context><context>.htaccess</context>
1296 <override>AuthConfig</override>
1297 <compatibility>Available in version 2.3.0 and later</compatibility>
1300 <p>An LDAP group object may contain members that are users and
1301 members that are groups (called nested or sub groups). The
1302 <directive module="mod_authnz_ldap">AuthLDAPSubGroupAttribute</directive>
1303 directive identifies the
1304 labels of members that may be sub-groups of the current group
1305 (as opposed to user members). The <directive>AuthLDAPSubGroupClass</directive>
1306 directive specifies the LDAP objectClass values used in verifying that
1307 these potential sub-groups are in fact group objects. Verified sub-groups
1308 can then be searched for more user or sub-group members. Multiple
1309 attributes can be used by specifying this directive multiple times.
1310 If not specified, then <module>mod_authnz_ldap</module> uses the
1311 <code>groupOfNames</code> and <code>groupOfUniqueNames</code> values.</p>
1313 </directivesynopsis>
1316 <name>AuthLDAPURL</name>
1317 <description>URL specifying the LDAP search parameters</description>
1318 <syntax>AuthLDAPURL <em>url</em> [NONE|SSL|TLS|STARTTLS]</syntax>
1319 <contextlist><context>directory</context><context>.htaccess</context>
1321 <override>AuthConfig</override>
1324 <p>An RFC 2255 URL which specifies the LDAP search parameters
1325 to use. The syntax of the URL is</p>
1326 <example>ldap://host:port/basedn?attribute?scope?filter</example>
1327 <p>If you want to specify more than one LDAP URL that Apache should try in turn, the syntax is:</p>
1328 <highlight language="config">
1329 AuthLDAPURL "ldap://ldap1.example.com ldap2.example.com/dc=..."
1331 <p><em><strong>Caveat: </strong>If you specify multiple servers, you need to enclose the entire URL string in quotes;
1332 otherwise you will get an error: "AuthLDAPURL takes one argument, URL to define LDAP connection.." </em>
1333 You can of course use search parameters on each of these.</p>
1338 <dd>For regular ldap, use the
1339 string <code>ldap</code>. For secure LDAP, use <code>ldaps</code>
1340 instead. Secure LDAP is only available if Apache was linked
1341 to an LDAP library with SSL support.</dd>
1346 <p>The name/port of the ldap server (defaults to
1347 <code>localhost:389</code> for <code>ldap</code>, and
1348 <code>localhost:636</code> for <code>ldaps</code>). To
1349 specify multiple, redundant LDAP servers, just list all
1350 servers, separated by spaces. <module>mod_authnz_ldap</module>
1351 will try connecting to each server in turn, until it makes a
1352 successful connection. If multiple ldap servers are specified,
1353 then entire LDAP URL must be encapsulated in double quotes.</p>
1355 <p>Once a connection has been made to a server, that
1356 connection remains active for the life of the
1357 <program>httpd</program> process, or until the LDAP server goes
1360 <p>If the LDAP server goes down and breaks an existing
1361 connection, <module>mod_authnz_ldap</module> will attempt to
1362 re-connect, starting with the primary server, and trying
1363 each redundant server in turn. Note that this is different
1364 than a true round-robin search.</p>
1369 <dd>The DN of the branch of the
1370 directory where all searches should start from. At the very
1371 least, this must be the top of your directory tree, but
1372 could also specify a subtree in the directory.</dd>
1376 <dd>The attribute to search for.
1377 Although RFC 2255 allows a comma-separated list of
1378 attributes, only the first attribute will be used, no
1379 matter how many are provided. If no attributes are
1380 provided, the default is to use <code>uid</code>. It's a good
1381 idea to choose an attribute that will be unique across all
1382 entries in the subtree you will be using. All attributes
1383 listed will be put into the environment with an AUTHENTICATE_ prefix
1384 for use by other modules.</dd>
1388 <dd>The scope of the search. Can be either <code>one</code> or
1389 <code>sub</code>. Note that a scope of <code>base</code> is
1390 also supported by RFC 2255, but is not supported by this
1391 module. If the scope is not provided, or if <code>base</code> scope
1392 is specified, the default is to use a scope of
1393 <code>sub</code>.</dd>
1397 <dd>A valid LDAP search filter. If
1398 not provided, defaults to <code>(objectClass=*)</code>, which
1399 will search for all objects in the tree. Filters are
1400 limited to approximately 8000 characters (the definition of
1401 <code>MAX_STRING_LEN</code> in the Apache source code). This
1402 should be more than sufficient for any application. In 2.4.10 and later,
1403 the keyword <code>none</code> disables the use of a filter; this is
1404 required by some primitive LDAP servers.</dd>
1407 <p>When doing searches, the attribute, filter and username passed
1408 by the HTTP client are combined to create a search filter that
1410 <code>(&(<em>filter</em>)(<em>attribute</em>=<em>username</em>))</code>.</p>
1412 <p>For example, consider an URL of
1413 <code>ldap://ldap.example.com/o=Example?cn?sub?(posixid=*)</code>. When
1414 a client attempts to connect using a username of <code>Babs
1415 Jenson</code>, the resulting search filter will be
1416 <code>(&(posixid=*)(cn=Babs Jenson))</code>.</p>
1418 <p>An optional parameter can be added to allow the LDAP Url to override
1419 the connection type. This parameter can be one of the following:</p>
1423 <dd>Establish an unsecure connection on the default LDAP port. This
1424 is the same as <code>ldap://</code> on port 389.</dd>
1426 <dd>Establish a secure connection on the default secure LDAP port.
1427 This is the same as <code>ldaps://</code></dd>
1428 <dt>TLS | STARTTLS</dt>
1429 <dd>Establish an upgraded secure connection on the default LDAP port.
1430 This connection will be initiated on port 389 by default and then
1431 upgraded to a secure connection on the same port.</dd>
1434 <p>See above for examples of <directive
1435 module="mod_authnz_ldap">AuthLDAPURL</directive> URLs.</p>
1437 </directivesynopsis>