1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5 This file is generated from xml source: DO NOT EDIT
6 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
8 <title>mod_ldap - Apache HTTP Server</title>
9 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
12 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
14 <div id="page-header">
15 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
16 <p class="apache">Apache HTTP Server Version 2.3</p>
17 <img alt="" src="../images/feather.gif" /></div>
18 <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
20 <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.3</a> > <a href="./">Modules</a></div>
21 <div id="page-content">
22 <div id="preamble"><h1>Apache Module mod_ldap</h1>
24 <p><span>Available Languages: </span><a href="../en/mod/mod_ldap.html" title="English"> en </a> |
25 <a href="../fr/mod/mod_ldap.html" hreflang="fr" rel="alternate" title="Français"> fr </a></p>
27 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>LDAP connection pooling and result caching services for use
28 by other LDAP modules</td></tr>
29 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
30 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>ldap_module</td></tr>
31 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>util_ldap.c</td></tr>
32 <tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0.41 and later</td></tr></table>
35 <p>This module was created to improve the performance of
36 websites relying on backend connections to LDAP servers. In
37 addition to the functions provided by the standard LDAP
38 libraries, this module adds an LDAP connection pool and an LDAP
39 shared memory cache.</p>
41 <p>To enable this module, LDAP support must be compiled into
42 apr-util. This is achieved by adding the <code>--with-ldap</code>
43 flag to the <code class="program"><a href="../programs/configure.html">configure</a></code> script when building
46 <p>SSL/TLS support is dependant on which LDAP toolkit has been
47 linked to <a class="glossarylink" href="../glossary.html#apr" title="see glossary">APR</a>. As of this writing, APR-util supports:
48 <a href="http://www.openldap.org/">OpenLDAP SDK</a> (2.x or later),
49 <a href="http://developer.novell.com/ndk/cldap.htm">Novell LDAP
50 SDK</a>, <a href="http://www.mozilla.org/directory/csdk.html">
51 Mozilla LDAP SDK</a>, native Solaris LDAP SDK (Mozilla based),
52 native Microsoft LDAP SDK, or the
53 <a href="http://www.iplanet.com/downloads/developer/">iPlanet
54 (Netscape)</a> SDK. See the <a href="http://apr.apache.org">APR</a>
55 website for details.</p>
58 <div id="quickview"><h3 class="directives">Directives</h3>
60 <li><img alt="" src="../images/down.gif" /> <a href="#ldapcacheentries">LDAPCacheEntries</a></li>
61 <li><img alt="" src="../images/down.gif" /> <a href="#ldapcachettl">LDAPCacheTTL</a></li>
62 <li><img alt="" src="../images/down.gif" /> <a href="#ldapconnectiontimeout">LDAPConnectionTimeout</a></li>
63 <li><img alt="" src="../images/down.gif" /> <a href="#ldaplibrarydebug">LDAPLibraryDebug</a></li>
64 <li><img alt="" src="../images/down.gif" /> <a href="#ldapopcacheentries">LDAPOpCacheEntries</a></li>
65 <li><img alt="" src="../images/down.gif" /> <a href="#ldapopcachettl">LDAPOpCacheTTL</a></li>
66 <li><img alt="" src="../images/down.gif" /> <a href="#ldapreferralhoplimit">LDAPReferralHopLimit</a></li>
67 <li><img alt="" src="../images/down.gif" /> <a href="#ldapreferrals">LDAPReferrals</a></li>
68 <li><img alt="" src="../images/down.gif" /> <a href="#ldapsharedcachefile">LDAPSharedCacheFile</a></li>
69 <li><img alt="" src="../images/down.gif" /> <a href="#ldapsharedcachesize">LDAPSharedCacheSize</a></li>
70 <li><img alt="" src="../images/down.gif" /> <a href="#ldaptimeout">LDAPTimeout</a></li>
71 <li><img alt="" src="../images/down.gif" /> <a href="#ldaptrustedclientcert">LDAPTrustedClientCert</a></li>
72 <li><img alt="" src="../images/down.gif" /> <a href="#ldaptrustedglobalcert">LDAPTrustedGlobalCert</a></li>
73 <li><img alt="" src="../images/down.gif" /> <a href="#ldaptrustedmode">LDAPTrustedMode</a></li>
74 <li><img alt="" src="../images/down.gif" /> <a href="#ldapverifyservercert">LDAPVerifyServerCert</a></li>
78 <li><img alt="" src="../images/down.gif" /> <a href="#exampleconfig">Example Configuration</a></li>
79 <li><img alt="" src="../images/down.gif" /> <a href="#pool">LDAP Connection Pool</a></li>
80 <li><img alt="" src="../images/down.gif" /> <a href="#cache">LDAP Cache</a></li>
81 <li><img alt="" src="../images/down.gif" /> <a href="#usingssltls">Using SSL/TLS</a></li>
82 <li><img alt="" src="../images/down.gif" /> <a href="#settingcerts">SSL/TLS Certificates</a></li>
84 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
86 <h2><a name="exampleconfig" id="exampleconfig">Example Configuration</a></h2>
87 <p>The following is an example configuration that uses
88 <code class="module"><a href="../mod/mod_ldap.html">mod_ldap</a></code> to increase the performance of HTTP Basic
89 authentication provided by <code class="module"><a href="../mod/mod_authnz_ldap.html">mod_authnz_ldap</a></code>.</p>
91 <div class="example"><p><code>
92 # Enable the LDAP connection pool and shared<br />
93 # memory cache. Enable the LDAP cache status<br />
94 # handler. Requires that mod_ldap and mod_authnz_ldap<br />
95 # be loaded. Change the "yourdomain.example.com" to<br />
96 # match your domain.<br />
98 LDAPSharedCacheSize 500000<br />
99 LDAPCacheEntries 1024<br />
100 LDAPCacheTTL 600<br />
101 LDAPOpCacheEntries 1024<br />
102 LDAPOpCacheTTL 600<br />
104 <Location /ldap-status><br />
105 <span class="indent">
106 SetHandler ldap-status<br />
107 Order deny,allow<br />
109 Allow from yourdomain.example.com<br />
112 AuthName "LDAP Protected"<br />
113 AuthBasicProvider ldap<br />
114 AuthLDAPURL ldap://127.0.0.1/dc=example,dc=com?uid?one<br />
115 Require valid-user<br />
119 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
120 <div class="section">
121 <h2><a name="pool" id="pool">LDAP Connection Pool</a></h2>
123 <p>LDAP connections are pooled from request to request. This
124 allows the LDAP server to remain connected and bound ready for
125 the next request, without the need to unbind/connect/rebind.
126 The performance advantages are similar to the effect of HTTP
129 <p>On a busy server it is possible that many requests will try
130 and access the same LDAP server connection simultaneously.
131 Where an LDAP connection is in use, Apache will create a new
132 connection alongside the original one. This ensures that the
133 connection pool does not become a bottleneck.</p>
135 <p>There is no need to manually enable connection pooling in
136 the Apache configuration. Any module using this module for
137 access to LDAP services will share the connection pool.</p>
139 <p>LDAP connections can keep track of the ldap client
140 credentials used when binding to an LDAP server. These
141 credentials can be provided to LDAP servers that do not
142 allow anonymous binds during referral chasing. To control
143 this feature, see the <code class="directive"><a href="# ldapreferrals">
144 LDAPReferrals</a></code> and <code class="directive"><a href="# ldapreferralhoplimit">
145 LDAPReferralHopLimit</a></code> directives. By default,
146 this feature is enabled.</p>
147 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
148 <div class="section">
149 <h2><a name="cache" id="cache">LDAP Cache</a></h2>
151 <p>For improved performance, <code class="module"><a href="../mod/mod_ldap.html">mod_ldap</a></code> uses an aggressive
152 caching strategy to minimize the number of times that the LDAP
153 server must be contacted. Caching can easily double or triple
154 the throughput of Apache when it is serving pages protected
155 with mod_authnz_ldap. In addition, the load on the LDAP server
156 will be significantly decreased.</p>
158 <p><code class="module"><a href="../mod/mod_ldap.html">mod_ldap</a></code> supports two types of LDAP caching during
159 the search/bind phase with a <em>search/bind cache</em> and
160 during the compare phase with two <em>operation
161 caches</em>. Each LDAP URL that is used by the server has
162 its own set of these three caches.</p>
164 <h3><a name="search-bind" id="search-bind">The Search/Bind Cache</a></h3>
165 <p>The process of doing a search and then a bind is the
166 most time-consuming aspect of LDAP operation, especially if
167 the directory is large. The search/bind cache is used to
168 cache all searches that resulted in successful binds.
169 Negative results (<em>i.e.</em>, unsuccessful searches, or searches
170 that did not result in a successful bind) are not cached.
171 The rationale behind this decision is that connections with
172 invalid credentials are only a tiny percentage of the total
173 number of connections, so by not caching invalid
174 credentials, the size of the cache is reduced.</p>
176 <p><code class="module"><a href="../mod/mod_ldap.html">mod_ldap</a></code> stores the username, the DN
177 retrieved, the password used to bind, and the time of the bind
178 in the cache. Whenever a new connection is initiated with the
179 same username, <code class="module"><a href="../mod/mod_ldap.html">mod_ldap</a></code> compares the password
180 of the new connection with the password in the cache. If the
181 passwords match, and if the cached entry is not too old,
182 <code class="module"><a href="../mod/mod_ldap.html">mod_ldap</a></code> bypasses the search/bind phase.</p>
184 <p>The search and bind cache is controlled with the <code class="directive"><a href="#ldapcacheentries">LDAPCacheEntries</a></code> and <code class="directive"><a href="#ldapcachettl">LDAPCacheTTL</a></code> directives.</p>
187 <h3><a name="opcaches" id="opcaches">Operation Caches</a></h3>
188 <p>During attribute and distinguished name comparison
189 functions, <code class="module"><a href="../mod/mod_ldap.html">mod_ldap</a></code> uses two operation caches
190 to cache the compare operations. The first compare cache is
191 used to cache the results of compares done to test for LDAP
192 group membership. The second compare cache is used to cache
193 the results of comparisons done between distinguished
196 <p>Note that, when group membership is being checked, any sub-group
197 comparison results are cached to speed future sub-group comparisons.</p>
199 <p>The behavior of both of these caches is controlled with
200 the <code class="directive"><a href="#ldapopcacheentries">LDAPOpCacheEntries</a></code>
201 and <code class="directive"><a href="#ldapopcachettl">LDAPOpCacheTTL</a></code>
205 <h3><a name="monitoring" id="monitoring">Monitoring the Cache</a></h3>
206 <p><code class="module"><a href="../mod/mod_ldap.html">mod_ldap</a></code> has a content handler that allows
207 administrators to monitor the cache performance. The name of
208 the content handler is <code>ldap-status</code>, so the
209 following directives could be used to access the
210 <code class="module"><a href="../mod/mod_ldap.html">mod_ldap</a></code> cache information:</p>
212 <div class="example"><p><code>
213 <Location /server/cache-info><br />
214 <span class="indent">
215 SetHandler ldap-status<br />
220 <p>By fetching the URL <code>http://servername/cache-info</code>,
221 the administrator can get a status report of every cache that is used
222 by <code class="module"><a href="../mod/mod_ldap.html">mod_ldap</a></code> cache. Note that if Apache does not
223 support shared memory, then each <code class="program"><a href="../programs/httpd.html">httpd</a></code> instance has its
224 own cache, so reloading the URL will result in different
225 information each time, depending on which <code class="program"><a href="../programs/httpd.html">httpd</a></code>
226 instance processes the request.</p>
228 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
229 <div class="section">
230 <h2><a name="usingssltls" id="usingssltls">Using SSL/TLS</a></h2>
232 <p>The ability to create an SSL and TLS connections to an LDAP server
233 is defined by the directives <code class="directive"><a href="# ldaptrustedglobalcert">
234 LDAPTrustedGlobalCert</a></code>, <code class="directive"><a href="# ldaptrustedclientcert">
235 LDAPTrustedClientCert</a></code> and <code class="directive"><a href="# ldaptrustedmode">
236 LDAPTrustedMode</a></code>. These directives specify the CA and
237 optional client certificates to be used, as well as the type of
238 encryption to be used on the connection (none, SSL or TLS/STARTTLS).</p>
240 <div class="example"><p><code>
241 # Establish an SSL LDAP connection on port 636. Requires that <br />
242 # mod_ldap and mod_authnz_ldap be loaded. Change the <br />
243 # "yourdomain.example.com" to match your domain.<br />
245 LDAPTrustedGlobalCert CA_DER /certs/certfile.der<br />
247 <Location /ldap-status><br />
248 <span class="indent">
249 SetHandler ldap-status<br />
250 Order deny,allow<br />
252 Allow from yourdomain.example.com<br />
255 AuthName "LDAP Protected"<br />
256 AuthBasicProvider ldap<br />
257 AuthLDAPURL ldaps://127.0.0.1/dc=example,dc=com?uid?one<br />
258 Require valid-user<br />
263 <div class="example"><p><code>
264 # Establish a TLS LDAP connection on port 389. Requires that <br />
265 # mod_ldap and mod_authnz_ldap be loaded. Change the <br />
266 # "yourdomain.example.com" to match your domain.<br />
268 LDAPTrustedGlobalCert CA_DER /certs/certfile.der<br />
270 <Location /ldap-status><br />
271 <span class="indent">
272 SetHandler ldap-status<br />
273 Order deny,allow<br />
275 Allow from yourdomain.example.com<br />
278 AuthName "LDAP Protected"<br />
279 AuthBasicProvider ldap<br />
280 AuthLDAPURL ldap://127.0.0.1/dc=example,dc=com?uid?one TLS<br />
281 Require valid-user<br />
286 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
287 <div class="section">
288 <h2><a name="settingcerts" id="settingcerts">SSL/TLS Certificates</a></h2>
290 <p>The different LDAP SDKs have widely different methods of setting
291 and handling both CA and client side certificates.</p>
293 <p>If you intend to use SSL or TLS, read this section CAREFULLY so as to
294 understand the differences between configurations on the different LDAP
295 toolkits supported.</p>
297 <h3><a name="settingcerts-netscape" id="settingcerts-netscape">Netscape/Mozilla/iPlanet SDK</a></h3>
298 <p>CA certificates are specified within a file called cert7.db.
299 The SDK will not talk to any LDAP server whose certificate was
300 not signed by a CA specified in this file. If
301 client certificates are required, an optional key3.db file may
302 be specified with an optional password. The secmod file can be
303 specified if required. These files are in the same format as
304 used by the Netscape Communicator or Mozilla web browsers. The easiest
305 way to obtain these files is to grab them from your browser
308 <p>Client certificates are specified per connection using the
309 LDAPTrustedClientCert directive by referring
310 to the certificate "nickname". An optional password may be
311 specified to unlock the certificate's private key.</p>
313 <p>The SDK supports SSL only. An attempt to use STARTTLS will cause
314 an error when an attempt is made to contact the LDAP server at
317 <div class="example"><p><code>
318 # Specify a Netscape CA certificate file<br />
319 LDAPTrustedGlobalCert CA_CERT7_DB /certs/cert7.db<br />
320 # Specify an optional key3.db file for client certificate support<br />
321 LDAPTrustedGlobalCert CERT_KEY3_DB /certs/key3.db<br />
322 # Specify the secmod file if required<br />
323 LDAPTrustedGlobalCert CA_SECMOD /certs/secmod<br />
324 <Location /ldap-status><br />
325 <span class="indent">
326 SetHandler ldap-status<br />
327 Order deny,allow<br />
329 Allow from yourdomain.example.com<br />
332 AuthName "LDAP Protected"<br />
333 AuthBasicProvider ldap<br />
334 LDAPTrustedClientCert CERT_NICKNAME <nickname> [password]<br />
335 AuthLDAPURL ldaps://127.0.0.1/dc=example,dc=com?uid?one<br />
336 Require valid-user<br />
343 <h3><a name="settingcerts-novell" id="settingcerts-novell">Novell SDK</a></h3>
345 <p>One or more CA certificates must be specified for the Novell
346 SDK to work correctly. These certificates can be specified as
347 binary DER or Base64 (PEM) encoded files.</p>
349 <p>Note: Client certificates are specified globally rather than per
350 connection, and so must be specified with the LDAPTrustedGlobalCert
351 directive as below. Trying to set client certificates via the
352 LDAPTrustedClientCert directive will cause an error to be logged
353 when an attempt is made to connect to the LDAP server..</p>
355 <p>The SDK supports both SSL and STARTTLS, set using the
356 LDAPTrustedMode parameter. If an ldaps:// URL is specified,
357 SSL mode is forced, override this directive.</p>
359 <div class="example"><p><code>
360 # Specify two CA certificate files<br />
361 LDAPTrustedGlobalCert CA_DER /certs/cacert1.der<br />
362 LDAPTrustedGlobalCert CA_BASE64 /certs/cacert2.pem<br />
363 # Specify a client certificate file and key<br />
364 LDAPTrustedGlobalCert CERT_BASE64 /certs/cert1.pem<br />
365 LDAPTrustedGlobalCert KEY_BASE64 /certs/key1.pem [password]<br />
366 # Do not use this directive, as it will throw an error<br />
367 #LDAPTrustedClientCert CERT_BASE64 /certs/cert1.pem<br />
372 <h3><a name="settingcerts-openldap" id="settingcerts-openldap">OpenLDAP SDK</a></h3>
374 <p>One or more CA certificates must be specified for the OpenLDAP
375 SDK to work correctly. These certificates can be specified as
376 binary DER or Base64 (PEM) encoded files.</p>
378 <p>Both CA and client certificates may be specified globally
379 (LDAPTrustedGlobalCert) or per-connection (LDAPTrustedClientCert).
380 When any settings are specified per-connection, the global
381 settings are superceded.</p>
383 <p>The documentation for the SDK claims to support both SSL and
384 STARTTLS, however STARTTLS does not seem to work on all versions
385 of the SDK. The SSL/TLS mode can be set using the
386 LDAPTrustedMode parameter. If an ldaps:// URL is specified,
387 SSL mode is forced. The OpenLDAP documentation notes that SSL
388 (ldaps://) support has been deprecated to be replaced with TLS,
389 although the SSL functionality still works.</p>
391 <div class="example"><p><code>
392 # Specify two CA certificate files<br />
393 LDAPTrustedGlobalCert CA_DER /certs/cacert1.der<br />
394 LDAPTrustedGlobalCert CA_BASE64 /certs/cacert2.pem<br />
395 <Location /ldap-status><br />
396 <span class="indent">
397 SetHandler ldap-status<br />
398 Order deny,allow<br />
400 Allow from yourdomain.example.com<br />
401 LDAPTrustedClientCert CERT_BASE64 /certs/cert1.pem<br />
402 LDAPTrustedClientCert KEY_BASE64 /certs/key1.pem<br />
403 # CA certs respecified due to per-directory client certs<br />
404 LDAPTrustedClientCert CA_DER /certs/cacert1.der<br />
405 LDAPTrustedClientCert CA_BASE64 /certs/cacert2.pem<br />
408 AuthName "LDAP Protected"<br />
409 AuthBasicProvider ldap<br />
410 AuthLDAPURL ldaps://127.0.0.1/dc=example,dc=com?uid?one<br />
411 Require valid-user<br />
418 <h3><a name="settingcerts-solaris" id="settingcerts-solaris">Solaris SDK</a></h3>
420 <p>SSL/TLS for the native Solaris LDAP libraries is not yet
421 supported. If required, install and use the OpenLDAP libraries
426 <h3><a name="settingcerts-microsoft" id="settingcerts-microsoft">Microsoft SDK</a></h3>
428 <p>SSL/TLS certificate configuration for the native Microsoft
429 LDAP libraries is done inside the system registry, and no
430 configuration directives are required.</p>
432 <p>Both SSL and TLS are supported by using the ldaps:// URL
433 format, or by using the LDAPTrustedMode directive accordingly.</p>
435 <p>Note: The status of support for client certificates is not yet known
436 for this toolkit.</p>
441 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
442 <div class="directive-section"><h2><a name="LDAPCacheEntries" id="LDAPCacheEntries">LDAPCacheEntries</a> <a name="ldapcacheentries" id="ldapcacheentries">Directive</a></h2>
443 <table class="directive">
444 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of entries in the primary LDAP cache</td></tr>
445 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LDAPCacheEntries <var>number</var></code></td></tr>
446 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LDAPCacheEntries 1024</code></td></tr>
447 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
448 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
449 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_ldap</td></tr>
451 <p>Specifies the maximum size of the primary LDAP cache. This
452 cache contains successful search/binds. Set it to 0 to turn off
453 search/bind caching. The default size is 1024 cached
457 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
458 <div class="directive-section"><h2><a name="LDAPCacheTTL" id="LDAPCacheTTL">LDAPCacheTTL</a> <a name="ldapcachettl" id="ldapcachettl">Directive</a></h2>
459 <table class="directive">
460 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Time that cached items remain valid</td></tr>
461 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LDAPCacheTTL <var>seconds</var></code></td></tr>
462 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LDAPCacheTTL 600</code></td></tr>
463 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
464 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
465 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_ldap</td></tr>
467 <p>Specifies the time (in seconds) that an item in the
468 search/bind cache remains valid. The default is 600 seconds (10
472 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
473 <div class="directive-section"><h2><a name="LDAPConnectionTimeout" id="LDAPConnectionTimeout">LDAPConnectionTimeout</a> <a name="ldapconnectiontimeout" id="ldapconnectiontimeout">Directive</a></h2>
474 <table class="directive">
475 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Specifies the socket connection timeout in seconds</td></tr>
476 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LDAPConnectionTimeout <var>seconds</var></code></td></tr>
477 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
478 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
479 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_ldap</td></tr>
481 <p>This directive configures the LDAP_OPT_NETWORK_TIMEOUT option in the
482 underlying LDAP client library, when available. This value typically
483 controls how long the LDAP client library will wait for the TCP connection
484 to the LDAP server to complete.</p>
486 <p> If a connection is not successful with the timeout period, either an error will be
487 returned or the LDAP client library will attempt to connect to a secondary LDAP
488 server if one is specified (via a space-separated list of hostnames in the
489 <code class="directive"><a href="#authldapurl">AuthLDAPURL</a></code>).</p>
491 <p>The default is 10 seconds, if the LDAP client library linked with the
492 server supports the LDAP_OPT_NETWORK_TIMEOUT option.</p>
494 <div class="note">LDAPConnectionTimeout is only available when the LDAP client library linked
495 with the server supports the LDAP_OPT_NETWORK_TIMEOUT option, and the
496 ultimate behavior is dictated entirely by the LDAP client library.
500 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
501 <div class="directive-section"><h2><a name="LDAPLibraryDebug" id="LDAPLibraryDebug">LDAPLibraryDebug</a> <a name="ldaplibrarydebug" id="ldaplibrarydebug">Directive</a></h2>
502 <table class="directive">
503 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enable debugging in the LDAP SDK</td></tr>
504 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LDAPLibraryDebug <var>7</var></code></td></tr>
505 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>disabled</code></td></tr>
506 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
507 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
508 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_ldap</td></tr>
510 <p>Turns on SDK-specific LDAP debug options that generally cause the LDAP
511 SDK to log verbose trace information to the main Apache error log.
512 The trace messages from the LDAP SDK provide gory details that
513 can be useful during debugging of connectivity problems with backend LDAP servers</p>
515 <p>This option is only configurable when Apache HTTP Server is linked with
516 an LDAP SDK that implements <code>LDAP_OPT_DEBUG</code> or
517 <code>LDAP_OPT_DEBUG_LEVEL</code>, such as OpenLDAP (a value of 7 is verbose)
518 or Tivoli Directory Server (a value of 65535 is verbose).</p>
520 <div class="warning">
521 <p>The logged information will likely contain plaintext credentials being used or
522 validated by LDAP authentication, so care should be taken in protecting and purging
523 the error log when this directive is used.</p>
528 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
529 <div class="directive-section"><h2><a name="LDAPOpCacheEntries" id="LDAPOpCacheEntries">LDAPOpCacheEntries</a> <a name="ldapopcacheentries" id="ldapopcacheentries">Directive</a></h2>
530 <table class="directive">
531 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of entries used to cache LDAP compare
533 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LDAPOpCacheEntries <var>number</var></code></td></tr>
534 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LDAPOpCacheEntries 1024</code></td></tr>
535 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
536 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
537 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_ldap</td></tr>
539 <p>This specifies the number of entries <code class="module"><a href="../mod/mod_ldap.html">mod_ldap</a></code>
540 will use to cache LDAP compare operations. The default is 1024
541 entries. Setting it to 0 disables operation caching.</p>
544 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
545 <div class="directive-section"><h2><a name="LDAPOpCacheTTL" id="LDAPOpCacheTTL">LDAPOpCacheTTL</a> <a name="ldapopcachettl" id="ldapopcachettl">Directive</a></h2>
546 <table class="directive">
547 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Time that entries in the operation cache remain
549 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LDAPOpCacheTTL <var>seconds</var></code></td></tr>
550 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LDAPOpCacheTTL 600</code></td></tr>
551 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
552 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
553 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_ldap</td></tr>
555 <p>Specifies the time (in seconds) that entries in the
556 operation cache remain valid. The default is 600 seconds.</p>
559 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
560 <div class="directive-section"><h2><a name="LDAPReferralHopLimit" id="LDAPReferralHopLimit">LDAPReferralHopLimit</a> <a name="ldapreferralhoplimit" id="ldapreferralhoplimit">Directive</a></h2>
561 <table class="directive">
562 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The maximum number of referral hops to chase before terminating an LDAP query.</td></tr>
563 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LDAPReferralHopLimit <var>number</var></code></td></tr>
564 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SDK dependent, typically between 5 and 10</code></td></tr>
565 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
566 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr>
567 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
568 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_ldap</td></tr>
570 <p>This directive, if enabled by the <code>LDAPReferrals</code> directive,
571 limits the number of referral hops that are followed before terminating an
574 <div class="warning">
575 <p> Support for this tunable is uncommon in LDAP SDKs.</p>
579 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
580 <div class="directive-section"><h2><a name="LDAPReferrals" id="LDAPReferrals">LDAPReferrals</a> <a name="ldapreferrals" id="ldapreferrals">Directive</a></h2>
581 <table class="directive">
582 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enable referral chasing during queries to the LDAP server.</td></tr>
583 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LDAPReferrals <var>On|Off</var></code></td></tr>
584 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LDAPReferrals On</code></td></tr>
585 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
586 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr>
587 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
588 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_ldap</td></tr>
590 <p>Some LDAP servers divide their directory among multiple domains and use referrals
591 to direct a client when a domain boundary is crossed. By setting <code>LDAPReferrals On</code>
592 referrals will be chased (setting it to off causes referrals to be ignored). The directive
593 <code>LDAPReferralHopLimit</code> works in conjunction with this directive to limit the
594 number of referral hops to follow before terminating the LDAP query. When referral processing
595 is enabled client credentials will be provided, via a rebind callback, for any LDAP server
599 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
600 <div class="directive-section"><h2><a name="LDAPSharedCacheFile" id="LDAPSharedCacheFile">LDAPSharedCacheFile</a> <a name="ldapsharedcachefile" id="ldapsharedcachefile">Directive</a></h2>
601 <table class="directive">
602 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the shared memory cache file</td></tr>
603 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LDAPSharedCacheFile <var>directory-path/filename</var></code></td></tr>
604 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
605 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
606 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_ldap</td></tr>
608 <p>Specifies the directory path and file name of the shared memory
609 cache file. If not set, anonymous shared memory will be used if the
610 platform supports it.</p>
613 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
614 <div class="directive-section"><h2><a name="LDAPSharedCacheSize" id="LDAPSharedCacheSize">LDAPSharedCacheSize</a> <a name="ldapsharedcachesize" id="ldapsharedcachesize">Directive</a></h2>
615 <table class="directive">
616 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Size in bytes of the shared-memory cache</td></tr>
617 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LDAPSharedCacheSize <var>bytes</var></code></td></tr>
618 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LDAPSharedCacheSize 500000</code></td></tr>
619 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
620 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
621 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_ldap</td></tr>
623 <p>Specifies the number of bytes to allocate for the shared
624 memory cache. The default is 500kb. If set to 0, shared memory
625 caching will not be used.</p>
628 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
629 <div class="directive-section"><h2><a name="LDAPTimeout" id="LDAPTimeout">LDAPTimeout</a> <a name="ldaptimeout" id="ldaptimeout">Directive</a></h2>
630 <table class="directive">
631 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Specifies the timeout for LDAP search and bind operations, in seconds</td></tr>
632 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LDAPTimeout <var>seconds</var></code></td></tr>
633 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LDAPTimeout 60</code></td></tr>
634 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
635 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
636 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_ldap</td></tr>
638 <p>This directive configures the timeout for bind and search operations, as well as
639 the LDAP_OPT_TIMEOUT option in the underlying LDAP client library, when available.</p>
641 <p> If the timeout expires, httpd will retry in case an existing connection has
642 been silently dropped by a firewall. However, performance will be much better if
643 the firewall is configured to send TCP RST packets instead of silently dropping
647 <p>Timeouts for ldap compare operations requires an SDK with LDAP_OPT_TIMEOUT, such as OpenLDAP >= 2.4.4.</p>
652 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
653 <div class="directive-section"><h2><a name="LDAPTrustedClientCert" id="LDAPTrustedClientCert">LDAPTrustedClientCert</a> <a name="ldaptrustedclientcert" id="ldaptrustedclientcert">Directive</a></h2>
654 <table class="directive">
655 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the file containing or nickname referring to a per
656 connection client certificate. Not all LDAP toolkits support per
657 connection client certificates.</td></tr>
658 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LDAPTrustedClientCert <var>type</var> <var>directory-path/filename/nickname</var> <var>[password]</var></code></td></tr>
659 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
660 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
661 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_ldap</td></tr>
663 <p>It specifies the directory path, file name or nickname of a
664 per connection client certificate used when establishing an SSL
665 or TLS connection to an LDAP server. Different locations or
666 directories may have their own independant client certificate
667 settings. Some LDAP toolkits (notably Novell)
668 do not support per connection client certificates, and will throw an
669 error on LDAP server connection if you try to use this directive
670 (Use the LDAPTrustedGlobalCert directive instead for Novell client
671 certificates - See the SSL/TLS certificate guide above for details).
672 The type specifies the kind of certificate parameter being
673 set, depending on the LDAP toolkit being used. Supported types are:</p>
675 <li>CA_DER - binary DER encoded CA certificate</li>
676 <li>CA_BASE64 - PEM encoded CA certificate</li>
677 <li>CERT_DER - binary DER encoded client certificate</li>
678 <li>CERT_BASE64 - PEM encoded client certificate</li>
679 <li>CERT_NICKNAME - Client certificate "nickname" (Netscape SDK)</li>
680 <li>KEY_DER - binary DER encoded private key</li>
681 <li>KEY_BASE64 - PEM encoded private key</li>
685 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
686 <div class="directive-section"><h2><a name="LDAPTrustedGlobalCert" id="LDAPTrustedGlobalCert">LDAPTrustedGlobalCert</a> <a name="ldaptrustedglobalcert" id="ldaptrustedglobalcert">Directive</a></h2>
687 <table class="directive">
688 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the file or database containing global trusted
689 Certificate Authority or global client certificates</td></tr>
690 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LDAPTrustedGlobalCert <var>type</var> <var>directory-path/filename</var> <var>[password]</var></code></td></tr>
691 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
692 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
693 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_ldap</td></tr>
695 <p>It specifies the directory path and file name of the trusted CA
696 certificates and/or system wide client certificates <code class="module"><a href="../mod/mod_ldap.html">mod_ldap</a></code>
697 should use when establishing an SSL or TLS connection to an LDAP
698 server. Note that all certificate information specified using this directive
699 is applied globally to the entire server installation. Some LDAP toolkits
700 (notably Novell) require all client certificates to be set globally using
701 this directive. Most other toolkits require clients certificates to be set
702 per Directory or per Location using LDAPTrustedClientCert. If you get this
703 wrong, an error may be logged when an attempt is made to contact the LDAP
704 server, or the connection may silently fail (See the SSL/TLS certificate
705 guide above for details).
706 The type specifies the kind of certificate parameter being
707 set, depending on the LDAP toolkit being used. Supported types are:</p>
709 <li>CA_DER - binary DER encoded CA certificate</li>
710 <li>CA_BASE64 - PEM encoded CA certificate</li>
711 <li>CA_CERT7_DB - Netscape cert7.db CA certificate database file</li>
712 <li>CA_SECMOD - Netscape secmod database file</li>
713 <li>CERT_DER - binary DER encoded client certificate</li>
714 <li>CERT_BASE64 - PEM encoded client certificate</li>
715 <li>CERT_KEY3_DB - Netscape key3.db client certificate database file</li>
716 <li>CERT_NICKNAME - Client certificate "nickname" (Netscape SDK)</li>
717 <li>CERT_PFX - PKCS#12 encoded client certificate (Novell SDK)</li>
718 <li>KEY_DER - binary DER encoded private key</li>
719 <li>KEY_BASE64 - PEM encoded private key</li>
720 <li>KEY_PFX - PKCS#12 encoded private key (Novell SDK)</li>
724 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
725 <div class="directive-section"><h2><a name="LDAPTrustedMode" id="LDAPTrustedMode">LDAPTrustedMode</a> <a name="ldaptrustedmode" id="ldaptrustedmode">Directive</a></h2>
726 <table class="directive">
727 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Specifies the SSL/TLS mode to be used when connecting to an LDAP server.</td></tr>
728 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LDAPTrustedMode <var>type</var></code></td></tr>
729 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
730 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
731 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_ldap</td></tr>
733 <p>The following modes are supported:</p>
735 <li>NONE - no encryption</li>
736 <li>SSL - ldaps:// encryption on default port 636</li>
737 <li>TLS - STARTTLS encryption on default port 389</li>
740 <p>Not all LDAP toolkits support all the above modes. An error message
741 will be logged at runtime if a mode is not supported, and the
742 connection to the LDAP server will fail.
745 <p>If an ldaps:// URL is specified, the mode becomes SSL and the setting
746 of LDAPTrustedMode is ignored.</p>
749 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
750 <div class="directive-section"><h2><a name="LDAPVerifyServerCert" id="LDAPVerifyServerCert">LDAPVerifyServerCert</a> <a name="ldapverifyservercert" id="ldapverifyservercert">Directive</a></h2>
751 <table class="directive">
752 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Force server certificate verification</td></tr>
753 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>LDAPVerifyServerCert <var>On|Off</var></code></td></tr>
754 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>LDAPVerifyServerCert On</code></td></tr>
755 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
756 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
757 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_ldap</td></tr>
759 <p>Specifies whether to force the verification of a
760 server certificate when establishing an SSL connection to the
765 <div class="bottomlang">
766 <p><span>Available Languages: </span><a href="../en/mod/mod_ldap.html" title="English"> en </a> |
767 <a href="../fr/mod/mod_ldap.html" hreflang="fr" rel="alternate" title="Français"> fr </a></p>
768 </div><div id="footer">
769 <p class="apache">Copyright 2010 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
770 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>