]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_authnz_ldap.xml
Add <compatibility> notes for changes made in version 2.4.8 + synch formating with...
[apache] / docs / manual / mod / mod_authnz_ldap.xml
1 <?xml version="1.0"?>
2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
5
6 <!--
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
13
14      http://www.apache.org/licenses/LICENSE-2.0
15
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.
21 -->
22
23 <modulesynopsis metafile="mod_authnz_ldap.xml.meta">
24
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>
31
32 <summary>
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>
36
37     <p><module>mod_authnz_ldap</module> supports the following features:</p>
38
39     <ul>
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>
46
47       <li>Complex authorization policies can be implemented by
48       representing the policy with LDAP filters.</li>
49
50       <li>Uses extensive caching of LDAP operations via <a
51       href="mod_ldap.html">mod_ldap</a>.</li>
52
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>
55     </ul>
56
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>
60 </summary>
61
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>
66
67 <section id="contents"><title>Contents</title>
68
69     <ul>
70       <li>
71         <a href="#operation">Operation</a>
72
73         <ul>
74           <li><a href="#authenphase">The Authentication
75           Phase</a></li>
76
77           <li><a href="#authorphase">The Authorization
78           Phase</a></li>
79         </ul>
80       </li>
81
82       <li>
83         <a href="#requiredirectives">The Require Directives</a>
84
85         <ul>
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         </ul>
92       </li>
93
94       <li><a href="#examples">Examples</a></li>
95       <li><a href="#usingtls">Using TLS</a></li>
96       <li><a href="#usingssl">Using SSL</a></li>
97       <li><a href="#exposed">Exposing Login Information</a></li>
98       <li><a href="#activedirectory">Using Active Directory</a></li>
99       <li>
100         <a href="#frontpage">Using Microsoft FrontPage with
101         <module>mod_authnz_ldap</module></a>
102
103         <ul>
104           <li><a href="#howitworks">How It Works</a></li>
105           <li><a href="#fpcaveats">Caveats</a></li>
106         </ul>
107       </li>
108     </ul>
109 </section>
110
111 <section id="operation"><title>Operation</title>
112
113     <p>There are two phases in granting access to a user. The first
114     phase is authentication, in which the <module>mod_authnz_ldap</module>
115     authentication provider verifies that the user's credentials are valid.
116     This is also called the <em>search/bind</em> phase. The second phase is
117     authorization, in which <module>mod_authnz_ldap</module> determines
118     if the authenticated user is allowed access to the resource in
119     question. This is also known as the <em>compare</em>
120     phase.</p>
121
122     <p><module>mod_authnz_ldap</module> registers both an authn_ldap authentication
123     provider and an authz_ldap authorization handler.  The authn_ldap
124     authentication provider can be enabled through the
125     <directive module="mod_auth_basic">AuthBasicProvider</directive> directive
126     using the <code>ldap</code> value. The authz_ldap handler extends the
127     <directive module="mod_authz_core">Require</directive> directive's authorization types
128     by adding <code>ldap-user</code>, <code>ldap-dn</code> and <code>ldap-group</code>
129     values.</p>
130
131 <section id="authenphase"><title>The Authentication
132     Phase</title>
133
134     <p>During the authentication phase, <module>mod_authnz_ldap</module>
135     searches for an entry in the directory that matches the username
136     that the HTTP client passes. If a single unique match is found,
137     then <module>mod_authnz_ldap</module> attempts to bind to the
138     directory server using the DN of the entry plus the password
139     provided by the HTTP client. Because it does a search, then a
140     bind, it is often referred to as the search/bind phase. Here are
141     the steps taken during the search/bind phase.</p>
142
143     <ol>
144       <li>Generate a search filter by combining the attribute and
145       filter provided in the <directive module="mod_authnz_ldap"
146       >AuthLDAPURL</directive> directive with
147       the username passed by the HTTP client.</li>
148
149       <li>Search the directory using the generated filter. If the
150       search does not return exactly one entry, deny or decline
151       access.</li>
152
153       <li>Fetch the distinguished name of the entry retrieved from
154       the search and attempt to bind to the LDAP server using that
155       DN and the password passed by the HTTP client. If the bind is
156       unsuccessful, deny or decline access.</li>
157     </ol>
158
159     <p>The following directives are used during the search/bind
160     phase</p>
161
162     <table>
163       <columnspec><column width=".3"/><column width=".7"/></columnspec>
164       <tr>
165         <td><directive module="mod_authnz_ldap">AuthLDAPURL</directive></td>
166
167         <td>Specifies the LDAP server, the
168         base DN, the attribute to use in the search, as well as the
169         extra search filter to use.</td>
170       </tr>
171
172       <tr>
173         <td><directive module="mod_authnz_ldap">AuthLDAPBindDN</directive></td>
174
175         <td>An optional DN to bind with
176         during the search phase.</td>
177       </tr>
178
179       <tr>
180         <td><directive
181         module="mod_authnz_ldap">AuthLDAPBindPassword</directive></td>
182
183         <td>An optional password to bind
184         with during the search phase.</td>
185       </tr>
186     </table>
187 </section>
188
189 <section id="authorphase"><title>The Authorization Phase</title>
190
191     <p>During the authorization phase, <module>mod_authnz_ldap</module>
192     attempts to determine if the user is authorized to access the
193     resource.  Many of these checks require
194     <module>mod_authnz_ldap</module> to do a compare operation on the
195     LDAP server. This is why this phase is often referred to as the
196     compare phase. <module>mod_authnz_ldap</module> accepts the
197     following <directive module="mod_authz_core">Require</directive>
198     directives to determine if the credentials are acceptable:</p>
199
200     <ul>
201       <li>Grant access if there is a <a
202       href="#reqgroup"><code>Require ldap-user</code></a> directive, and the
203       username in the directive matches the username passed by the
204       client.</li>
205
206       <li>Grant access if there is a <a href="#reqdn"><code>Require
207       ldap-dn</code></a> directive, and the DN in the directive matches
208       the DN fetched from the LDAP directory.</li>
209
210       <li>Grant access if there is a <a
211       href="#reqgroup"><code>Require ldap-group</code></a> directive, and
212       the DN fetched from the LDAP directory (or the username
213       passed by the client) occurs in the LDAP group or, potentially, in
214       one of its sub-groups.</li>
215
216       <li>Grant access if there is a <a href="#reqattribute">
217       <code>Require ldap-attribute</code></a>
218       directive, and the attribute fetched from the LDAP directory
219       matches the given value.</li>
220
221       <li>Grant access if there is a <a href="#reqfilter">
222       <code>Require ldap-filter</code></a>
223       directive, and the search filter successfully finds a single user
224       object that matches the dn of the authenticated user.</li>
225
226       <li>otherwise, deny or decline access</li>
227     </ul>
228
229     <p>Other <directive module="mod_authz_core">Require</directive> values may also
230     be used which may require loading additional authorization modules.</p>
231
232     <ul>
233         <li>Grant access to all successfully authenticated users if
234         there is a <a href="#requser"><code>Require valid-user</code></a>
235         directive. (requires <module>mod_authz_user</module>)</li>
236
237         <li>Grant access if there is a <a
238         href="#reqgroup"><code>Require group</code></a> directive, and
239         <module>mod_authz_groupfile</module> has been loaded with the
240         <directive module="mod_authz_groupfile">AuthGroupFile</directive>
241         directive set.</li>
242
243         <li>others...</li>
244      </ul>
245
246
247     <p><module>mod_authnz_ldap</module> uses the following directives during the
248     compare phase:</p>
249
250     <table>
251       <columnspec><column width=".4"/><column width=".6"/></columnspec>
252       <tr>
253         <td><directive module="mod_authnz_ldap">AuthLDAPURL</directive> </td>
254
255         <td>The attribute specified in the
256         URL is used in compare operations for the <code>Require
257         ldap-user</code> operation.</td>
258       </tr>
259
260       <tr>
261         <td><directive
262         module="mod_authnz_ldap">AuthLDAPCompareDNOnServer</directive></td>
263
264         <td>Determines the behavior of the
265         <code>Require ldap-dn</code> directive.</td>
266       </tr>
267
268       <tr>
269         <td><directive
270         module="mod_authnz_ldap">AuthLDAPGroupAttribute</directive></td>
271
272         <td>Determines the attribute to
273         use for comparisons in the <code>Require ldap-group</code>
274         directive.</td>
275       </tr>
276
277       <tr>
278         <td><directive
279         module="mod_authnz_ldap">AuthLDAPGroupAttributeIsDN</directive></td>
280
281         <td>Specifies whether to use the
282         user DN or the username when doing comparisons for the
283         <code>Require ldap-group</code> directive.</td>
284       </tr>
285
286       <tr>
287         <td><directive
288         module="mod_authnz_ldap">AuthLDAPMaxSubGroupDepth</directive></td>
289
290         <td>Determines the maximum depth of sub-groups that will be evaluated
291         during comparisons in the <code>Require ldap-group</code> directive.</td>
292       </tr>
293
294       <tr>
295         <td><directive
296         module="mod_authnz_ldap">AuthLDAPSubGroupAttribute</directive></td>
297
298         <td>Determines the attribute to use when obtaining sub-group members
299         of the current group during comparisons in the <code>Require ldap-group</code>
300         directive.</td>
301       </tr>
302
303       <tr>
304         <td><directive
305         module="mod_authnz_ldap">AuthLDAPSubGroupClass</directive></td>
306
307         <td>Specifies the LDAP objectClass values used to identify if queried directory
308         objects really are group objects (as opposed to user objects) during the
309         <code>Require ldap-group</code> directive's sub-group processing.</td>
310       </tr>
311     </table>
312 </section>
313 </section>
314
315 <section id="requiredirectives"><title>The Require Directives</title>
316
317     <p>Apache's <directive module="mod_authz_core">Require</directive>
318     directives are used during the authorization phase to ensure that
319     a user is allowed to access a resource.  mod_authnz_ldap extends the
320     authorization types with <code>ldap-user</code>, <code>ldap-dn</code>,
321     <code>ldap-group</code>, <code>ldap-attribute</code> and
322     <code>ldap-filter</code>.  Other authorization types may also be
323     used but may require that additional authorization modules be loaded.</p>
324
325     <p>Since v2.4.8, <a href="../expr.html">expressions</a> are supported
326     within the LDAP require directives.</p>
327
328 <section id="requser"><title>Require ldap-user</title>
329
330     <p>The <code>Require ldap-user</code> directive specifies what
331     usernames can access the resource. Once
332     <module>mod_authnz_ldap</module> has retrieved a unique DN from the
333     directory, it does an LDAP compare operation using the username
334     specified in the <code>Require ldap-user</code> to see if that username
335     is part of the just-fetched LDAP entry.  Multiple users can be
336     granted access by putting multiple usernames on the line,
337     separated with spaces. If a username has a space in it, then it
338     must be surrounded with double quotes. Multiple users can also be
339     granted access by using multiple <code>Require ldap-user</code>
340     directives, with one user per line. For example, with a <directive
341     module="mod_authnz_ldap">AuthLDAPURL</directive> of
342     <code>ldap://ldap/o=Example?cn</code> (i.e., <code>cn</code> is
343     used for searches), the following Require directives could be used
344     to restrict access:</p>
345 <highlight language="config">
346 Require ldap-user "Barbara Jenson"
347 Require ldap-user "Fred User"
348 Require ldap-user "Joe Manager"
349 </highlight>
350
351     <p>Because of the way that <module>mod_authnz_ldap</module> handles this
352     directive, Barbara Jenson could sign on as <em>Barbara
353     Jenson</em>, <em>Babs Jenson</em> or any other <code>cn</code> that
354     she has in her LDAP entry. Only the single <code>Require
355     ldap-user</code> line is needed to support all values of the attribute
356     in the user's entry.</p>
357
358     <p>If the <code>uid</code> attribute was used instead of the
359     <code>cn</code> attribute in the URL above, the above three lines
360     could be condensed to</p>
361 <highlight language="config">Require ldap-user bjenson fuser jmanager</highlight>
362 </section>
363
364 <section id="reqgroup"><title>Require ldap-group</title>
365
366     <p>This directive specifies an LDAP group whose members are
367     allowed access. It takes the distinguished name of the LDAP
368     group. Note: Do not surround the group name with quotes.
369     For example, assume that the following entry existed in
370     the LDAP directory:</p>
371 <example><pre>
372 dn: cn=Administrators, o=Example
373 objectClass: groupOfUniqueNames
374 uniqueMember: cn=Barbara Jenson, o=Example
375 uniqueMember: cn=Fred User, o=Example
376 </pre></example>
377
378     <p>The following directive would grant access to both Fred and
379     Barbara:</p>
380 <highlight language="config">Require ldap-group cn=Administrators, o=Example</highlight>
381
382     <p>Members can also be found within sub-groups of a specified LDAP group
383     if <directive module="mod_authnz_ldap">AuthLDAPMaxSubGroupDepth</directive>
384     is set to a value greater than 0. For example, assume the following entries
385     exist in the LDAP directory:</p>
386 <example><pre>
387 dn: cn=Employees, o=Example
388 objectClass: groupOfUniqueNames
389 uniqueMember: cn=Managers, o=Example
390 uniqueMember: cn=Administrators, o=Example
391 uniqueMember: cn=Users, o=Example
392
393 dn: cn=Managers, o=Example
394 objectClass: groupOfUniqueNames
395 uniqueMember: cn=Bob Ellis, o=Example
396 uniqueMember: cn=Tom Jackson, o=Example
397
398 dn: cn=Administrators, o=Example
399 objectClass: groupOfUniqueNames
400 uniqueMember: cn=Barbara Jenson, o=Example
401 uniqueMember: cn=Fred User, o=Example
402
403 dn: cn=Users, o=Example
404 objectClass: groupOfUniqueNames
405 uniqueMember: cn=Allan Jefferson, o=Example
406 uniqueMember: cn=Paul Tilley, o=Example
407 uniqueMember: cn=Temporary Employees, o=Example
408
409 dn: cn=Temporary Employees, o=Example
410 objectClass: groupOfUniqueNames
411 uniqueMember: cn=Jim Swenson, o=Example
412 uniqueMember: cn=Elliot Rhodes, o=Example
413 </pre></example>
414
415     <p>The following directives would allow access for Bob Ellis, Tom Jackson,
416     Barbara Jensen, Fred User, Allan Jefferson, and Paul Tilley but would not
417     allow access for Jim Swenson, or Elliot Rhodes (since they are at a
418     sub-group depth of 2):</p>
419 <highlight language="config">
420 Require ldap-group cn=Employees, o-Example
421 AuthLDAPMaxSubGroupDepth 1
422 </highlight>
423
424     <p>Behavior of this directive is modified by the <directive
425     module="mod_authnz_ldap">AuthLDAPGroupAttribute</directive>, <directive
426     module="mod_authnz_ldap">AuthLDAPGroupAttributeIsDN</directive>, <directive
427     module="mod_authnz_ldap">AuthLDAPMaxSubGroupDepth</directive>, <directive
428     module="mod_authnz_ldap">AuthLDAPSubGroupAttribute</directive>, and <directive
429     module="mod_authnz_ldap">AuthLDAPSubGroupClass</directive>
430     directives.</p>
431 </section>
432
433 <section id="reqdn"><title>Require ldap-dn</title>
434
435     <p>The <code>Require ldap-dn</code> directive allows the administrator
436     to grant access based on distinguished names. It specifies a DN
437     that must match for access to be granted. If the distinguished
438     name that was retrieved from the directory server matches the
439     distinguished name in the <code>Require ldap-dn</code>, then
440     authorization is granted. Note: do not surround the distinguished
441     name with quotes.</p>
442
443     <p>The following directive would grant access to a specific
444     DN:</p>
445 <highlight language="config">Require ldap-dn cn=Barbara Jenson, o=Example</highlight>
446
447     <p>Behavior of this directive is modified by the <directive
448     module="mod_authnz_ldap">AuthLDAPCompareDNOnServer</directive>
449     directive.</p>
450 </section>
451
452 <section id="reqattribute"><title>Require ldap-attribute</title>
453
454     <p>The <code>Require ldap-attribute</code> directive allows the
455     administrator to grant access based on attributes of the authenticated
456     user in the LDAP directory.  If the attribute in the directory
457     matches the value given in the configuration, access is granted.</p>
458
459     <p>The following directive would grant access to anyone with
460     the attribute employeeType = active</p>
461
462     <highlight language="config">Require ldap-attribute employeeType=active</highlight>
463
464     <p>Multiple attribute/value pairs can be specified on the same line
465     separated by spaces or they can be specified in multiple
466     <code>Require ldap-attribute</code> directives. The effect of listing
467     multiple attribute/values pairs is an OR operation. Access will be
468     granted if any of the listed attribute values match the value of the
469     corresponding attribute in the user object. If the value of the
470     attribute contains a space, only the value must be within double quotes.</p>
471
472     <p>The following directive would grant access to anyone with
473     the city attribute equal to "San Jose" or status equal to "Active"</p>
474
475     <highlight language="config">Require ldap-attribute city="San Jose" status=active</highlight>
476
477 </section>
478
479 <section id="reqfilter"><title>Require ldap-filter</title>
480
481     <p>The <code>Require ldap-filter</code> directive allows the
482     administrator to grant access based on a complex LDAP search filter.
483     If the dn returned by the filter search matches the authenticated user
484     dn, access is granted.</p>
485
486     <p>The following directive would grant access to anyone having a cell phone
487     and is in the marketing department</p>
488
489     <highlight language="config">Require ldap-filter &amp;(cell=*)(department=marketing)</highlight>
490
491     <p>The difference between the <code>Require ldap-filter</code> directive and the
492     <code>Require ldap-attribute</code> directive is that <code>ldap-filter</code>
493     performs a search operation on the LDAP directory using the specified search
494     filter rather than a simple attribute comparison. If a simple attribute
495     comparison is all that is required, the comparison operation performed by
496     <code>ldap-attribute</code> will be faster than the search operation
497     used by <code>ldap-filter</code> especially within a large directory.</p>
498
499 </section>
500
501 </section>
502
503 <section id="examples"><title>Examples</title>
504
505     <ul>
506       <li>
507         Grant access to anyone who exists in the LDAP directory,
508         using their UID for searches.
509 <highlight language="config">
510 AuthLDAPURL "ldap://ldap1.example.com:389/ou=People, o=Example?uid?sub?(objectClass=*)"
511 Require valid-user
512 </highlight>
513       </li>
514
515       <li>
516         The next example is the same as above; but with the fields
517         that have useful defaults omitted. Also, note the use of a
518         redundant LDAP server.
519 <highlight language="config">AuthLDAPURL "ldap://ldap1.example.com ldap2.example.com/ou=People, o=Example"
520 Require valid-user
521 </highlight>
522       </li>
523
524       <li>
525         The next example is similar to the previous one, but it
526         uses the common name instead of the UID. Note that this
527         could be problematical if multiple people in the directory
528         share the same <code>cn</code>, because a search on <code>cn</code>
529         <strong>must</strong> return exactly one entry. That's why
530         this approach is not recommended: it's a better idea to
531         choose an attribute that is guaranteed unique in your
532         directory, such as <code>uid</code>.
533 <highlight language="config">
534 AuthLDAPURL "ldap://ldap.example.com/ou=People, o=Example?cn"
535 Require valid-user
536 </highlight>
537       </li>
538
539       <li>
540         Grant access to anybody in the Administrators group. The
541         users must authenticate using their UID.
542 <highlight language="config">
543 AuthLDAPURL ldap://ldap.example.com/o=Example?uid
544 Require ldap-group cn=Administrators, o=Example
545 </highlight>
546       </li>
547
548       <li>
549         Grant access to anybody in the group whose name matches the
550         hostname of the virtual host. In this example an
551         <a href="../expr.html">expression</a> is used to build the filter.
552 <highlight language="config">
553 AuthLDAPURL ldap://ldap.example.com/o=Example?uid
554 Require ldap-group cn=%{SERVER_NAME}, o=Example
555 </highlight>
556       </li>
557
558       <li>
559         The next example assumes that everyone at Example who
560         carries an alphanumeric pager will have an LDAP attribute
561         of <code>qpagePagerID</code>. The example will grant access
562         only to people (authenticated via their UID) who have
563         alphanumeric pagers:
564 <highlight language="config">
565 AuthLDAPURL ldap://ldap.example.com/o=Example?uid??(qpagePagerID=*)
566 Require valid-user
567 </highlight>
568       </li>
569
570       <li>
571         <p>The next example demonstrates the power of using filters
572         to accomplish complicated administrative requirements.
573         Without filters, it would have been necessary to create a
574         new LDAP group and ensure that the group's members remain
575         synchronized with the pager users. This becomes trivial
576         with filters. The goal is to grant access to anyone who has
577         a pager, plus grant access to Joe Manager, who doesn't
578         have a pager, but does need to access the same
579         resource:</p>
580 <highlight language="config">
581 AuthLDAPURL ldap://ldap.example.com/o=Example?uid??(|(qpagePagerID=*)(uid=jmanager))
582 Require valid-user
583 </highlight>
584
585         <p>This last may look confusing at first, so it helps to
586         evaluate what the search filter will look like based on who
587         connects, as shown below.  If
588         Fred User connects as <code>fuser</code>, the filter would look
589         like</p>
590
591         <example>(&amp;(|(qpagePagerID=*)(uid=jmanager))(uid=fuser))</example>
592
593         <p>The above search will only succeed if <em>fuser</em> has a
594         pager. When Joe Manager connects as <em>jmanager</em>, the
595         filter looks like</p>
596
597         <example>(&amp;(|(qpagePagerID=*)(uid=jmanager))(uid=jmanager))</example>
598
599         <p>The above search will succeed whether <em>jmanager</em>
600         has a pager or not.</p>
601       </li>
602     </ul>
603 </section>
604
605 <section id="usingtls"><title>Using TLS</title>
606
607     <p>To use TLS, see the <module>mod_ldap</module> directives <directive
608     module="mod_ldap">LDAPTrustedClientCert</directive>, <directive
609     module="mod_ldap">LDAPTrustedGlobalCert</directive> and <directive
610     module="mod_ldap">LDAPTrustedMode</directive>.</p>
611
612     <p>An optional second parameter can be added to the
613     <directive module="mod_authnz_ldap">AuthLDAPURL</directive> to override
614     the default connection type set by <directive module="mod_ldap">LDAPTrustedMode</directive>.
615     This will allow the connection established by an <em>ldap://</em> Url
616     to be upgraded to a secure connection on the same port.</p>
617 </section>
618
619 <section id="usingssl"><title>Using SSL</title>
620
621     <p>To use SSL, see the <module>mod_ldap</module> directives <directive
622     module="mod_ldap">LDAPTrustedClientCert</directive>, <directive
623     module="mod_ldap">LDAPTrustedGlobalCert</directive> and <directive
624     module="mod_ldap">LDAPTrustedMode</directive>.</p>
625
626     <p>To specify a secure LDAP server, use <em>ldaps://</em> in the
627     <directive module="mod_authnz_ldap">AuthLDAPURL</directive>
628     directive, instead of <em>ldap://</em>.</p>
629 </section>
630
631 <section id="exposed"><title>Exposing Login Information</title>
632
633     <p>when this module performs <em>authentication</em>, ldap attributes specified
634     in the <directive module="mod_authnz_ldap">authldapurl</directive>
635     directive are placed in environment variables with the prefix "AUTHENTICATE_".</p>
636
637     <p>when this module performs <em>authorization</em>, ldap attributes specified
638     in the <directive module="mod_authnz_ldap">authldapurl</directive>
639     directive are placed in environment variables with the prefix "AUTHORIZE_".</p>
640
641     <p>If the attribute field contains the username, common name
642     and telephone number of a user, a CGI program will have access to
643     this information without the need to make a second independent LDAP
644     query to gather this additional information.</p>
645
646     <p>This has the potential to dramatically simplify the coding and
647     configuration required in some web applications.</p>
648
649 </section>
650
651 <section id="activedirectory"><title>Using Active Directory</title>
652
653     <p>An Active Directory installation may support multiple domains at the
654     same time. To distinguish users between domains, an identifier called
655     a User Principle Name (UPN) can be added to a user's entry in the
656     directory. This UPN usually takes the form of the user's account
657     name, followed by the domain components of the particular domain,
658     for example <em>somebody@nz.example.com</em>.</p>
659
660     <p>You may wish to configure the <module>mod_authnz_ldap</module>
661     module to authenticate users present in any of the domains making up
662     the Active Directory forest. In this way both
663     <em>somebody@nz.example.com</em> and <em>someone@au.example.com</em>
664     can be authenticated using the same query at the same time.</p>
665
666     <p>To make this practical, Active Directory supports the concept of
667     a Global Catalog. This Global Catalog is a read only copy of selected
668     attributes of all the Active Directory servers within the Active
669     Directory forest. Querying the Global Catalog allows all the domains
670     to be queried in a single query, without the query spanning servers
671     over potentially slow links.</p>
672
673     <p>If enabled, the Global Catalog is an independent directory server
674     that runs on port 3268 (3269 for SSL). To search for a user, do a
675     subtree search for the attribute <em>userPrincipalName</em>, with
676     an empty search root, like so:</p>
677
678 <highlight language="config">
679 AuthLDAPBindDN apache@example.com
680 AuthLDAPBindPassword password
681 AuthLDAPURL ldap://10.0.0.1:3268/?userPrincipalName?sub
682 </highlight>
683
684     <p>Users will need to enter their User Principal Name as a login, in
685     the form <em>somebody@nz.example.com</em>.</p>
686
687 </section>
688
689 <section id="frontpage"><title>Using Microsoft
690     FrontPage with mod_authnz_ldap</title>
691
692     <p>Normally, FrontPage uses FrontPage-web-specific user/group
693     files (i.e., the <module>mod_authn_file</module> and
694     <module>mod_authz_groupfile</module> modules) to handle all
695     authentication. Unfortunately, it is not possible to just
696     change to LDAP authentication by adding the proper directives,
697     because it will break the <em>Permissions</em> forms in
698     the FrontPage client, which attempt to modify the standard
699     text-based authorization files.</p>
700
701     <p>Once a FrontPage web has been created, adding LDAP
702     authentication to it is a matter of adding the following
703     directives to <em>every</em> <code>.htaccess</code> file
704     that gets created in the web</p>
705 <highlight language="config">
706 AuthLDAPURL       "the url"
707 AuthGroupFile     mygroupfile
708 Require group     mygroupfile
709 </highlight>
710
711 <section id="howitworks"><title>How It Works</title>
712
713     <p>FrontPage restricts access to a web by adding the <code>Require
714     valid-user</code> directive to the <code>.htaccess</code>
715     files. The <code>Require valid-user</code> directive will succeed for
716     any user who is valid <em>as far as LDAP is
717     concerned</em>. This means that anybody who has an entry in
718     the LDAP directory is considered a valid user, whereas FrontPage
719     considers only those people in the local user file to be
720     valid. By substituting the ldap-group with group file authorization,
721     Apache is allowed to consult the local user file (which is managed by
722     FrontPage) - instead of LDAP - when handling authorizing the user.</p>
723
724     <p>Once directives have been added as specified above,
725     FrontPage users will be able to perform all management
726     operations from the FrontPage client.</p>
727 </section>
728
729 <section id="fpcaveats"><title>Caveats</title>
730
731     <ul>
732       <li>When choosing the LDAP URL, the attribute to use for
733       authentication should be something that will also be valid
734       for putting into a <module>mod_authn_file</module> user file.
735       The user ID is ideal for this.</li>
736
737       <li>When adding users via FrontPage, FrontPage administrators
738       should choose usernames that already exist in the LDAP
739       directory (for obvious reasons). Also, the password that the
740       administrator enters into the form is ignored, since Apache
741       will actually be authenticating against the password in the
742       LDAP database, and not against the password in the local user
743       file. This could cause confusion for web administrators.</li>
744
745       <!-- XXX is that true? was mod_auth before the aaa change -->
746       <li>Apache must be compiled with <module>mod_auth_basic</module>,
747       <module>mod_authn_file</module> and
748       <module>mod_authz_groupfile</module> in order to
749       use FrontPage support. This is because Apache will still use
750       the <module>mod_authz_groupfile</module> group file for determine
751       the extent of a user's access to the FrontPage web.</li>
752
753       <li>The directives must be put in the <code>.htaccess</code>
754       files. Attempting to put them inside <directive module="core"
755       type="section">Location</directive> or <directive module="core"
756       type="section">Directory</directive> directives won't work. This
757       is because <module>mod_authnz_ldap</module> has to be able to grab
758       the <directive module="mod_authz_groupfile">AuthGroupFile</directive>
759       directive that is found in FrontPage <code>.htaccess</code>
760       files so that it knows where to look for the valid user list. If
761       the <module>mod_authnz_ldap</module> directives aren't in the same
762       <code>.htaccess</code> file as the FrontPage directives, then
763       the hack won't work, because <module>mod_authnz_ldap</module> will
764       never get a chance to process the <code>.htaccess</code> file,
765       and won't be able to find the FrontPage-managed user file.</li>
766     </ul>
767 </section>
768 </section>
769
770 <directivesynopsis>
771 <name>AuthLDAPAuthorizePrefix</name>
772 <description>Specifies the prefix for environment variables set during
773 authorization</description>
774 <syntax>AuthLDAPAuthorizePrefix <em>prefix</em></syntax>
775 <default>AuthLDAPAuthorizePrefix AUTHORIZE_</default>
776 <contextlist><context>directory</context><context>.htaccess</context>
777 </contextlist>
778 <override>AuthConfig</override>
779 <compatibility>Available in version 2.3.6 and later</compatibility>
780 <usage>
781     <p>This directive allows you to override the prefix used for environment
782     variables set during LDAP authorization.  If <em>AUTHENTICATE_</em> is
783     specified, consumers of these environment variables see the same information
784     whether LDAP has performed authentication, authorization, or both.</p>
785
786     <note><title>Note</title>
787     No authorization variables are set when a user is authorized on the basis of
788     <code>Require valid-user</code>.
789     </note>
790 </usage>
791 </directivesynopsis>
792
793
794 <directivesynopsis>
795 <name>AuthLDAPBindAuthoritative</name>
796 <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>
797 <syntax>AuthLDAPBindAuthoritative<em>off|on</em></syntax>
798 <default>AuthLDAPBindAuthoritative on</default>
799 <contextlist><context>directory</context><context>.htaccess</context>
800 </contextlist>
801 <override>AuthConfig</override>
802 <usage>
803     <p>By default, subsequent authentication providers are only queried if a
804     user cannot be mapped to a DN, but not if the user can be mapped to a DN and their
805     password cannot be verified with an LDAP bind.
806     If <directive module="mod_authnz_ldap">AuthLDAPBindAuthoritative</directive>
807     is set to <em>off</em>, other configured authentication modules will have
808     a chance to validate the user if the LDAP bind (with the current user's credentials)
809     fails for any reason.</p>
810     <p> This allows users present in both LDAP and
811     <directive module="mod_authn_file">AuthUserFile</directive> to authenticate
812     when the LDAP server is available but the user's account is locked or password
813     is otherwise unusable.</p>
814 </usage>
815 <seealso><directive module="mod_authn_file">AuthUserFile</directive></seealso>
816 <seealso><directive module="mod_auth_basic">AuthBasicProvider</directive></seealso>
817 </directivesynopsis>
818
819 <directivesynopsis>
820 <name>AuthLDAPInitialBindAsUser</name>
821 <description>Determines if the server does the initial DN lookup using the basic authentication users'
822 own username, instead of anonymously or with hard-coded credentials for the server</description>
823 <syntax>AuthLDAPInitialBindAsUser <em>off|on</em></syntax>
824 <default>AuthLDAPInitialBindAsUser off</default>
825 <contextlist><context>directory</context><context>.htaccess</context>
826 </contextlist>
827 <override>AuthConfig</override>
828 <compatibility>Available in version 2.3.6 and later</compatibility>
829 <usage>
830     <p>By default, the server either anonymously, or with a dedicated user and
831      password, converts the basic authentication username into an LDAP
832      distinguished name (DN).  This directive forces the server to use the verbatim username
833      and password provided by the incoming user to perform the initial DN
834      search.</p>
835
836      <p> If the verbatim username can't directly bind, but needs some
837      cosmetic transformation, see <directive module="mod_authnz_ldap">
838      AuthLDAPInitialBindPattern</directive>.</p>
839
840      <p> This directive should only be used when your LDAP server doesn't
841          accept anonymous searches and you cannot use a dedicated
842          <directive module="mod_authnz_ldap">AuthLDAPBindDN</directive>.
843      </p>
844
845      <note><title>Not available with authorization-only</title>
846          This directive can only be used if this module authenticates the user, and
847          has no effect when this module is used exclusively for authorization.
848      </note>
849 </usage>
850 <seealso><directive module="mod_authnz_ldap">AuthLDAPInitialBindPattern</directive></seealso>
851 <seealso><directive module="mod_authnz_ldap">AuthLDAPBindDN</directive></seealso>
852 <seealso><directive module="mod_authnz_ldap">AuthLDAPCompareAsUser</directive></seealso>
853 <seealso><directive module="mod_authnz_ldap">AuthLDAPSearchAsUser</directive></seealso>
854 </directivesynopsis>
855
856 <directivesynopsis>
857 <name>AuthLDAPInitialBindPattern</name>
858 <description>Specifies the transformation of the basic authentication username to be used when binding to the LDAP server
859 to perform a DN lookup</description>
860 <syntax>AuthLDAPInitialBindPattern<em><var>regex</var> <var>substitution</var></em></syntax>
861 <default>AuthLDAPInitialBindPattern (.*) $1 (remote username used verbatim)</default>
862 <contextlist><context>directory</context><context>.htaccess</context>
863 </contextlist>
864 <override>AuthConfig</override>
865 <compatibility>Available in version 2.3.6 and later</compatibility>
866 <usage>
867     <p>If <directive module="mod_authnz_ldap">AuthLDAPInitialBindAsUser</directive> is set to
868        <em>ON</em>, the basic authentication username will be transformed according to the
869        regular expression and substituion arguments.</p>
870
871     <p> The regular expression argument is compared against the current basic authentication username.
872         The substitution argument may contain backreferences, but has no other variable interpolation.</p>
873
874     <p> This directive should only be used when your LDAP server doesn't
875         accept anonymous searches and you cannot use a dedicated
876         <directive module="mod_authnz_ldap">AuthLDAPBindDN</directive>.
877     </p>
878
879     <highlight language="config"> AuthLDAPInitialBindPattern (.+) $1@example.com </highlight>
880     <highlight language="config"> AuthLDAPInitialBindPattern (.+) cn=$1,dc=example,dc=com</highlight>
881
882     <note><title>Not available with authorization-only</title>
883         This directive can only be used if this module authenticates the user, and
884         has no effect when this module is used exclusively for authorization.
885     </note>
886     <note><title>debugging</title>
887         The substituted DN is recorded in the environment variable
888         <em>LDAP_BINDASUSER</em>.  If the regular expression does not match the input,
889         the verbatim username is used.
890     </note>
891 </usage>
892 <seealso><directive module="mod_authnz_ldap">AuthLDAPInitialBindAsUser</directive></seealso>
893 <seealso><directive module="mod_authnz_ldap">AuthLDAPBindDN</directive></seealso>
894 </directivesynopsis>
895
896 <directivesynopsis>
897 <name>AuthLDAPBindDN</name>
898 <description>Optional DN to use in binding to the LDAP server</description>
899 <syntax>AuthLDAPBindDN <em>distinguished-name</em></syntax>
900 <contextlist><context>directory</context><context>.htaccess</context>
901 </contextlist>
902 <override>AuthConfig</override>
903
904 <usage>
905     <p>An optional DN used to bind to the server when searching for
906     entries. If not provided, <module>mod_authnz_ldap</module> will use
907     an anonymous bind.</p>
908 </usage>
909 </directivesynopsis>
910
911 <directivesynopsis>
912 <name>AuthLDAPBindPassword</name>
913 <description>Password used in conjuction with the bind DN</description>
914 <syntax>AuthLDAPBindPassword <em>password</em></syntax>
915 <contextlist><context>directory</context><context>.htaccess</context>
916 </contextlist>
917 <override>AuthConfig</override>
918 <compatibility><em>exec:</em> was added in 2.4.6.</compatibility>
919
920 <usage>
921     <p>A bind password to use in conjunction with the bind DN. Note
922     that the bind password is probably sensitive data, and should be
923     properly protected. You should only use the <directive
924     module="mod_authnz_ldap">AuthLDAPBindDN</directive> and <directive
925     module="mod_authnz_ldap">AuthLDAPBindPassword</directive> if you
926     absolutely need them to search the directory.</p>
927
928     <p>If the value begins with exec: the resulting command will be
929     executed and the first line returned to standard output by the
930     program will be used as the password.</p>
931 <example><pre>
932 #Password used as-is
933 AuthLDAPBindPassword secret
934
935 #Run /path/to/program to get my password
936 AuthLDAPBindPassword exec:/path/to/program
937
938 #Run /path/to/otherProgram and provide arguments
939 AuthLDAPBindPassword "exec:/path/to/otherProgram argument1"
940 </pre></example>
941
942 </usage>
943 </directivesynopsis>
944
945 <directivesynopsis>
946 <name>AuthLDAPCharsetConfig</name>
947 <description>Language to charset conversion configuration file</description>
948 <syntax>AuthLDAPCharsetConfig <em>file-path</em></syntax>
949 <contextlist><context>server config</context>
950 </contextlist>
951
952 <usage>
953     <p>The <directive>AuthLDAPCharsetConfig</directive> directive sets the location
954     of the language to charset conversion configuration file. <var>File-path</var> is relative
955     to the <directive module="core">ServerRoot</directive>. This file specifies
956     the list of language extensions to character sets.
957     Most administrators use the provided <code>charset.conv</code>
958     file, which associates common language extensions to character sets.</p>
959
960     <p>The file contains lines in the following format:</p>
961
962     <example>
963       <var>Language-Extension</var> <var>charset</var> [<var>Language-String</var>] ...
964     </example>
965
966     <p>The case of the extension does not matter. Blank lines, and lines
967     beginning with a hash character (<code>#</code>) are ignored.</p>
968 </usage>
969 </directivesynopsis>
970
971 <directivesynopsis>
972 <name>AuthLDAPCompareAsUser</name>
973 <description>Use the authenticated user's credentials to perform authorization comparisons</description>
974 <syntax>AuthLDAPCompareAsUser on|off</syntax>
975 <default>AuthLDAPCompareAsUser off</default>
976 <contextlist><context>directory</context><context>.htaccess</context>
977 </contextlist>
978 <override>AuthConfig</override>
979 <compatibility>Available in version 2.3.6 and later</compatibility>
980
981 <usage>
982     <p>When set, and <module>mod_authnz_ldap</module> has authenticated the
983     user, LDAP comparisons for authorization use the queried distinguished name (DN)
984     and HTTP basic authentication password of the authenticated user instead of
985     the servers configured credentials.</p>
986
987     <p> The <em>ldap-attribute</em>, <em>ldap-user</em>, and <em>ldap-group</em> (single-level only)
988     authorization checks use comparisons.</p>
989
990     <p>This directive only has effect on the comparisons performed during
991     nested group processing when <directive module="mod_authnz_ldap">
992     AuthLDAPSearchAsUser</directive> is also enabled.</p>
993
994     <p> This directive should only be used when your LDAP server doesn't
995         accept anonymous comparisons and you cannot use a dedicated
996         <directive module="mod_authnz_ldap">AuthLDAPBindDN</directive>.
997     </p>
998 </usage>
999 <seealso><directive module="mod_authnz_ldap">AuthLDAPInitialBindAsUser</directive></seealso>
1000 <seealso><directive module="mod_authnz_ldap">AuthLDAPSearchAsUser</directive></seealso>
1001 </directivesynopsis>
1002
1003 <directivesynopsis>
1004 <name>AuthLDAPCompareDNOnServer</name>
1005 <description>Use the LDAP server to compare the DNs</description>
1006 <syntax>AuthLDAPCompareDNOnServer on|off</syntax>
1007 <default>AuthLDAPCompareDNOnServer on</default>
1008 <contextlist><context>directory</context><context>.htaccess</context>
1009 </contextlist>
1010 <override>AuthConfig</override>
1011
1012 <usage>
1013     <p>When set, <module>mod_authnz_ldap</module> will use the LDAP
1014     server to compare the DNs. This is the only foolproof way to
1015     compare DNs.  <module>mod_authnz_ldap</module> will search the
1016     directory for the DN specified with the <a
1017     href="#reqdn"><code>Require dn</code></a> directive, then,
1018     retrieve the DN and compare it with the DN retrieved from the user
1019     entry. If this directive is not set,
1020     <module>mod_authnz_ldap</module> simply does a string comparison. It
1021     is possible to get false negatives with this approach, but it is
1022     much faster. Note the <module>mod_ldap</module> cache can speed up
1023     DN comparison in most situations.</p>
1024 </usage>
1025 </directivesynopsis>
1026
1027 <directivesynopsis>
1028 <name>AuthLDAPDereferenceAliases</name>
1029 <description>When will the module de-reference aliases</description>
1030 <syntax>AuthLDAPDereferenceAliases never|searching|finding|always</syntax>
1031 <default>AuthLDAPDereferenceAliases always</default>
1032 <contextlist><context>directory</context><context>.htaccess</context>
1033 </contextlist>
1034 <override>AuthConfig</override>
1035
1036 <usage>
1037     <p>This directive specifies when <module>mod_authnz_ldap</module> will
1038     de-reference aliases during LDAP operations. The default is
1039     <code>always</code>.</p>
1040 </usage>
1041 </directivesynopsis>
1042
1043 <directivesynopsis>
1044 <name>AuthLDAPGroupAttribute</name>
1045 <description>LDAP attributes used to identify the user members of
1046 groups.</description>
1047 <syntax>AuthLDAPGroupAttribute <em>attribute</em></syntax>
1048 <default>AuthLDAPGroupAttribute member uniquemember</default>
1049 <contextlist><context>directory</context><context>.htaccess</context>
1050 </contextlist>
1051 <override>AuthConfig</override>
1052
1053 <usage>
1054     <p>This directive specifies which LDAP attributes are used to
1055     check for user members within groups. Multiple attributes can be used
1056     by specifying this directive multiple times. If not specified,
1057     then <module>mod_authnz_ldap</module> uses the <code>member</code> and
1058     <code>uniquemember</code> attributes.</p>
1059 </usage>
1060 </directivesynopsis>
1061
1062 <directivesynopsis>
1063 <name>AuthLDAPGroupAttributeIsDN</name>
1064 <description>Use the DN of the client username when checking for
1065 group membership</description>
1066 <syntax>AuthLDAPGroupAttributeIsDN on|off</syntax>
1067 <default>AuthLDAPGroupAttributeIsDN on</default>
1068 <contextlist><context>directory</context><context>.htaccess</context>
1069 </contextlist>
1070 <override>AuthConfig</override>
1071
1072 <usage>
1073     <p>When set <code>on</code>, this directive says to use the
1074     distinguished name of the client username when checking for group
1075     membership.  Otherwise, the username will be used. For example,
1076     assume that the client sent the username <code>bjenson</code>,
1077     which corresponds to the LDAP DN <code>cn=Babs Jenson,
1078     o=Example</code>. If this directive is set,
1079     <module>mod_authnz_ldap</module> will check if the group has
1080     <code>cn=Babs Jenson, o=Example</code> as a member. If this
1081     directive is not set, then <module>mod_authnz_ldap</module> will
1082     check if the group has <code>bjenson</code> as a member.</p>
1083 </usage>
1084 </directivesynopsis>
1085
1086 <directivesynopsis>
1087 <name>AuthLDAPMaxSubGroupDepth</name>
1088 <description>Specifies the maximum sub-group nesting depth that will be
1089 evaluated before the user search is discontinued.</description>
1090 <syntax>AuthLDAPMaxSubGroupDepth <var>Number</var></syntax>
1091 <default>AuthLDAPMaxSubGroupDepth 0</default>
1092 <contextlist><context>directory</context><context>.htaccess</context>
1093 </contextlist>
1094 <override>AuthConfig</override>
1095 <compatibility>Available in version 2.3.0 and later, defaulted to 10 in 2.4.x and early 2.5</compatibility>
1096
1097 <usage>
1098    <p>When this directive is set to a non-zero value <code>X</code>
1099    combined with use of the <code>Require ldap-group someGroupDN</code>
1100    directive, the provided user credentials will be searched for
1101    as a member of the <code>someGroupDN</code> directory object or of
1102    any group member of the current group up to the maximum nesting
1103    level <code>X</code> specified by this directive.</p>
1104    <p>See the <a href="#reqgroup"><code>Require ldap-group</code></a>
1105    section for a more detailed example.</p>
1106
1107    <note><title>Nested groups performance</title>
1108    <p> When <directive>AuthLDAPSubGroupAttribute</directive> overlaps with
1109    <directive>AuthLDAPGroupAttribute</directive> (as it does by default and
1110    as required by common LDAP schemas), uncached searching for subgroups in 
1111    large groups can be very slow. If you use large, non-nested groups, keep 
1112    <directive>AuthLDAPMaxSubGroupDepth</directive> set to zero.</p>
1113    </note>
1114
1115 </usage>
1116 </directivesynopsis>
1117
1118 <directivesynopsis>
1119 <name>AuthLDAPRemoteUserAttribute</name>
1120 <description>Use the value of the attribute returned during the user
1121 query to set the REMOTE_USER environment variable</description>
1122 <syntax>AuthLDAPRemoteUserAttribute uid</syntax>
1123 <default>none</default>
1124 <contextlist><context>directory</context><context>.htaccess</context>
1125 </contextlist>
1126 <override>AuthConfig</override>
1127
1128 <usage>
1129     <p>If this directive is set, the value of the
1130     <code>REMOTE_USER</code> environment variable will be set to the
1131     value of the attribute specified. Make sure that this attribute is
1132     included in the list of attributes in the AuthLDAPUrl definition,
1133     otherwise this directive will have no effect. This directive, if
1134     present, takes precedence over <directive module="mod_authnz_ldap"
1135     >AuthLDAPRemoteUserIsDN</directive>. This
1136     directive is useful should you want people to log into a website
1137     using an email address, but a backend application expects the
1138     username as a userid.</p>
1139     <p> This directive only has effect when this module is used for 
1140     authentication.</p>
1141 </usage>
1142 </directivesynopsis>
1143
1144 <directivesynopsis>
1145 <name>AuthLDAPRemoteUserIsDN</name>
1146 <description>Use the DN of the client username to set the REMOTE_USER
1147 environment variable</description>
1148 <syntax>AuthLDAPRemoteUserIsDN on|off</syntax>
1149 <default>AuthLDAPRemoteUserIsDN off</default>
1150 <contextlist><context>directory</context><context>.htaccess</context>
1151 </contextlist>
1152 <override>AuthConfig</override>
1153
1154 <usage>
1155     <p>If this directive is set to on, the value of the
1156     <code>REMOTE_USER</code> environment variable will be set to the full
1157     distinguished name of the authenticated user, rather than just
1158     the username that was passed by the client. It is turned off by
1159     default.</p>
1160     <p> This directive only has effect when this module is used for
1161     authentication.</p>
1162 </usage>
1163 </directivesynopsis>
1164
1165 <directivesynopsis>
1166 <name>AuthLDAPSearchAsUser</name>
1167 <description>Use the authenticated user's credentials to perform authorization searches</description>
1168 <syntax>AuthLDAPSearchAsUser on|off</syntax>
1169 <default>AuthLDAPSearchAsUser off</default>
1170 <contextlist><context>directory</context><context>.htaccess</context>
1171 </contextlist>
1172 <override>AuthConfig</override>
1173 <compatibility>Available in version 2.3.6 and later</compatibility>
1174
1175 <usage>
1176     <p>When set, and <module>mod_authnz_ldap</module> has authenticated the
1177     user, LDAP searches for authorization use the queried distinguished name (DN)
1178     and HTTP basic authentication password of the authenticated user instead of
1179     the servers configured credentials.</p>
1180
1181     <p> The <em>ldap-filter</em> and <em>ldap-dn</em> authorization
1182     checks use searches.</p>
1183
1184     <p>This directive only has effect on the comparisons performed during
1185     nested group processing when <directive module="mod_authnz_ldap">
1186     AuthLDAPCompareAsUser</directive> is also enabled.</p>
1187
1188     <p> This directive should only be used when your LDAP server doesn't
1189         accept anonymous searches and you cannot use a dedicated
1190         <directive module="mod_authnz_ldap">AuthLDAPBindDN</directive>.
1191     </p>
1192 </usage>
1193 <seealso><directive module="mod_authnz_ldap">AuthLDAPInitialBindAsUser</directive></seealso>
1194 <seealso><directive module="mod_authnz_ldap">AuthLDAPCompareAsUser</directive></seealso>
1195 </directivesynopsis>
1196
1197 <directivesynopsis>
1198 <name>AuthLDAPSubGroupAttribute</name>
1199 <description>Specifies the attribute labels, one value per
1200 directive line, used to distinguish the members of the current group that
1201 are groups.</description>
1202 <syntax>AuthLDAPSubGroupAttribute <em>attribute</em></syntax>
1203 <default>AuthLDAPSubgroupAttribute member uniquemember</default>
1204 <contextlist><context>directory</context><context>.htaccess</context>
1205 </contextlist>
1206 <override>AuthConfig</override>
1207 <compatibility>Available in version 2.3.0 and later</compatibility>
1208
1209 <usage>
1210     <p>An LDAP group object may contain members that are users and
1211     members that are groups (called nested or sub groups). The
1212     <code>AuthLDAPSubGroupAttribute</code> directive identifies the
1213     labels of group members and the <code>AuthLDAPGroupAttribute</code>
1214     directive identifies the labels of the user members. Multiple
1215     attributes can be used by specifying this directive multiple times.
1216     If not specified, then <module>mod_authnz_ldap</module> uses the
1217     <code>member</code> and <code>uniqueMember</code> attributes.</p>
1218 </usage>
1219 </directivesynopsis>
1220
1221 <directivesynopsis>
1222 <name>AuthLDAPSubGroupClass</name>
1223 <description>Specifies which LDAP objectClass values identify directory
1224 objects that are groups during sub-group processing.</description>
1225 <syntax>AuthLDAPSubGroupClass <em>LdapObjectClass</em></syntax>
1226 <default>AuthLDAPSubGroupClass groupOfNames groupOfUniqueNames</default>
1227 <contextlist><context>directory</context><context>.htaccess</context>
1228 </contextlist>
1229 <override>AuthConfig</override>
1230 <compatibility>Available in version 2.3.0 and later</compatibility>
1231
1232 <usage>
1233     <p>An LDAP group object may contain members that are users and
1234     members that are groups (called nested or sub groups). The
1235     <code>AuthLDAPSubGroupAttribute</code> directive identifies the
1236     labels of members that may be sub-groups of the current group
1237     (as opposed to user members). The <code>AuthLDAPSubGroupClass</code>
1238     directive specifies the LDAP objectClass values used in verifying that
1239     these potential sub-groups are in fact group objects. Verified sub-groups
1240     can then be searched for more user or sub-group members. Multiple
1241     attributes can be used by specifying this directive multiple times.
1242     If not specified, then <module>mod_authnz_ldap</module> uses the
1243     <code>groupOfNames</code> and <code>groupOfUniqueNames</code> values.</p>
1244 </usage>
1245 </directivesynopsis>
1246
1247 <directivesynopsis>
1248 <name>AuthLDAPUrl</name>
1249 <description>URL specifying the LDAP search parameters</description>
1250 <syntax>AuthLDAPUrl <em>url [NONE|SSL|TLS|STARTTLS]</em></syntax>
1251 <contextlist><context>directory</context><context>.htaccess</context>
1252 </contextlist>
1253 <override>AuthConfig</override>
1254
1255 <usage>
1256     <p>An RFC 2255 URL which specifies the LDAP search parameters
1257     to use. The syntax of the URL is</p>
1258 <example>ldap://host:port/basedn?attribute?scope?filter</example>
1259     <p>If you want to specify more than one LDAP URL that Apache should try in turn, the syntax is:</p>
1260 <highlight language="config">AuthLDAPUrl "ldap://ldap1.example.com ldap2.example.com/dc=..."</highlight>
1261 <p><em><strong>Caveat: </strong>If you specify multiple servers, you need to enclose the entire URL string in quotes;
1262 otherwise you will get an error: "AuthLDAPURL takes one argument, URL to define LDAP connection.." </em>
1263 You can of course use search parameters on each of these.</p>
1264
1265 <dl>
1266 <dt>ldap</dt>
1267
1268         <dd>For regular ldap, use the
1269         string <code>ldap</code>. For secure LDAP, use <code>ldaps</code>
1270         instead. Secure LDAP is only available if Apache was linked
1271         to an LDAP library with SSL support.</dd>
1272
1273 <dt>host:port</dt>
1274
1275         <dd>
1276           <p>The name/port of the ldap server (defaults to
1277           <code>localhost:389</code> for <code>ldap</code>, and
1278           <code>localhost:636</code> for <code>ldaps</code>). To
1279           specify multiple, redundant LDAP servers, just list all
1280           servers, separated by spaces. <module>mod_authnz_ldap</module>
1281           will try connecting to each server in turn, until it makes a
1282           successful connection. If multiple ldap servers are specified,
1283           then entire LDAP URL must be encapsulated in double quotes.</p>
1284
1285           <p>Once a connection has been made to a server, that
1286           connection remains active for the life of the
1287           <program>httpd</program> process, or until the LDAP server goes
1288           down.</p>
1289
1290           <p>If the LDAP server goes down and breaks an existing
1291           connection, <module>mod_authnz_ldap</module> will attempt to
1292           re-connect, starting with the primary server, and trying
1293           each redundant server in turn. Note that this is different
1294           than a true round-robin search.</p>
1295         </dd>
1296
1297 <dt>basedn</dt>
1298
1299         <dd>The DN of the branch of the
1300         directory where all searches should start from. At the very
1301         least, this must be the top of your directory tree, but
1302         could also specify a subtree in the directory.</dd>
1303
1304 <dt>attribute</dt>
1305
1306         <dd>The attribute to search for.
1307         Although RFC 2255 allows a comma-separated list of
1308         attributes, only the first attribute will be used, no
1309         matter how many are provided. If no attributes are
1310         provided, the default is to use <code>uid</code>. It's a good
1311         idea to choose an attribute that will be unique across all
1312         entries in the subtree you will be using.  All attributes
1313         listed will be put into the environment with an AUTHENTICATE_ prefix
1314         for use by other modules.</dd>
1315
1316 <dt>scope</dt>
1317
1318         <dd>The scope of the search. Can be either <code>one</code> or
1319         <code>sub</code>. Note that a scope of <code>base</code> is
1320         also supported by RFC 2255, but is not supported by this
1321         module. If the scope is not provided, or if <code>base</code> scope
1322         is specified, the default is to use a scope of
1323         <code>sub</code>.</dd>
1324
1325 <dt>filter</dt>
1326
1327         <dd>A valid LDAP search filter. If
1328         not provided, defaults to <code>(objectClass=*)</code>, which
1329         will search for all objects in the tree. Filters are
1330         limited to approximately 8000 characters (the definition of
1331         <code>MAX_STRING_LEN</code> in the Apache source code). This
1332         should be more than sufficient for any application. The keyword
1333         <code>none</code> disables the use of a filter; this is required
1334         by some primitive LDAP servers.</dd>
1335 </dl>
1336
1337     <p>When doing searches, the attribute, filter and username passed
1338     by the HTTP client are combined to create a search filter that
1339     looks like
1340     <code>(&amp;(<em>filter</em>)(<em>attribute</em>=<em>username</em>))</code>.</p>
1341
1342     <p>For example, consider an URL of
1343     <code>ldap://ldap.example.com/o=Example?cn?sub?(posixid=*)</code>. When
1344     a client attempts to connect using a username of <code>Babs
1345     Jenson</code>, the resulting search filter will be
1346     <code>(&amp;(posixid=*)(cn=Babs Jenson))</code>.</p>
1347
1348     <p>An optional parameter can be added to allow the LDAP Url to override
1349     the connection type.  This parameter can be one of the following:</p>
1350
1351 <dl>
1352     <dt>NONE</dt>
1353         <dd>Establish an unsecure connection on the default LDAP port. This
1354         is the same as <code>ldap://</code> on port 389.</dd>
1355     <dt>SSL</dt>
1356         <dd>Establish a secure connection on the default secure LDAP port.
1357         This is the same as <code>ldaps://</code></dd>
1358     <dt>TLS | STARTTLS</dt>
1359         <dd>Establish an upgraded secure connection on the default LDAP port.
1360         This connection will be initiated on port 389 by default and then
1361         upgraded to a secure connection on the same port.</dd>
1362 </dl>
1363
1364     <p>See above for examples of <directive
1365     module="mod_authnz_ldap">AuthLDAPURL</directive> URLs.</p>
1366 </usage>
1367 </directivesynopsis>
1368
1369 </modulesynopsis>