Debian Codegraph @

doc/contrib/mod_ldap.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>ProFTPD module mod_ldap</title>
5 </head>
6
7 <body bgcolor=white>
8
9 <hr><br>
10 <center>
11 <h2><b>ProFTPD module <code>mod_ldap</code></b></h2>
12 </center>
13 <hr><br>
14
15 <p>
16 This module is contained in the <code>mod_ldap.c</code> file for ProFTPD 1.2.<i>x</i>/1.3.<i>x</i>, and is not compiled by default. Installation instructions
17 are discussed <a href="#Installation">here</a>.
18
19 <p>
20 The most current version of <code>mod_ldap</code> is distributed with the
21 ProFTPD source code.
22
23 <h2>Author</h2>
24 <p>
25 Please contact John Morrissey &lt;jwm <i>at</i> horde.net&gt; with any
26 questions, concerns, or suggestions regarding this module.
27
28 <h2>Directives</h2>
29 <ul>
30 <li><a href="#LDAPAliasDereference">LDAPAliasDereference</a>
31 <li><a href="#LDAPAttr">LDAPAttr</a>
32 <li><a href="#LDAPAuthBinds">LDAPAuthBinds</a>
33 <li><a href="#LDAPBindDN">LDAPBindDN</a>
34 <li><a href="#LDAPConnectTimeout">LDAPConnectTimeout</a>
35 <li><a href="#LDAPDefaultAuthScheme">LDAPDefaultAuthScheme</a>
36 <li><a href="#LDAPDefaultGID">LDAPDefaultGID</a>
37 <li><a href="#LDAPDefaultQuota">LDAPDefaultQuota</a>
38 <li><a href="#LDAPDefaultUID">LDAPDefaultUID</a>
39 <li><a href="#LDAPForceDefaultGID">LDAPForceDefaultGID</a>
40 <li><a href="#LDAPForceDefaultUID">LDAPForceDefaultUID</a>
41 <li><a href="#LDAPForceGeneratedHomedir">LDAPForceGeneratedHomedir</a>
42 <li><a href="#LDAPGenerateHomedir">LDAPGenerateHomedir</a>
43 <li><a href="#LDAPGenerateHomedirPrefix">LDAPGenerateHomedirPrefix</a>
44 <li><a href="#LDAPGenerateHomedirPrefixNoUsername">LDAPGenerateHomedirPrefixNoUsername</a>
45 <li><a href="#LDAPGroups">LDAPGroups</a>
46 <li><a href="#LDAPLog">LDAPLog</a>
47 <li><a href="#LDAPProtocolVersion">LDAPProtocolVersion</a>
48 <li><a href="#LDAPQueryTimeout">LDAPQueryTimeout</a>
49 <li><a href="#LDAPSearchScope">LDAPSearchScope</a>
50 <li><a href="#LDAPServer">LDAPServer</a>
51 <li><a href="#LDAPUsers">LDAPUsers</a>
52 <li><a href="#LDAPUseSASL">LDAPUseSASL</a>
53 <li><a href="#LDAPUseTLS">LDAPUseTLS</a>
54 </ul>
55
56 <hr>
57 <h3><a name="LDAPAliasDereference">LDAPAliasDereference</a></h3>
58 <strong>Syntax:</strong> LDAPAliasDereference <em>never|always|search|find</em><br>
59 <strong>Default:</strong> None<br>
60 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
61 <strong>Module:</strong> mod_ldap<br>
62 <strong>Compatibility:</strong> 1.2.7rc1 and later
63
64 <p>
65 The <code>LDAPAliasDereference</code> directive configures how aliases are
66 handled. The possible values have the following behaviors:
67 <ul>
68 <li><em>never</em>
69 <p>
70 Never dereference aliases
71 </li>
72
73 <p>
74 <li><em>always</em>
75 <p>
76 Always dereference aliases
77 </li>
78
79 <p>
80 <li><em>search</em>
81 <p>
82 Dereference aliases only when searching
83 </li>
84
85 <p>
86 <li><em>find</em>
87 <p>
88 Dereference aliases only when locating the base object for the search
89 </li>
90 </ul>
91
92 <p>
93 The default is "never", <i>e.g.</i>:
94 <pre>
95 &lt;IfModule mod_ldap.c&gt;
96 LDAPAliasDeference never
97 &lt;/IfModule&gt;
98 </pre>
99
100 <p>
101 <hr>
102 <h3><a name="LDAPAttr">LDAPAttr</a></h3>
103 <strong>Syntax:</strong> LDAPAttr <em>old-attr-name new-attr-name</em><br>
104 <strong>Default:</strong> None<br>
105 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
106 <strong>Module:</strong> mod_ldap<br>
107 <strong>Compatibility:</strong> 1.2.7rc1 and later
108
109 <p>
110 The <code>LDAPAttr</code> directive is used to map, or to associate, a standard
111 attribute name to a non-standard attribute name. If, for example, your
112 LDAP directory schema used different names for some of the attributes used
113 by <code>mod_ldap</code>, you would use this directive to tell
114 <code>mod_ldap</code> what new attribute names to use.
115
116 <p>
117 The following LDAP attributes can be renamed in this manner:
118 <ul>
119 <li><code>uid</code>
120 <li><code>uidNumber</code>
121 <li><code>gidNumber</code>
122 <li><code>homeDirectory</code>
123 <li><code>userPassword</code>
124 <li><code>loginShell</code>
125 <li><code>cn</code>
126 <li><code>memberUid</code>
127 <li><code>ftpQuota</code>
128 </ul>
129
130 <p>
131 <hr>
132 <h3><a name="LDAPAuthBinds">LDAPAuthBinds</a></h3>
133 <strong>Syntax:</strong> LDAPAuthBinds <em>on|off</em><br>
134 <strong>Default:</strong> LDAPAuthBinds on<br>
135 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
136 <strong>Module:</strong> mod_ldap<br>
137 <strong>Compatibility:</strong> 1.2.7rc1 and later
138
139 <p>
140 By default, the DN specified by the
141 <a href="#LDAPBindDN"><code>LDAPBindDN</code></a> will be used to bind to the
142 LDAP server to obtain user information, including the <code>userPassword</code>
143 attribute. If <code>LDAPAuthBinds</code> is set to <em>on</em>, the DN
144 specified by <code>LDAPDNInfo</code> will be used to fetch all user information
145 <i>except</i> the <code>userPassword</code> attribute. Then, the
146 <code>mod_ldap</code> module will bind to the LDAP server as the user who is
147 logging in via FTP with the user-supplied password. If this bind succeeds,
148 the user is considered authenticated and is allowed to log in. This method of
149 LDAP authentication has the added benefit of supporting any password encryption
150 scheme that your LDAP server supports.
151
152 <p>
153 In versions of <code>mod_ldap</code> up to 2.7.6, the default for
154 <code>LDAPAuthBinds</code> was <em>off</em>. After <code>mod_ldap</code> 2.8,
155 the default value for <code>LDAPAuthBinds</code> is <em>on</em>.
156
157 <p>
158 <hr>
159 <h3><a name="LDAPBindDN">LDAPBindDN</a></h3>
160 <strong>Syntax:</strong> LDAPBindDN <em>dn password</em><br>
161 <strong>Default:</strong> None<br>
162 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
163 <strong>Module:</strong> mod_ldap<br>
164 <strong>Compatibility:</strong> 1.3.5rc1 and later
165
166 <p>
167 The <code>LDAPBindDN</code> directive configures the <em>DN</em> and the
168 <em>password</em> that <code>mod_ldap</code> will use when binding to the LDAP
169 directory. If this configuration directive is missing, then anonymous binds
170 are used.
171
172 <p>
173 The default is:
174 <pre>
175 &lt;IfModule mod_ldap.c&gt;
176 # Use anonymous binds
177 LDAPBindDN "" ""
178 &lt;/IfModule&gt;
179 </pre>
180
181 <p>
182 See also: <a href="#LDAPServer"><code>LDAPServer</code></a>, <a href="#LDAPUseSASL"><code>LDAPUseSASL</code></a>
183
184 <p>
185 <hr>
186 <h3><a name="LDAPConnectTimeout">LDAPConnectTimeout</a></h3>
187 <strong>Syntax:</strong> LDAPConnectTimeout <em>secs</em><br>
188 <strong>Default:</strong> None<br>
189 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
190 <strong>Module:</strong> mod_ldap<br>
191 <strong>Compatibility:</strong> 1.3.8rc3 and later
192
193 <p>
194 The <code>LDAPConnectTimeout</code> directive configures the timeout value,
195 in seconds, that will be used when connecting to LDAP servers. The default
196 timeout value is determined by your LDAP API.
197
198 <p>
199 <hr>
200 <h3><a name="LDAPDefaultAuthScheme">LDAPDefaultAuthScheme</a></h3>
201 <strong>Syntax:</strong> LDAPDefaultAuthScheme <em>"crypt"|"clear"</em><br>
202 <strong>Default:</strong> crypt<br>
203 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
204 <strong>Module:</strong> mod_ldap<br>
205 <strong>Compatibility:</strong> 1.2.7rc1 and later
206
207 <p>
208 The <code>LDAPDefaultAuthScheme</code> directive specifies the authentication
209 scheme used for passwords which have no "{hashname}" prefix in the LDAP
210 directory. For example, if you have:
211 <pre>
212 userPassword <em>mypass</em>
213 </pre>
214 in your directory, you would want to set <code>LDAPDefaultAuthScheme</code>
215 to <em>"clear"</em>, <i>e.g.</i>:
216 <pre>
217 LDAPDefaultAuthScheme clear
218 </pre>
219
220 <p>
221 The default value is <em>"crypt"</em>.
222
223 <p>
224 <hr>
225 <h3><a name="LDAPDefaultGID">LDAPDefaultGID</a></h3>
226 <strong>Syntax:</strong> LDAPDefaultGID <em>gid</em><br>
227 <strong>Default:</strong> None<br>
228 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
229 <strong>Module:</strong> mod_ldap<br>
230 <strong>Compatibility:</strong> 1.2.7rc1 and later
231
232 <p>
233 The <code>LDAPDefaultGID</code> directive sets the default GID to be used
234 for users when no <code>gidNumber</code> attribute is found for that user.
235 If the <em>gid</em> parameter is "Auto", then the system
236 <code>getpwnam(3)</code> function will be used to "automatically" determine
237 the GID value for this user. This "automatic" functionality is useful for
238 <i>e.g.</i> Microsoft AD domains in combination with <code>sssd</code>.
239
240 <p>
241 This directive is useful primarily in virtual user environments common in
242 large-scale ISPs and hosting organizations. If a user does not have an LDAP
243 <code>gidNumber</code> attribute, the <code>LDAPDefaultGID</code> is used.
244 This allows one to have a large number of users in an LDAP directory without
245 <code>gidNumber</code> attributes; setting this configuration directive will
246 automatically assign those users a single GID.
247
248 <p>
249 See also: <a href="#LDAPDefaultUID"><code>LDAPDefaultUID</code></a>
250
251 <p>
252 <hr>
253 <h3><a name="LDAPDefaultQuota">LDAPDefaultQuota</a></h3>
254 <strong>Syntax:</strong> LDAPDefaultQuota <em>default-quota</em><br>
255 <strong>Default:</strong> None<br>
256 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
257 <strong>Module:</strong> mod_ldap<br>
258 <strong>Compatibility:</strong> 1.3.5rc1 and later
259
260 <p>
261 The <code>LDAPDefaultQuota</code> directive configures a <em>default-quota</em>
262 to use if a user does not have an <code>ftpQuota</code> attribute. This
263 parameter is formatted the same way as the <code>ftpQuota</code> LDAP attribute.
264
265 <p>
266 <hr>
267 <h3><a name="LDAPDefaultUID">LDAPDefaultUID</a></h3>
268 <strong>Syntax:</strong> LDAPDefaultUID <em>uid</em><br>
269 <strong>Default:</strong> None<br>
270 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
271 <strong>Module:</strong> mod_ldap<br>
272 <strong>Compatibility:</strong> 1.2.7rc1 and later
273
274 <p>
275 The <code>LDAPDefaultUID</code> directive sets the default UID to be used
276 for users when no <code>uidNumber</code> attribute is found for that user.
277 If the <em>uid</em> parameter is "Auto", then the system
278 <code>getpwnam(3)</code> function will be used to "automatically" determine
279 the UID value for this user. This "automatic" functionality is useful for
280 <i>e.g.</i> Microsoft AD domains in combination with <code>sssd</code>.
281
282 <p>
283 This directive is useful primarily in virtual user environments common in
284 large-scale ISPs and hosting organizations. If a user does not have an LDAP
285 <code>uidNumber</code> attribute, the <code>LDAPDefaultGID</code> is used.
286 This allows one to have a large number of users in an LDAP directory without
287 <code>uidNumber</code> attributes; setting this configuration directive will
288 automatically assign those users a single UID.
289
290 <p>
291 By default, the search filter template used is:
292 <pre>
293 (&amp;(uid=%v)(objectclass=posixAccount))
294 </pre>
295 The <em>uid</em> for the the search filter is taken from the
296 <code>LDAPAttr</code> directive. Search filter templates are only supported
297 in versions of <code>mod_ldap</code> 2.7 and later.
298
299 <p>
300 See also: <a href="#LDAPAttr"><code>LDAPAttr</code></a>, <a href="#LDAPDefaultGID"><code>LDAPDefaultGID</code></a>
301
302 <p>
303 <hr>
304 <h3><a name="LDAPForceDefaultGID">LDAPForceDefaultGID</a></h3>
305 <strong>Syntax:</strong> LDAPForceDefaultGID <em>on|off</em><br>
306 <strong>Default:</strong> None<br>
307 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
308 <strong>Module:</strong> mod_ldap<br>
309 <strong>Compatibility:</strong> 1.2.7rc1 and later
310
311 <p>
312 Even when a <a href="#LDAPDefaultGID"><code>LDAPDefaultGID</code></a> is
313 configured, the <code>mod_ldap</code> module will allow individual users to
314 have <code>gidNumber</code> attributes that will override this default GID.
315 With <code>LDAPForceDefaultGID</code> directive configured to be <em>on</em>,
316 all LDAP-authenticated users are given the default GID; GIDs may not be
317 overridden by <code>gidNumber</code> attributes.
318
319 <p>
320 <hr>
321 <h3><a name="LDAPForceDefaultUID">LDAPForceDefaultUID</a></h3>
322 <strong>Syntax:</strong> LDAPForceDefaultUID <em>on|off</em><br>
323 <strong>Default:</strong> None<br>
324 <strong>Context:</strong> server config<br>
325 <strong>Module:</strong> mod_ldap<br>
326 <strong>Compatibility:</strong> 1.2.7rc1 and later
327
328 <p>
329 Even when a <a href="#LDAPDefaultUID"><code>LDAPDefaultUID</code></a> is
330 configured, the <code>mod_ldap</code> module will allow individual users to
331 have <code>uidNumber</code> attributes that will override this default UID.
332 With <code>LDAPForceDefaultUID</code> directive configured to be <em>on</em>,
333 all LDAP-authenticated users are given the default UID; UIDs may not be
334 overridden by <code>uidNumber</code> attributes.
335
336 <p>
337 <hr>
338 <h3><a name="LDAPForceGeneratedHomedir">LDAPForceGeneratedHomedir</a></h3>
339 <strong>Syntax:</strong> LDAPForceGeneratedHomedir <em>off|on</em><br>
340 <strong>Default:</strong> None<br>
341 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code
342 >&lt;Global&gt;</code><br>
343 <strong>Module:</strong> mod_ldap<br>
344 <strong>Compatibility:</strong> 1.2.7rc1 and later
345
346 <p>
347 When no <code>homeDirectory</code> attribute is found, the <code>mod_ldap</code>
348 module can be configured to <em>generate</em> a home directory using the
349 <a href="#LDAPGenerateHomedir"><code>LDAPGenerateHomedir</code></a> directive.
350 If there <i>is</i> a <code>homeDirectory</code> attribute present, however,
351 the <code>mod_ldap</code> module will use that attribute value as the home
352 directory.
353
354 <p>
355 However, there may be cases where the administrator wishes to <em>override</em>
356 the <code>homeDirectory</code> attribute, and thus to <i>always</i> use the
357 home directory value that <code>mod_ldap</code> would generate. The
358 <code>LDAPForceGeneratedHomedir</code> directive is used in such cases.
359
360 <p>
361 For example, assume that the user logging in is named "tj", and has an
362 LDAP object whose <code>homeDirectory</code> attribute value is "/home/tj".
363 To <em>force</em> the use of <code>mod_ldap</code>'s generated home directory
364 instead of that <code>homeDirectory</code> value, the configuration might
365 look like:
366 <pre>
367 LDAPForceGeneratedHomedir on
368 LDAPGenerateHomedir on
369 LDAPGenerateHomedirPrefix /var/ftp
370 </pre>
371 Using the above configuration, the home directory that the
372 <code>mod_ldap</code> module would use is <code>/var/ftp/tj</code>, despite
373 what <code>homeDirectory</code> attribute may be in the LDAP directory.
374
375 <p>
376 <b>Note</b> that if <code>LDAPForceGeneratedHomedir</code> is enabled, then
377 <code>LDAPGenerateHomedir</code> must <b>also</b> be enabled. It is an error
378 to enable <code>LDAPForceGeneratedHomedir</code> without also enabling
379 <code>LDAPGenerateHomdir</code>.
380
381 <p>
382 See also: <a href="#LDAPGenerateHomedir"><code>LDAPGenerateHomedir</code></a>, <a href="#LDAPGenerateHomedirPrefix"><code>LDAPGenerateHomedirPrefix</code></a>, <a href="#LDAPGenerateHomedirPrefixNoUsername"><code>LDAPGenerateHomedirPrefixNoUsername</code></a>
383
384 <p>
385 <hr>
386 <h3><a name="LDAPGenerateHomedir">LDAPGenerateHomedir</a></h3>
387 <strong>Syntax:</strong> LDAPGenerateHomedir <em>on|off</em><br>
388 <strong>Default:</strong> None<br>
389 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
390 <strong>Module:</strong> mod_ldap<br>
391 <strong>Compatibility:</strong> 1.2.7rc1 and later
392
393 <p>
394 By default, the <code>mod_ldap</code> module uses the <code>homeDirectory</code>
395 attribute to determine what home directory to use for the session. Sometimes,
396 however, an administrator will want to use a <i>different</i> home directory
397 for these FTP/SFTP sessions, something other than the path in the
398 <code>homeDirectory</code> attribute. The <code>LDAPGenerateHomedir</code>
399 directive is used for situations like this.
400
401 <p>
402 The <code>LDAPGenerateHomedir</code> directive configures the
403 <code>mod_ldap</code> module to "generate" a new home directory value,
404 <em>overriding</em> the value from the <code>homeDirectory</code> attribute.
405 The generated home directory value <b>requires</b> that a starting point
406 for the new home directory, a "prefix", also be provided using the
407 <a href="#LDAPGenerateHomedirPrefix"><code>LDAPGenerateHomedirPrefix</code></a>
408 directive.
409
410 <p>
411 The <code>LDAPGenerateHomedir</code> directives does <b>not</b> cause the
412 new home directory to be <em>created on the filesystem</em>. It only changes
413 the home directory value that the <code>mod_ldap</code> module provides to
414 the ProFTPD engine. The <i>creation</i> of the home directory, if it does
415 not already exist, is done using the
416 <a href="../howto/CreateHome.html"><code>CreateHome</code></a> directive.
417
418 <p>
419 See also: <a href="#LDAPGenerateHomedirPrefix"><code>LDAPGenerateHomedirPrefix</code></a>, <a href="#LDAPGenerateHomedirPrefixNoUsername"><code>LDAPGenerateHomedirPrefixNoUsername</code></a>
420
421 <p>
422 <hr>
423 <h3><a name="LDAPGenerateHomedirPrefix">LDAPGenerateHomedirPrefix</a></h3>
424 <strong>Syntax:</strong> LDAPGenerateHomedirPrefix <em>prefix</em><br>
425 <strong>Default:</strong> None<br>
426 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
427 <strong>Module:</strong> mod_ldap<br>
428 <strong>Compatibility:</strong> 1.2.7rc1 and later
429
430 <p>
431 The <code>LDAPGenerateHomedirPrefix</code> directive is used when
432 <code>LDAPGenerateHomedir</code> is enabled, causing the <code>mod_ldap</code>
433 module to <em>generate</em> a <b>default</b> home directory, when the
434 <code>homeDirectory</code> attribute value is not present. The generated home
435 directory value like this:
436 <pre>
437 <i>prefix</i>/<i>username</i>
438 </pre>
439 The configured <em>prefix</em> string has the username (from the
440 <code>uid</code> attribute) appended to generate the home directory value for
441 the user.
442
443 <p>
444 For example:
445 <pre>
446 LDAPGenerateHomedir on
447 LDAPGenerateHomedirPrefix /var/ftp
448 </pre>
449 Using the above configuration, and assuming a user name of "tj", the home
450 directory that the <code>mod_ldap</code> module would use is
451 <code>/var/ftp/tj</code>, no matter what the <code>homeDirectory</code>
452 attribute may be in the LDAP directory.
453
454 <p>
455 See also: <a href="#LDAPForceGeneratedHomedir"><code>LDAPForceGeneratedHomedir</code></a>, <a href="#LDAPGenerateHomedir"><code>LDAPGenerateHomedir</code></a>, <a href="#LDAPGenerateHomedirPrefixNoUsername"><code>LDAPGenerateHomedirPrefixNoUsername</code></a>
456
457 <p>
458 <hr>
459 <h3><a name="LDAPGenerateHomedirPrefixNoUsername">LDAPGenerateHomedirPrefixNoUsername</a></h3>
460 <strong>Syntax:</strong> LDAPGenerateHomedirPrefixNoUsername <em>on|off</em><br>
461 <strong>Default:</strong> None<br>
462 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
463 <strong>Module:</strong> mod_ldap<br>
464 <strong>Compatibility:</strong> 1.2.7rc1 and later
465
466 <p>
467 When the <a href="#LDAPGenerateHomedir"><code>LDAPGenerateHomedir</code></a>
468 and <a href="#LDAPGenerateHomedirPrefix"><code>LDAPGenerateHomedirPrefix</code></a> directives are used, the <em>generated</em> home directory value for
469 the session is:
470 <pre>
471 <i>prefix</i>/<i>username</i>
472 </pre>
473 However, there may be cases where the administrator does <b>not</b> want
474 the username automatically appended to the generated value, and instead wishes
475 to use <i>just</i> the prefix as the home directory. For these use cases,
476 use the <code>LDAPGenerateHomedirPrefixNoUsername</code> directive.
477
478 <p>
479 For example:
480 <pre>
481 LDAPGenerateHomedir on
482 LDAPGenerateHomedirPrefix /var/ftp
483 LDAPGenerateHomedirPrefixNoUsername on
484 </pre>
485 Using the above configuration, and assuming a user name of "tj", the home
486 directory that the <code>mod_ldap</code> module would use is
487 <code>/var/ftp</code>, no matter what the <code>homeDirectory</code> attribute
488 may be in the LDAP directory.
489
490 <p>
491 See also: <a href="#LDAPGenerateHomedir"><code>LDAPGenerateHomedir</code></a>, <a href="#LDAPGenerateHomedirPrefix"><code>LDAPGenerateHomedirPrefix</code></a>
492
493 <p>
494 <hr>
495 <h3><a name="LDAPGroups">LDAPGroups</a></h3>
496 <strong>Syntax:</strong> LDAPGroups <em>base-dn cn-filter-template gid-number-filter-template member-uid-filter-template</em><br>
497 <strong>Default:</strong> None<br>
498 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
499 <strong>Module:</strong> mod_ldap<br>
500 <strong>Compatibility:</strong> 1.3.5rc1 and later
501
502 <p>
503 The <code>LDAPGroups</code> directive activates LDAP GID-to-name lookups for
504 directory listings. The first parameter to this directive is the LDAP
505 <em>base DN</em> to use for GID-to-name lookups. The second through fourth
506 optional parameters are templates to be used for the search filter;
507 <code>%v</code> will be replaced with the GID that is being looked up.
508
509 <p>
510 By default, the CN filter template look like this:
511 <pre>
512 (&amp;(LDAPAttr_cn=%v)(objectclass=posixGroup))
513 </pre>
514 The <code>gidNumber</code> filter template is:
515 <pre>
516 (&amp;(LDAPAttr_gidNumber=%v)(objectclass=posixGroup))
517 </pre>
518 and the <code>memberUid</code> filter template used is:
519 <pre>
520 (&amp;(LDAPAttr_memberUid=%v)(objectclass=posixGroup))
521 </pre>
522 Note that filter templates are only supported in <code>mod_ldap</code>
523 version 2.8.3 and later.
524
525 <p>
526 The attribute names used in the default search filters are taken from the
527 <a href="#LDAPAttr"><code>LDAPAttr</code></a> directive.
528
529 <p>
530 <hr>
531 <h3><a name="LDAPLog">LDAPLog</a></h3>
532 <strong>Syntax:</strong> LDAPLog <em>file|"none"</em><br>
533 <strong>Default:</strong> <em>None</em><br>
534 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
535 <strong>Module:</strong> mod_ldap<br>
536 <strong>Compatibility:</strong> 1.3.5rc4 and later
537
538 <p>
539 The <code>LDAPLog</code> directive is used to specify a log file for
540 <code>mod_ldap</code>'s reporting on a per-server basis. The <em>file</em>
541 parameter given must be the full path to the file to use for logging.
542
543 <p>
544 Note that this path must <b>not</b> be to a world-writable directory and,
545 unless <code>AllowLogSymlinks</code> is explicitly set to <em>on</em>
546 (generally a bad idea), the path must <b>not</b> be a symbolic link.
547
548 <p>
549 <hr>
550 <h3><a name="LDAPProtocolVersion">LDAPProtocolVersion</a></h3>
551 <strong>Syntax:</strong> LDAPProtocolVersion <em>2|3</em><br>
552 <strong>Default:</strong> None<br>
553 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
554 <strong>Module:</strong> mod_ldap<br>
555 <strong>Compatibility:</strong> 1.2.7rc1 and later
556
557 <p>
558 The <code>LDAPProtocolVersion</code> directive configures the version of
559 the LDAP protocol that <code>mod_ldap</code> will use when talking to the
560 LDAP servers. The default protocol version used is <em>3</em>.
561
562 <p>
563 <hr>
564 <h3><a name="LDAPQueryTimeout">LDAPQueryTimeout</a></h3>
565 <strong>Syntax:</strong> LDAPQueryTimeout <em>secs</em><br>
566 <strong>Default:</strong> None<br>
567 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
568 <strong>Module:</strong> mod_ldap<br>
569 <strong>Compatibility:</strong> 1.2.7rc1 and later
570
571 <p>
572 The <code>LDAPQueryTimeout</code> directive configures the timeout value,
573 in seconds, that will be used for LDAP directory queries. The default timeout
574 value is determined by your LDAP API.
575
576 <p>
577 <hr>
578 <h3><a name="LDAPSearchScope">LDAPSearchScope</a></h3>
579 <strong>Syntax:</strong> LDAPSearchScope <em>base|onelevel|subtree</em><br>
580 <strong>Default:</strong> None<br>
581 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
582 <strong>Module:</strong> mod_ldap<br>
583 <strong>Compatibility:</strong> 1.2.7rc1 and later
584
585 <p>
586 The <code>LDAPSearchScope</code> directive is used to set the scope used for
587 LDAP searches. The default setting, <em>subtree</em>, searches for all entries
588 in the tree from the current level down. Setting this directive to
589 <em>onelevel</em> searches only one level deep in the LDAP tree.
590
591 <p>
592 <b>Note</b> that the <code>LDAPSearchScope</code> directive <b>cannot</b> be
593 used when the LDAP URL syntax, rather than hostname/port, is used for your
594 <a href="#LDAPServer"><code>LDAPServer</code></a> configuration. Why not?
595 The search scope can be specified as part of the URL itself. This, combined
596 with the fact that the <code>LDAPServer</code> directive can take
597 <i>multiple</i> hosts/URLs, makes it clear to include the search scope in the
598 URLs as needed.
599
600 <p>
601 If you are <b>not</b> using the LDAP URL syntax, then the following will
602 use the <em>subtree</em> search scope:
603 <pre>
604 LDAPServer ldap.example.com
605 </pre>
606 or, to make it explicit in your configuration:
607 <pre>
608 LDAPServer ldap.example.com
609 LDAPSearchScope subtree
610 </pre>
611 On the other hand, if you <b>are</b> using LDAP URLs, then you specify the
612 search scope as part of the URL:
613 <pre>
614 LDAPServer ldap://ldap.example.com/??sub
615 </pre>
616 It is <b>important</b> that the "/" after the hostname/port be part of your
617 LDAP URL when specifying the search scope. That is, using:
618 <pre>
619 LDAPServer ldap://ldap.example.com??sub
620 </pre>
621 <b>will not work as expected</b>; see
622 <a href="https://tools.ietf.org/html/rfc2255">RFC 2255</a>, Section 3. LDAP
623 URL parameters are <b>not</b> like HTTP URL query parameters; LDAP URL
624 parameters <b>are</b> order-specific. And the "/" before any of the
625 optional parameters <b>is required</b>.
626
627 <p>
628 <hr>
629 <h3><a name="LDAPServer">LDAPServer</a></h3>
630 <strong>Syntax:</strong> LDAPServer <em>url1|host1:port1 url2|host2:port2 [ssl-ca:&lt;path&gt;] [ssl-cert:&lt;path&gt;] [ssl-key:&lt;path&gt;] [ssl-ciphers:&lt;list&gt;] [ssl-verify:boolean]</em><br>
631 <strong>Default:</strong> None<br>
632 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
633 <strong>Module:</strong> mod_ldap<br>
634 <strong>Compatibility:</strong> 1.2.7rc1 and later
635
636 <p>
637 The <code>LDAPServer</code> directive allows you to to specify the hostname(s)
638 and port(s) of the LDAP server(s) to use for LDAP authentication. If no
639 <code>LDAPServer</code> configuration directive is present, the default LDAP
640 servers specified by your LDAP library will be used. Note that the LDAP
641 URL syntax may also be used.
642
643 <p>
644 To specify multiple LDAP servers, you can configure the entire list of servers
645 on one line:
646 <pre>
647 # Using just hostname/port
648 LDAPServer host1:port1 host2:port2
649 </pre>
650 or:
651 <pre>
652 # Using the URL syntax
653 LDAPServer url1 url2
654 </pre>
655 In ProFTPD 1.3.7rc4 and later, you can also use multiple <code>LDAPServer</code>
656 directives as well, <i>e.g.</i>:
657 <pre>
658 LDAPServer host1:port1
659 LDAPServer url1
660 LDAPServer host2
661 LDAPServer url2
662 </pre>
663
664 <p>
665 The default search scope for LDAP URLs is "base" (unless a scope is explicitly
666 provided in the URL). This behavior differs from the
667 <a href="#LDAPSearchScope"><code>LDAPSearchScope</code></a> directive, which
668 defaults to "subtree".
669
670 <p>
671 <b>Note</b> that to use LDAPS (LDAP over SSL), you <b>must</b> use the
672 <em>URL</em> format, <i>e.g.</i>:
673 <pre>
674 LDAPServer ldaps://host1:port1 ldaps://host2:port2
675 </pre>
676
677 <p>
678 However, LDAPS is deprecated. Instead, LDAP prefers the
679 <a href="https://en.wikipedia.org/wiki/STARTTLS">STARTTLS</a> mechanism. To
680 enable use of STARTTLS for your LDAP connections, use the
681 <a href="#LDAPUseTLS"><code>LDAPUseTLS</code></a> directive, <i>e.g.</i>:
682 <pre>
683 LDAPServer ldap://host1:port1 ldap://host2:port2
684 LDAPUseTLS on
685 </pre>
686
687 <p>
688 In ProFTPD 1.3.7rc4 and later, it is possible to configure SSL/TLS parameters
689 for a given connection. Most of the time, all that is needed for the SSL
690 session is the CA (Certificate Authority) to use, for verifying the
691 certificate presented by the LDAP server, using the <em>ssl-ca:</em> parameter.
692 Thus:
693 <pre>
694 LDAPServer ... ssl-ca:/path/to/cacert.pem
695 </pre>
696 If your LDAP server is configured to require SSL/TLS mutual authentication
697 (also called "client auth"), you may need the <em>ssl-cert:</em> and
698 <em>ssl-key:</em> parameters as well:
699 <pre>
700 LDAPServer ... ssl-ca:/path/to/cacert.pem \
701 ssl-cert:/path/to/client-cert.pem \
702 ssl-key:/path/to/client-key.pem
703 </pre>
704 Finally, you may want to configure the specific SSL/TLS ciphersuites that
705 should be used; the <em>ssl-ciphers:</em> parameter can be used for this:
706 <pre>
707 LDAPServer ... ssl-ca:/path/to/cacert.pem \
708 ssl-cert:/path/to/client-cert.pem \
709 ssl-key:/path/to/client-key.pem \
710 ssl-ciphers:DEFAULT:!EXPORT:!DES
711 </pre>
712
713 <p>
714 If there is an issue with the server certificate presented by your LDAP
715 server, <b>but</b> you need to create the SSL/TLS session anyway, you can
716 relax the certificate verification requirements using the <em>ssl-verify:</em>
717 parameter, <i>e.g.</i>:
718 <pre>
719 LDAPServer ... ssl-ca:/path/to/cacert.pem \
720 ssl-verify:off
721 </pre>
722
723 <p>
724 <hr>
725 <h3><a name="LDAPUsers">LDAPUsers</a></h3>
726 <strong>Syntax:</strong> LDAPUsers <em>base-dn [name-filter-template [uid-filter-template]]</em><br>
727 <strong>Default:</strong> None<br>
728 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
729 <strong>Module:</strong> mod_ldap<br>
730 <strong>Compatibility:</strong> 1.3.5rc1 and later
731
732 <p>
733 The <code>LDAPUsers</code> directive activates LDAP UID-to-name lookups
734 for directory listings. The first parameter to this directive is the LDAP
735 <em>base DN</em> to use for UID-to-name lookups. The optional second parameter
736 is a template to be used for the search filter for the username; <code>%v</code>
737 will be replaced with the UID that is being looked up. Similarly, an optional
738 third parameter is also a template, to be used for the search filter for
739 the UID.
740
741 <p>
742 By default, the name search filter template looks like this:
743 <pre>
744 (&amp;(uid=%v)(objectclass=posixAccount))
745 </pre>
746 and the UID search filter template looks like this:
747 <pre>
748 (&amp;(LDAPAttr_uidNumber=%v)(objectclass=posixGroup))
749 </pre>
750 The <em>uidNumber</em> attribute name used in the search filter comes from
751 the <a href="#LDAPAttr"><code>LDAPAttr</code></a> directive.
752 Note that filter templates are only supported in <code>mod_ldap</code>
753 version 2.7 and later.
754
755 <p>
756 <hr>
757 <h3><a name="LDAPUseSASL">LDAPUseSASL</a></h3>
758 <strong>Syntax:</strong> LDAPUseSASL <em>mech1 ...</em><br>
759 <strong>Default:</strong> None<br>
760 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
761 <strong>Module:</strong> mod_ldap<br>
762 <strong>Compatibility:</strong> 1.3.7rc4 and later
763
764 <p>
765 The <code>LDAPUseSASL</code> directive tells the <code>mod_ldap</code> module
766 to use the configured space-separated list of
767 <a href="https://ldapwiki.com/wiki/SASL">SASL</a> (Simple Authentication and
768 Security Layer) mechanisms, when using the
769 <a href="#LDAPBindDN"><code>LDAPBindDN</code></a> to talk to the LDAP server.
770 By default, <em>simple</em> binds are done to the LDAP server.
771
772 <p>
773 The currently supported mechanisms are:
774 <ul>
775 <li>ANONYMOUS
776 <li>CRAM-MD5
777 <li>DIGEST-MD5
778 <li>LOGIN
779 <li>PLAIN
780 <li>SCRAM-SHA-1
781 </ul>
782 The order in which the mechanisms are configured matters; the first one
783 selected by the LDAP server wins.
784
785 <p>
786 <b>Note</b> that a SASL mechanism configured here may still be rejected by
787 the LDAP server, if the server-side policies for authentication are not met.
788 Indeed, some SASL mechanisms may only be allowed by the server <i>if</i> used
789 in conjunction with SSL/TLS; this is a common requirement for using the
790 <code>LOGIN</code> and <code>PLAIN</code> mechanisms.
791
792 <p>
793 Thus a good default configuration, using TLS <i>and</i> SASL, might be:
794 <pre>
795 &lt;IfModule mod_ldap.c&gt;
796 LDAPServer ldap.example.com
797 LDAPBindDN CN=readonly,DC=example,DC=com ...
798 LDAPUseSASL SCRAM-SHA-1 DIGEST-MD5
799 LDAPUseTLS on
800 &lt;/IfModule&gt;
801 </pre>
802
803 <p>
804 <hr>
805 <h3><a name="LDAPUseTLS">LDAPUseTLS</a></h3>
806 <strong>Syntax:</strong> LDAPUseTLS <em>on|off</em><br>
807 <strong>Default:</strong> off<br>
808 <strong>Context:</strong> server config, <code>&lt;VirtualHost&gt;</code>, <code>&lt;Global&gt;</code><br>
809 <strong>Module:</strong> mod_ldap<br>
810 <strong>Compatibility:</strong> 1.2.7rc1 and later
811
812 <p>
813 The <code>LDAPUseTLS</code> directive configures whether <code>mod_ldap</code>
814 will use SSL/TLS via <a href="https://en.wikipedia.org/wiki/STARTTLS">STARTTLS</a> to protect the connections made to the configured LDAP servers.
815
816 <p>
817 By default, the <code>mod_ldap</code> module connects to the LDAP server via
818 non-encrypted connections. Enabling this option causes <code>mod_ldap</code>
819 to use an encrypted (TLS/SSL) connection to the LDAP server. If a secure
820 connection to the LDAP server fails, <code>mod_ldap</code> will not
821 authenticate users; <code>mod_ldap</code> will <b>not</b> fall back to an
822 unsecure connection.
823
824 <p>
825 <hr>
826 <h2><a name="Installation">Installation</a></h2>
827 Follow the normal steps for using third-party modules in ProFTPD:
828 <pre>
829 $ ./configure --with-modules=mod_ldap
830 $ make
831 $ make install
832 </pre>
833 You may need to specify the location of the OpenLDAP header and library files
834 in your <code>configure</code> command, <i>e.g.</i>:
835 <pre>
836 $ ./configure --with-modules=mod_ldap \
837 --with-includes=/usr/local/openldap/include \
838 --with-libraries=/usr/local/openldap/lib
839 </pre>
840
841 <p>
842 <hr>
843 <h2><a name="Usage">Usage</a></h2>
844
845 <p>
846 One <code>mod_ldap</code> user submitted the following configuration for
847 allowing <code>mod_ldap</code> to communicate to a Windows Active Directory
848 server. Note that this configuration has not been tested; if it works for
849 you (or not), please let us know:
850 <pre>
851 &lt;IfModule mod_ldap.c&gt;
852 LDAPServer ldaps://dc.example.org:3268
853 LDAPUseTLS on
854 LDAPAuthBinds on
855 LDAPBindDN "cn=SRV_ACC_SVN_AUTH,ou=special accounts,ou=Sales,dc=example,dc=org" ******************
856
857 LDAPUsers ou=Users,ou=Sales,dc=example,dc=org "(&amp;(sAMAccountName=%u)(objectclass=user)(memberOf=cn=Linux Admins,ou=Groups,ou=Sales,dc=example,dc=com))"
858 LDAPSearchScope subtree
859
860 # Assign default IDs
861 LDAPDefaultUID 106
862 LDAPDefaultGID 65534
863
864 # Create the home directory
865 LDAPGenerateHomedir on
866 LDAPGenerateHomedirPrefix /home
867
868 # Use different attribute names where necessary
869 LDAPAttr uid sAMAccountName
870 LDAPAttr gidNumber primaryGroupID
871 &lt;/IfModule&gt;
872 </pre>
873
874 <p>
875 <b>Logging</b><br>
876 The <code>mod_ldap</code> module supports <a href="../howto/Tracing.html">trace logging</a>, via the module-specific log channels:
877 <ul>
878 <li>ldap
879 <li>ldap.library
880 </ul>
881 Thus for trace logging, to aid in debugging, you would use the following in
882 your <code>proftpd.conf</code>:
883 <pre>
884 TraceLog /path/to/ftpd/trace.log
885 Trace ldap:20
886 </pre>
887 This trace logging can generate large files; it is intended for debugging use
888 only, and should be removed from any production configuration.
889
890 <p><a name="FAQ">
891 <b>Frequently Asked Questions</b><br>
892
893 <p><a name="ScopesFAQ">
894 <font color=red>Question</font>: Why is <code>mod_ldap</code> using a "base"
895 scope by default, rather than "subtree"? I configured:
896 <pre>
897 LDAPSearchScope subtree
898 </pre>
899 but it is not working; I see the following in my LDAP server logs:
900 <pre>
901 slapd[31709]: conn=20239 op=1 SRCH <b>base</b>="ou=people,dc=example,dc=com" scope=0 deref=0 filter="(&amp;(uid=tj)(objectClass=posixAccount))"
902 </pre>
903 <font color=blue>Answer</font>: The use of the "base" scope for searches, in
904 spite of any <code>LDAPSearchScope</code> directive, happens when a URL, rather
905 than hostname/port, are used in the <code>LDAPServer</code> directive. <a href="https://tools.ietf.org/html/rfc2255">RFC 2255</a>, Section 3 specifies that the default scope is "base".
906
907 <p>
908 Thus instead of:
909 <pre>
910 LDAPServer ldap://ldap.example.com
911 </pre>
912 you will need to use:
913 <pre>
914 LDAPServer ldap://ldap.example.com/??sub
915 </pre>
916 See the <a href="#LDAPSearchScope"><code>LDAPSearchScope</code></a>
917 documentation for more details.
918
919 <p><a name="HomedirsFAQ">
920 <font color=red>Question</font>: How do I use <code>LDAPGenerateHomedir</code>
921 and <code>CreateHome</code> together successfully? Can I use <i>just</i>
922 <code>LDAPGenerateHomedir</code>?<br>
923 <font color=blue>Answer</font>: If you want to have home directories for your
924 LDAP users automatically <b>created</b>, you <b>do</b> need to use the
925 <a href="../howto/CreateHome.html"><code>CreateHome</code></a> directive.
926 Whether you <em>need</em> to use the <a href="#LDAPGenerateHomedir"><code>LDAPGenerateHomedir</code></a> directive is a different (but related) question.
927
928 <p>
929 The <code>LDAPGenerateHomedir</code> directive (and its relative <a href="#LDAPForceGeneratedHomedir"><code>LDAPForceGeneratedHomedir</code></a>) should be
930 used <i>when you want to users to have a different home directory than is
931 configured for them in LDAP</i>. They are <b>not</b> used for creating these
932 directories, just generating the paths to use.
933
934 <p>
935 Thus to <i>generate</i> a different home directory for your LDAP-defined users,
936 <i>and</i> to have these different home directories <em>created</em>, you
937 might use something like this:
938 <pre>
939 &lt;IfModule mod_ldap.c&gt;
940 ...
941 LDAPGenerateHomedir on
942 LDAPGenerateHomedirPrefix /data
943 LDAPForceGeneratedHomedir on
944
945 # And make sure these home directories are created
946 CreateHome on 0770 skel /opt/ProFTPD/etc/skel
947 ...
948 &lt;/IfModule&gt;
949 </pre>
950
951 <p><a name="MultipleBindsFAQ">
952 <font color=red>Question</font>: In my LDAP server logs, I see ProFTPD make
953 <i>multiple</i> binds for the same client logging in:
954 <pre>
955 slapd[31709]: conn=20239 op=0 BIND dn="cn=admin,dc=example,dc=com" method=128
956 slapd[31709]: conn=20239 op=0 BIND dn="cn=admin,dc=example,dc=com" mech=SIMPLE ssf=0
957 </pre>
958 I was expecting just <i>one</i> bind. Is this a bug, or is it expected
959 behavior?<br>
960 <font color=blue>Answer</font>: Yes, this <em>is</em> the expected behavior.
961 See the <a href="#LDAPAuthBinds"><code>LDAPAuthBinds</code></a> directive
962 for details.
963
964 <p>
965 <b>Note</b> that you may see <i>additional</i> binds when other modules, such
966 as <code>mod_ifsession</code>, are present in your <code>proftpd</code> build.
967
968 <p>
969 <hr>
970 <font size=2><b><i>
971 &copy; Copyright 2013-2023 TJ Saunders<br>
972 All Rights Reserved<br>
973 </i></b></font>
974 <hr>
975
976 </body>
977 </html>