]> git.sur5r.net Git - openldap/blob - doc/guide/admin/slapdconf2.sdf
Happy New Year!
[openldap] / doc / guide / admin / slapdconf2.sdf
1 # $OpenLDAP$
2 # Copyright 2005-2016 The OpenLDAP Foundation, All Rights Reserved.
3 # COPYING RESTRICTIONS APPLY, see COPYRIGHT.
4
5 H1: Configuring slapd
6
7 Once the software has been built and installed, you are ready
8 to configure {{slapd}}(8) for use at your site.
9
10 OpenLDAP 2.3 and later have transitioned to using a dynamic runtime
11 configuration engine, {{slapd-config}}(5).  {{slapd-config}}(5)
12 * is fully LDAP-enabled
13 * is managed using the standard LDAP operations
14 * stores its configuration data in an {{TERM:LDIF}} database, generally
15 in the {{F:/usr/local/etc/openldap/slapd.d}} directory.
16 * allows all of slapd's configuration options to be changed on the fly,
17 generally without requiring a server restart for the changes
18 to take effect.
19
20 This chapter describes the general format of the {{slapd-config}}(5)
21 configuration system, followed by a detailed description of commonly used
22 settings.
23
24 The older style {{slapd.conf}}(5) file is still supported, but its use
25 is deprecated and support for it will be withdrawn in a future OpenLDAP
26 release.  Configuring {{slapd}}(8) via {{slapd.conf}}(5) is described in
27 the next chapter.
28
29 Refer to {{slapd}}(8) for information on how to have slapd automatically
30 convert from {{slapd.conf}}(5) to {{slapd-config}}(5).
31
32
33 Note: Although the {{slapd-config}}(5) system stores its configuration
34 as (text-based) LDIF files, you should {{1:never}} edit any of
35 the LDIF files directly.  Configuration changes should be performed via LDAP
36 operations, e.g. {{ldapadd}}(1), {{ldapdelete}}(1), or {{ldapmodify}}(1).
37
38
39 Note: You will need to continue to use the older {{slapd.conf}}(5)
40 configuration system if your OpenLDAP installation requires the use of one
41 or more backends or overlays that have not been updated to use the
42 {{slapd-config}}(5) system.  As of OpenLDAP 2.4.33, all of the official
43 backends have been updated.  There may be additional contributed or experimental
44 overlays that also have not been updated.
45
46
47 H2: Configuration Layout
48
49 The slapd configuration is stored as a special LDAP directory with
50 a predefined schema and DIT. There are specific objectClasses used to
51 carry global configuration options, schema definitions, backend and
52 database definitions, and assorted other items. A sample config tree
53 is shown in Figure 5.1.
54
55 !import "config_dit.png"; align="center"; title="Sample configuration tree"
56 FT[align="Center"] Figure 5.1: Sample configuration tree.
57
58 Other objects may be part of the configuration but were omitted from
59 the illustration for clarity.
60
61 The {{slapd-config}} configuration tree has a very specific structure. The
62 root of the tree is named {{EX:cn=config}} and contains global configuration
63 settings. Additional settings are contained in separate child entries:
64 * Dynamically loaded modules
65 .. These may only be used if the {{EX:--enable-modules}} option was
66 used to configure the software.
67 * Schema definitions
68 .. The {{EX:cn=schema,cn=config}} entry contains the system schema (all
69 the schema that is hard-coded in slapd).
70 .. Child entries of {{EX:cn=schema,cn=config}} contain user schema as
71 loaded from config files or added at runtime.
72 * Backend-specific configuration 
73 * Database-specific configuration
74 .. Overlays are defined in children of the Database entry.
75 .. Databases and Overlays may also have other miscellaneous children.
76
77 The usual rules for LDIF files apply to the configuration information:
78 Comment lines beginning with a '{{EX:#}}' character
79 are ignored.  If a line begins with a single space, it is considered a
80 continuation of the previous line (even if the previous line is a
81 comment) and the single leading space is removed. Entries are separated by blank lines.
82
83 The general layout of the config LDIF is as follows:
84
85 >       # global configuration settings
86 >       dn: cn=config
87 >       objectClass: olcGlobal
88 >       cn: config
89 >       <global config settings>
90 >
91 >       # schema definitions
92 >       dn: cn=schema,cn=config
93 >       objectClass: olcSchemaConfig
94 >       cn: schema
95 >       <system schema>
96 >
97 >       dn: cn={X}core,cn=schema,cn=config
98 >       objectClass: olcSchemaConfig
99 >       cn: {X}core
100 >       <core schema>
101 >
102 >       # additional user-specified schema
103 >       ...
104 >
105 >       # backend definitions
106 >       dn: olcBackend=<typeA>,cn=config
107 >       objectClass: olcBackendConfig
108 >       olcBackend: <typeA>
109 >       <backend-specific settings>
110 >
111 >       # database definitions
112 >       dn: olcDatabase={X}<typeA>,cn=config
113 >       objectClass: olcDatabaseConfig
114 >       olcDatabase: {X}<typeA>
115 >       <database-specific settings>
116 >
117 >       # subsequent definitions and settings
118 >       ...
119
120 Some of the entries listed above have a numeric index {{EX:"{X}"}} in
121 their names. While most configuration settings have an inherent ordering
122 dependency (i.e., one setting must take effect before a subsequent one
123 may be set), LDAP databases are inherently unordered. The numeric index
124 is used to enforce a consistent ordering in the configuration database,
125 so that all ordering dependencies are preserved. In most cases the index
126 does not have to be provided; it will be automatically generated based
127 on the order in which entries are created.
128
129 Configuration directives are specified as values of individual
130 attributes.
131 Most of the attributes and objectClasses used in the slapd
132 configuration have a prefix of {{EX:"olc"}} (OpenLDAP Configuration)
133 in their names. Generally there is a one-to-one correspondence
134 between the attributes and the old-style {{EX:slapd.conf}} configuration
135 keywords, using the keyword as the attribute name, with the "olc"
136 prefix attached.
137
138 A configuration directive may take arguments.  If so, the arguments are
139 separated by whitespace.  If an argument contains whitespace,
140 the argument should be enclosed in double quotes {{EX:"like this"}}.
141 In the descriptions that follow, arguments that should be replaced
142 by actual text are shown in brackets {{EX:<>}}.
143
144 The distribution contains an example configuration file that will
145 be installed in the {{F: /usr/local/etc/openldap}} directory.
146 A number of files containing schema definitions (attribute types
147 and object classes) are also provided in the
148 {{F: /usr/local/etc/openldap/schema}} directory.
149
150
151 H2: Configuration Directives
152
153 This section details commonly used configuration directives.  For
154 a complete list, see the {{slapd-config}}(5) manual page.  This section
155 will treat the configuration directives in a top-down order, starting
156 with the global directives in the {{EX:cn=config}} entry. Each
157 directive will be described along with its default value (if any) and
158 an example of its use.
159
160
161 H3: cn=config
162
163 Directives contained in this entry generally apply to the server as a whole.
164 Most of them are system or connection oriented, not database related. This
165 entry must have the {{EX:olcGlobal}} objectClass.
166
167
168 H4: olcIdleTimeout: <integer>
169
170 Specify the number of seconds to wait before forcibly closing
171 an idle client connection.  A value of 0, the default,
172 disables this feature.
173
174
175 H4: olcLogLevel: <level>
176
177 This directive specifies the level at which debugging statements
178 and operation statistics should be syslogged (currently logged to
179 the {{syslogd}}(8) {{EX:LOG_LOCAL4}} facility). You must have
180 configured OpenLDAP {{EX:--enable-debug}} (the default) for this
181 to work (except for the two statistics levels, which are always
182 enabled). Log levels may be specified as integers or by keyword.
183 Multiple log levels may be used and the levels are additive.
184 To display what levels
185 correspond to what kind of debugging, invoke slapd with {{EX:-d?}}
186 or consult the table below. The possible values for <level> are:
187
188 !block table; colaligns="RL"; align=Center; \
189         title="Table 5.1: Debugging Levels"
190 Level   Keyword         Description
191 -1      any             enable all debugging
192 0                       no debugging
193 1       (0x1 trace)     trace function calls
194 2       (0x2 packets)   debug packet handling
195 4       (0x4 args)      heavy trace debugging
196 8       (0x8 conns)     connection management
197 16      (0x10 BER)      print out packets sent and received
198 32      (0x20 filter)   search filter processing
199 64      (0x40 config)   configuration processing
200 128     (0x80 ACL)      access control list processing
201 256     (0x100 stats)   stats log connections/operations/results
202 512     (0x200 stats2)  stats log entries sent
203 1024    (0x400 shell)   print communication with shell backends
204 2048    (0x800 parse)   print entry parsing debugging
205 16384   (0x4000 sync)   syncrepl consumer processing
206 32768   (0x8000 none)   only messages that get logged whatever log level is set
207 !endblock
208
209 The desired log level can be input as a single integer that
210 combines the (ORed) desired levels, both in decimal or in hexadecimal 
211 notation, as a list of integers (that are ORed internally), or as a list of the names that are shown between brackets, such that
212
213 >               olcLogLevel 129
214 >               olcLogLevel 0x81
215 >               olcLogLevel 128 1
216 >               olcLogLevel 0x80 0x1
217 >               olcLogLevel acl trace
218
219 are equivalent.
220
221 \Examples:
222
223 E: olcLogLevel -1
224
225 This will cause lots and lots of debugging information to be
226 logged.
227
228 E: olcLogLevel conns filter
229
230 Just log the connection and search filter processing.
231
232 E: olcLogLevel none
233
234 Log those messages that are logged regardless of the configured loglevel. This
235 differs from setting the log level to 0, when no logging occurs. At least the
236 {{EX:None}} level is required to have high priority messages logged.
237
238 \Default:
239
240 E: olcLogLevel stats
241
242 Basic stats logging is configured by default. However, if no olcLogLevel is
243 defined, no logging occurs (equivalent to a 0 level).
244
245
246 H4: olcReferral <URI>
247
248 This directive specifies the referral to pass back when slapd
249 cannot find a local database to handle a request.
250
251 \Example:
252
253 >       olcReferral: ldap://root.openldap.org
254
255 This will refer non-local queries to the global root LDAP server
256 at the OpenLDAP Project. Smart LDAP clients can re-ask their
257 query at that server, but note that most of these clients are
258 only going to know how to handle simple LDAP URLs that
259 contain a host part and optionally a distinguished name part.
260
261
262 H4: Sample Entry
263
264 >dn: cn=config
265 >objectClass: olcGlobal
266 >cn: config
267 >olcIdleTimeout: 30
268 >olcLogLevel: Stats
269 >olcReferral: ldap://root.openldap.org
270
271
272 H3: cn=module
273
274 If support for dynamically loaded modules was enabled when configuring
275 slapd, {{EX:cn=module}} entries may be used to specify sets of modules to load.
276 Module entries must have the {{EX:olcModuleList}} objectClass.
277
278
279 H4: olcModuleLoad: <filename>
280
281 Specify the name of a dynamically loadable module to load. The filename
282 may be an absolute path name or a simple filename. Non-absolute names
283 are searched for in the directories specified by the {{EX:olcModulePath}}
284 directive.
285
286
287 H4: olcModulePath: <pathspec>
288
289 Specify a list of directories to search for loadable modules. Typically the
290 path is colon-separated but this depends on the operating system.
291
292
293 H4: Sample Entries
294
295 >dn: cn=module{0},cn=config
296 >objectClass: olcModuleList
297 >cn: module{0}
298 >olcModuleLoad: /usr/local/lib/smbk5pwd.la
299 >
300 >dn: cn=module{1},cn=config
301 >objectClass: olcModuleList
302 >cn: module{1}
303 >olcModulePath: /usr/local/lib:/usr/local/lib/slapd
304 >olcModuleLoad: accesslog.la
305 >olcModuleLoad: pcache.la
306
307
308 H3: cn=schema
309
310 The cn=schema entry holds all of the schema definitions that are hard-coded
311 in slapd. As such, the values in this entry are generated by slapd so no
312 schema values need to be provided in the config file. The entry must still
313 be defined though, to serve as a base for the user-defined schema to add
314 in underneath. Schema entries must have the {{EX:olcSchemaConfig}}
315 objectClass.
316
317
318 H4: olcAttributeTypes: <{{REF:RFC4512}} Attribute Type Description>
319
320 This directive defines an attribute type.
321 Please see the {{SECT:Schema Specification}} chapter
322 for information regarding how to use this directive.
323
324
325 H4: olcObjectClasses: <{{REF:RFC4512}} Object Class Description>
326
327 This directive defines an object class.
328 Please see the {{SECT:Schema Specification}} chapter for
329 information regarding how to use this directive.
330
331
332 H4: Sample Entries
333
334 >dn: cn=schema,cn=config
335 >objectClass: olcSchemaConfig
336 >cn: schema
337 >
338 >dn: cn=test,cn=schema,cn=config
339 >objectClass: olcSchemaConfig
340 >cn: test
341 >olcAttributeTypes: ( 1.1.1
342 >  NAME 'testAttr'
343 >  EQUALITY integerMatch
344 >  SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
345 >olcAttributeTypes: ( 1.1.2 NAME 'testTwo' EQUALITY caseIgnoreMatch
346 >  SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.44 )
347 >olcObjectClasses: ( 1.1.3 NAME 'testObject'
348 >  MAY ( testAttr $ testTwo ) AUXILIARY )
349
350
351 H3: Backend-specific Directives
352
353 Backend directives apply to all database instances of the
354 same type and, depending on the directive, may be overridden
355 by database directives. Backend entries must have the
356 {{EX:olcBackendConfig}} objectClass.
357
358 H4: olcBackend: <type>
359
360 This directive names a backend-specific configuration entry.
361 {{EX:<type>}} should be one of the
362 supported backend types listed in Table 5.2.
363
364 !block table; align=Center; coltags="EX,N"; \
365         title="Table 5.2: Database Backends"
366 Types   Description
367 bdb     Berkeley DB transactional backend
368 config  Slapd configuration backend
369 dnssrv  DNS SRV backend
370 hdb     Hierarchical variant of bdb backend
371 ldap    Lightweight Directory Access Protocol (Proxy) backend
372 ldif    Lightweight Data Interchange Format backend
373 meta    Meta Directory backend
374 monitor Monitor backend
375 passwd  Provides read-only access to {{passwd}}(5)
376 perl    Perl Programmable backend
377 shell   Shell (extern program) backend
378 sql     SQL Programmable backend
379 !endblock
380
381 \Example:
382
383 >       olcBackend: bdb
384
385 There are no other directives defined for this entry.  Specific backend
386 types may define additional attributes for their particular use but so
387 far none have ever been defined.  As such, these directives usually do
388 not appear in any actual configurations.
389
390
391 H4: Sample Entry
392
393 > dn: olcBackend=bdb,cn=config
394 > objectClass: olcBackendConfig
395 > olcBackend: bdb
396
397
398 H3: Database-specific Directives
399
400 Directives in this section are supported by every type of database.
401 Database entries must have the {{EX:olcDatabaseConfig}} objectClass.
402
403 H4: olcDatabase: [{<index>}]<type>
404
405 This directive names a specific database instance. The numeric {<index>} may
406 be provided to distinguish multiple databases of the same type. Usually the
407 index can be omitted, and slapd will generate it automatically.
408 {{EX:<type>}} should be one of the
409 supported backend types listed in Table 5.2 or the {{EX:frontend}} type.
410
411 The {{EX:frontend}} is a special database that is used to hold
412 database-level options that should be applied to all the other
413 databases. Subsequent database definitions may also override some
414 frontend settings.
415
416 The {{EX:config}} database is also special; both the {{EX:config}} and
417 the {{EX:frontend}} databases are always created implicitly even if they
418 are not explicitly configured, and they are created before any other
419 databases.
420
421 \Example:
422
423 >       olcDatabase: bdb
424
425 This marks the beginning of a new {{TERM:BDB}} database instance.
426
427
428 H4: olcAccess: to <what> [ by <who> [<accesslevel>] [<control>] ]+
429
430 This directive grants access (specified by <accesslevel>) to a
431 set of entries and/or attributes (specified by <what>) by one or
432 more requestors (specified by <who>).
433 See the {{SECT:Access Control}} section of this guide for basic usage.
434
435 !if 0
436 More detailed discussion of this directive can be found in the
437 {{SECT:Advanced Access Control}} chapter.
438 !endif
439
440 Note: If no {{EX:olcAccess}} directives are specified, the default
441 access control policy, {{EX:to * by * read}}, allows all
442 users (both authenticated and anonymous) read access.
443
444 Note: Access controls defined in the frontend are appended to all
445 other databases' controls.
446
447
448 H4: olcReadonly { TRUE | FALSE }
449
450 This directive puts the database into "read-only" mode. Any
451 attempts to modify the database will return an "unwilling to
452 perform" error.
453
454 \Default:
455
456 >       olcReadonly: FALSE
457
458
459 H4: olcRootDN: <DN>
460
461 This directive specifies the DN that is not subject to
462 access control or administrative limit restrictions for
463 operations on this database.  The DN need not refer to
464 an entry in this database or even in the directory. The
465 DN may refer to a SASL identity.
466
467 Entry-based Example:
468
469 >       olcRootDN: "cn=Manager,dc=example,dc=com"
470
471 SASL-based Example:
472
473 >       olcRootDN: "uid=root,cn=example.com,cn=digest-md5,cn=auth"
474
475 See the {{SECT:SASL Authentication}} section for information on
476 SASL authentication identities.
477
478
479 H4: olcRootPW: <password>
480
481 This directive can be used to specify a password for the DN for
482 the rootdn (when the rootdn is set to a DN within the database).
483
484 \Example:
485
486 >       olcRootPW: secret
487
488 It is also permissible to provide a hash of the password in
489 {{REF:RFC2307}} form.  {{slappasswd}}(8) may be used to generate
490 the password hash.
491
492 \Example:
493
494 >       olcRootPW: {SSHA}ZKKuqbEKJfKSXhUbHG3fG8MDn9j1v4QN
495
496 The hash was generated using the command {{EX:slappasswd -s secret}}.
497
498
499 H4: olcSizeLimit: <integer>
500
501 This directive specifies the maximum number of entries to return
502 from a search operation.
503
504 \Default:
505
506 >       olcSizeLimit: 500
507
508 See the {{SECT:Limits}} section of this guide and slapd-config(5)
509 for more details.
510
511
512 H4: olcSuffix: <dn suffix>
513
514 This directive specifies the DN suffix of queries that will be
515 passed to this backend database. Multiple suffix lines can be
516 given, and usually at least one is required for each database
517 definition. (Some backend types, such as {{EX:frontend}} and
518 {{EX:monitor}} use a hard-coded suffix which may not be overridden
519 in the configuration.)
520
521 \Example:
522
523 >       olcSuffix: "dc=example,dc=com"
524
525 Queries with a DN ending in "dc=example,dc=com"
526 will be passed to this backend.
527
528 Note: When the backend to pass a query to is selected, slapd
529 looks at the suffix value(s) in each database definition in the
530 order in which they were configured. Thus, if one database suffix is a
531 prefix of another, it must appear after it in the configuration.
532
533
534 H4: olcSyncrepl
535
536 >       olcSyncrepl: rid=<replica ID>
537 >               provider=ldap[s]://<hostname>[:port]
538 >               [type=refreshOnly|refreshAndPersist]
539 >               [interval=dd:hh:mm:ss]
540 >               [retry=[<retry interval> <# of retries>]+]
541 >               searchbase=<base DN>
542 >               [filter=<filter str>]
543 >               [scope=sub|one|base]
544 >               [attrs=<attr list>]
545 >               [attrsonly]
546 >               [sizelimit=<limit>]
547 >               [timelimit=<limit>]
548 >               [schemachecking=on|off]
549 >               [bindmethod=simple|sasl]
550 >               [binddn=<DN>]
551 >               [saslmech=<mech>]
552 >               [authcid=<identity>]
553 >               [authzid=<identity>]
554 >               [credentials=<passwd>]
555 >               [realm=<realm>]
556 >               [secprops=<properties>]
557 >               [starttls=yes|critical]
558 >               [tls_cert=<file>]
559 >               [tls_key=<file>]
560 >               [tls_cacert=<file>]
561 >               [tls_cacertdir=<path>]
562 >               [tls_reqcert=never|allow|try|demand]
563 >               [tls_ciphersuite=<ciphers>]
564 >               [tls_crlcheck=none|peer|all]
565 >               [logbase=<base DN>]
566 >               [logfilter=<filter str>]
567 >               [syncdata=default|accesslog|changelog]
568
569
570 This directive specifies the current database as a replica of the
571 master content by establishing the current {{slapd}}(8) as a
572 replication consumer site running a syncrepl replication engine.
573 The master database is located at the replication provider site
574 specified by the {{EX:provider}} parameter. The replica database is
575 kept up-to-date with the master content using the LDAP Content
576 Synchronization protocol. See {{REF:RFC4533}}
577 for more information on the protocol.
578
579 The {{EX:rid}} parameter is used for identification of the current
580 {{EX:syncrepl}} directive within the replication consumer server,
581 where {{EX:<replica ID>}} uniquely identifies the syncrepl specification
582 described by the current {{EX:syncrepl}} directive. {{EX:<replica ID>}}
583 is non-negative and is no more than three decimal digits in length.
584
585 The {{EX:provider}} parameter specifies the replication provider site
586 containing the master content as an LDAP URI. The {{EX:provider}}
587 parameter specifies a scheme, a host and optionally a port where the
588 provider slapd instance can be found. Either a domain name or IP
589 address may be used for <hostname>. Examples are
590 {{EX:ldap://provider.example.com:389}} or {{EX:ldaps://192.168.1.1:636}}.
591 If <port> is not given, the standard LDAP port number (389 or 636) is used.
592 Note that the syncrepl uses a consumer-initiated protocol, and hence its
593 specification is located at the consumer site, whereas the {{EX:replica}}
594 specification is located at the provider site. {{EX:syncrepl}} and
595 {{EX:replica}} directives define two independent replication
596 mechanisms. They do not represent the replication peers of each other.
597
598 The content of the syncrepl replica is defined using a search
599 specification as its result set. The consumer slapd will
600 send search requests to the provider slapd according to the search
601 specification. The search specification includes {{EX:searchbase}},
602 {{EX:scope}}, {{EX:filter}}, {{EX:attrs}}, {{EX:attrsonly}},
603 {{EX:sizelimit}}, and {{EX:timelimit}} parameters as in the normal
604 search specification. The {{EX:searchbase}} parameter has no
605 default value and must always be specified. The {{EX:scope}} defaults
606 to {{EX:sub}}, the {{EX:filter}} defaults to {{EX:(objectclass=*)}},
607 {{EX:attrs}} defaults to {{EX:"*,+"}} to replicate all user and operational
608 attributes, and {{EX:attrsonly}} is unset by default. Both {{EX:sizelimit}}
609 and {{EX:timelimit}} default to "unlimited", and only positive integers
610 or "unlimited" may be specified.
611
612 The {{TERM[expand]LDAP Sync}} protocol has two operation
613 types: {{EX:refreshOnly}} and {{EX:refreshAndPersist}}.
614 The operation type is specified by the {{EX:type}} parameter.
615 In the {{EX:refreshOnly}} operation, the next synchronization search operation
616 is periodically rescheduled at an interval time after each
617 synchronization operation finishes. The interval is specified
618 by the {{EX:interval}} parameter. It is set to one day by default.
619 In the {{EX:refreshAndPersist}} operation, a synchronization search
620 remains persistent in the provider {{slapd}} instance. Further updates to the
621 master replica will generate {{EX:searchResultEntry}} to the consumer slapd
622 as the search responses to the persistent synchronization search.
623
624 If an error occurs during replication, the consumer will attempt to reconnect
625 according to the retry parameter which is a list of the <retry interval>
626 and <# of retries> pairs. For example, retry="60 10 300 3" lets the consumer
627 retry every 60 seconds for the first 10 times and then retry every 300 seconds
628 for the next three times before stop retrying. + in <#  of retries> means
629 indefinite number of retries until success.
630
631 The schema checking can be enforced at the LDAP Sync consumer site
632 by turning on the {{EX:schemachecking}} parameter.
633 If it is turned on, every replicated entry will be checked for its
634 schema as the entry is stored into the replica content.
635 Every entry in the replica should contain those attributes
636 required by the schema definition.
637 If it is turned off, entries will be stored without checking
638 schema conformance. The default is off.
639
640 The {{EX:binddn}} parameter gives the DN to bind as for the
641 syncrepl searches to the provider slapd. It should be a DN
642 which has read access to the replication content in the
643 master database. 
644
645 The {{EX:bindmethod}} is {{EX:simple}} or {{EX:sasl}},
646 depending on whether simple password-based authentication or
647 {{TERM:SASL}} authentication is to be used when connecting
648 to the provider {{slapd}} instance.
649
650 Simple authentication should not be used unless adequate data
651 integrity and confidentiality protections are in place (e.g. TLS
652 or IPsec). Simple authentication requires specification of {{EX:binddn}}
653 and {{EX:credentials}} parameters.
654
655 SASL authentication is generally recommended.  SASL authentication
656 requires specification of a mechanism using the {{EX:saslmech}} parameter.
657 Depending on the mechanism, an authentication identity and/or
658 credentials can be specified using {{EX:authcid}} and {{EX:credentials}},
659 respectively.  The {{EX:authzid}} parameter may be used to specify
660 an authorization identity.
661
662 The {{EX:realm}} parameter specifies a realm which a certain
663 mechanisms authenticate the identity within. The {{EX:secprops}}
664 parameter specifies Cyrus SASL security properties.
665
666 The {{EX:starttls}} parameter specifies use of the StartTLS extended
667 operation to establish a TLS session before authenticating to the provider.
668 If the {{EX:critical}} argument is supplied, the session will be aborted
669 if the StartTLS request fails.  Otherwise the syncrepl session continues
670 without TLS.  The tls_reqcert setting defaults to {{EX:"demand"}} and the
671 other TLS settings default to the same as the main slapd TLS settings.
672
673 Rather than replicating whole entries, the consumer can query logs
674 of data modifications.  This mode of operation is referred to as
675 {{delta syncrepl}}.  In addition to the above parameters, the
676 {{EX:logbase}} and {{EX:logfilter}} parameters must be set appropriately
677 for the log that will be used. The {{EX:syncdata}} parameter must
678 be set to either {{EX:"accesslog"}} if the log conforms to the
679 {{slapo-accesslog}}(5) log format, or {{EX:"changelog"}} if the log
680 conforms to the obsolete {{changelog}} format. If the {{EX:syncdata}}
681 parameter is omitted or set to {{EX:"default"}} then the log
682 parameters are ignored.
683
684 The {{syncrepl}} replication mechanism is supported by the {{bdb}} and
685 {{hdb}} backends.
686
687 See the {{SECT:LDAP Sync Replication}} chapter of this guide for
688 more information on how to use this directive.
689
690
691 H4: olcTimeLimit: <integer>
692
693 This directive specifies the maximum number of seconds (in real
694 time) slapd will spend answering a search request. If a
695 request is not finished in this time, a result indicating an
696 exceeded timelimit will be returned.
697
698 \Default:
699
700 >       olcTimeLimit: 3600
701
702 See the {{SECT:Limits}} section of this guide and slapd-config(5)
703 for more details.
704
705
706 H4: olcUpdateref: <URL>
707
708 This directive is only applicable in a slave slapd. It
709 specifies the URL to return to clients which submit update
710 requests upon the replica.
711 If specified multiple times, each {{TERM:URL}} is provided.
712
713 \Example:
714
715 >       olcUpdateref:   ldap://master.example.net
716
717
718 H4: Sample Entries
719
720 >dn: olcDatabase=frontend,cn=config
721 >objectClass: olcDatabaseConfig
722 >objectClass: olcFrontendConfig
723 >olcDatabase: frontend
724 >olcReadOnly: FALSE
725 >
726 >dn: olcDatabase=config,cn=config
727 >objectClass: olcDatabaseConfig
728 >olcDatabase: config
729 >olcRootDN: cn=Manager,dc=example,dc=com
730
731
732 H3: BDB and HDB Database Directives
733
734 Directives in this category apply to both the {{TERM:BDB}}
735 and the {{TERM:HDB}} database.
736 They are used in an olcDatabase entry in addition to the generic
737 database directives defined above.  For a complete reference
738 of BDB/HDB configuration directives, see {{slapd-bdb}}(5). In
739 addition to the {{EX:olcDatabaseConfig}} objectClass, BDB and HDB
740 database entries must have the {{EX:olcBdbConfig}} and
741 {{EX:olcHdbConfig}} objectClass, respectively.
742
743
744 H4: olcDbDirectory: <directory>
745
746 This directive specifies the directory where the BDB files
747 containing the database and associated indices live.
748
749 \Default:
750
751 >       olcDbDirectory: /usr/local/var/openldap-data
752
753
754 H4: olcDbCachesize: <integer>
755
756 This directive specifies the size in entries of the in-memory
757 cache maintained by the BDB backend database instance.
758
759 \Default:
760
761 >       olcDbCachesize: 1000
762
763
764 H4: olcDbCheckpoint: <kbyte> <min>
765
766 This directive specifies how often to checkpoint the BDB transaction log.
767 A checkpoint operation flushes the database buffers to disk and writes a
768 checkpoint record in the log.
769 The checkpoint will occur if either <kbyte> data has been written or
770 <min> minutes have passed since the last checkpoint. Both arguments default
771 to zero, in which case they are ignored. When the <min> argument is
772 non-zero, an internal task will run every <min> minutes to perform the
773 checkpoint. See the Berkeley DB reference guide for more details.
774
775 \Example:
776
777 >       olcDbCheckpoint: 1024 10
778
779
780 H4: olcDbConfig: <DB_CONFIG setting>
781
782 This attribute specifies a configuration directive to be placed in the
783 {{EX:DB_CONFIG}} file of the database directory. At server startup time, if
784 no such file exists yet, the {{EX:DB_CONFIG}} file will be created and the
785 settings in this attribute will be written to it. If the file exists,
786 its contents will be read and displayed in this attribute. The attribute
787 is multi-valued, to accommodate multiple configuration directives. No default
788 is provided, but it is essential to use proper settings here to get the
789 best server performance.
790
791 Any changes made to this attribute will be written to the {{EX:DB_CONFIG}}
792 file and will cause the database environment to be reset so the changes
793 can take immediate effect. If the environment cache is large and has not
794 been recently checkpointed, this reset operation may take a long time. It
795 may be advisable to manually perform a single checkpoint using the Berkeley DB
796 {{db_checkpoint}} utility before using LDAP Modify to change this
797 attribute.
798
799 \Example:
800
801 >       olcDbConfig: set_cachesize 0 10485760 0
802 >       olcDbConfig: set_lg_bsize 2097512
803 >       olcDbConfig: set_lg_dir /var/tmp/bdb-log
804 >       olcDbConfig: set_flags DB_LOG_AUTOREMOVE
805
806 In this example, the BDB cache is set to 10MB, the BDB transaction log
807 buffer size is set to 2MB, and the transaction log files are to be stored
808 in the /var/tmp/bdb-log directory. Also a flag is set to tell BDB to
809 delete transaction log files as soon as their contents have been
810 checkpointed and they are no longer needed. Without this setting the
811 transaction log files will continue to accumulate until some other
812 cleanup procedure removes them. See the Berkeley DB documentation for the
813 {{EX:db_archive}} command for details. For a complete list of Berkeley DB 
814 flags please see - {{URL:http://www.oracle.com/technology/documentation/berkeley-db/db/api_c/env_set_flags.html}}
815
816 Ideally the BDB cache must be
817 at least as large as the working set of the database, the log buffer size
818 should be large enough to accommodate most transactions without overflowing,
819 and the log directory must be on a separate physical disk from the main
820 database files. And both the database directory and the log directory
821 should be separate from disks used for regular system activities such as
822 the root, boot, or swap filesystems. See the FAQ-o-Matic and the Berkeley DB
823 documentation for more details.
824
825
826 H4: olcDbNosync: { TRUE | FALSE }
827
828 This option causes on-disk database contents to not be immediately
829 synchronized with in memory changes upon change.  Setting this option
830 to {{EX:TRUE}} may improve performance at the expense of data integrity. This
831 directive has the same effect as using
832 >       olcDbConfig: set_flags DB_TXN_NOSYNC
833
834
835 H4: olcDbIDLcacheSize: <integer>
836
837 Specify the size of the in-memory index cache, in index slots. The
838 default is zero. A larger value will speed up frequent searches of
839 indexed entries. The optimal size will depend on the data and search
840 characteristics of the database, but using a number three times
841 the entry cache size is a good starting point.
842
843 \Example:
844
845 >       olcDbIDLcacheSize: 3000
846
847
848 H4: olcDbIndex: {<attrlist> | default} [pres,eq,approx,sub,none]
849
850 This directive specifies the indices to maintain for the given
851 attribute. If only an {{EX:<attrlist>}} is given, the default
852 indices are maintained. The index keywords correspond to the
853 common types of matches that may be used in an LDAP search filter.
854
855 \Example:
856
857 >       olcDbIndex: default pres,eq
858 >       olcDbIndex: uid
859 >       olcDbIndex: cn,sn pres,eq,sub
860 >       olcDbIndex: objectClass eq
861
862 The first line sets the default set of indices to maintain to
863 present and equality.  The second line causes the default (pres,eq)
864 set of indices to be maintained for the {{EX:uid}} attribute type.
865 The third line causes present, equality, and substring indices to
866 be maintained for {{EX:cn}} and {{EX:sn}} attribute types.  The
867 fourth line causes an equality index for the {{EX:objectClass}}
868 attribute type.
869
870 There is no index keyword for inequality matches. Generally these
871 matches do not use an index. However, some attributes do support
872 indexing for inequality matches, based on the equality index.
873
874 A substring index can be more explicitly specified as {{EX:subinitial}},
875 {{EX:subany}}, or {{EX:subfinal}}, corresponding to the three 
876 possible components
877 of a substring match filter. A subinitial index only indexes
878 substrings that appear at the beginning of an attribute value.
879 A subfinal index only indexes substrings that appear at the end
880 of an attribute value, while subany indexes substrings that occur
881 anywhere in a value.
882
883 Note that by default, setting an index for an attribute also
884 affects every subtype of that attribute. E.g., setting an equality
885 index on the {{EX:name}} attribute causes {{EX:cn}}, {{EX:sn}}, and every other
886 attribute that inherits from {{EX:name}} to be indexed.
887
888 By default, no indices are maintained.  It is generally advised
889 that minimally an equality index upon objectClass be maintained.
890
891 >       olcDbindex: objectClass eq
892
893 Additional indices should be configured corresponding to the
894 most common searches that are used on the database.
895 Presence indexing should not be configured for an attribute
896 unless the attribute occurs very rarely in the database, and
897 presence searches on the attribute occur very frequently during
898 normal use of the directory. Most applications don't use presence
899 searches, so usually presence indexing is not very useful.
900
901 If this setting is changed while slapd is running, an internal task
902 will be run to generate the changed index data. All server operations
903 can continue as normal while the indexer does its work.  If slapd is
904 stopped before the index task completes, indexing will have to be
905 manually completed using the slapindex tool.
906
907
908 H4: olcDbLinearIndex: { TRUE | FALSE }
909
910 If this setting is {{EX:TRUE}} slapindex will index one attribute
911 at a time. The default settings is {{EX:FALSE}} in which case all
912 indexed attributes of an entry are processed at the same time. When
913 enabled, each indexed attribute is processed individually, using
914 multiple passes through the entire database. This option improves
915 slapindex performance when the database size exceeds the BDB cache
916 size. When the BDB cache is large enough, this option is not needed
917 and will decrease performance. Also by default, slapadd performs
918 full indexing and so a separate slapindex run is not needed. With
919 this option, slapadd does no indexing and slapindex must be used.
920
921
922 H4: olcDbMode: { <octal> | <symbolic> }
923
924 This directive specifies the file protection mode that newly
925 created database index files should have. This can be in the form
926 {{EX:0600}} or {{EX:-rw-------}}
927
928 \Default:
929
930 >       olcDbMode: 0600
931
932
933 H4: olcDbSearchStack: <integer>
934
935 Specify the depth of the stack used for search filter evaluation.
936 Search filters are evaluated on a stack to accommodate nested {{EX:AND}} /
937 {{EX:OR}} clauses. An individual stack is allocated for each server thread.
938 The depth of the stack determines how complex a filter can be evaluated
939 without requiring any additional memory allocation. Filters that are
940 nested deeper than the search stack depth will cause a separate stack to
941 be allocated for that particular search operation. These separate allocations
942 can have a major negative impact on server performance, but specifying
943 too much stack will also consume a great deal of memory. Each search
944 uses 512K bytes per level on a 32-bit machine, or 1024K bytes per level
945 on a 64-bit machine. The default stack depth is 16, thus 8MB or 16MB
946 per thread is used on 32 and 64 bit machines, respectively. Also the
947 512KB size of a single stack slot is set by a compile-time constant which
948 may be changed if needed; the code must be recompiled for the change
949 to take effect.
950
951 \Default:
952
953 >       olcDbSearchStack: 16
954
955
956 H4: olcDbShmKey: <integer>
957
958 Specify a key for a shared memory BDB environment. By default the BDB
959 environment uses memory mapped files. If a non-zero value is specified,
960 it will be used as the key to identify a shared memory region that will
961 house the environment.
962
963 \Example:
964
965 >       olcDbShmKey: 42
966
967
968 H4: Sample Entry
969
970 >dn: olcDatabase=hdb,cn=config
971 >objectClass: olcDatabaseConfig
972 >objectClass: olcHdbConfig
973 >olcDatabase: hdb
974 >olcSuffix: "dc=example,dc=com"
975 >olcDbDirectory: /usr/local/var/openldap-data
976 >olcDbCacheSize: 1000
977 >olcDbCheckpoint: 1024 10
978 >olcDbConfig: set_cachesize 0 10485760 0
979 >olcDbConfig: set_lg_bsize 2097152
980 >olcDbConfig: set_lg_dir /var/tmp/bdb-log
981 >olcDbConfig: set_flags DB_LOG_AUTOREMOVE
982 >olcDbIDLcacheSize: 3000
983 >olcDbIndex: objectClass eq
984
985
986 H2: Configuration Example
987
988 The following is an example configuration, interspersed
989 with explanatory text. It defines two databases to handle
990 different parts of the {{TERM:X.500}} tree; both are {{TERM:BDB}}
991 database instances. The line numbers shown are provided for
992 reference only and are not included in the actual file. First, the
993 global configuration section:
994
995 E:  1.    # example config file - global configuration entry
996 E:  2.    dn: cn=config
997 E:  3.    objectClass: olcGlobal
998 E:  4.    cn: config
999 E:  5.    olcReferral: ldap://root.openldap.org
1000 E:  6.    
1001
1002 Line 1 is a comment. Lines 2-4 identify this as the global
1003 configuration entry.
1004 The {{EX:olcReferral:}} directive on line 5
1005 means that queries not local to one of the databases defined
1006 below will be referred to the LDAP server running on the
1007 standard port (389) at the host {{EX:root.openldap.org}}.
1008 Line 6 is a blank line, indicating the end of this entry.
1009
1010 E:  7.    # internal schema
1011 E:  8.    dn: cn=schema,cn=config
1012 E:  9.    objectClass: olcSchemaConfig
1013 E: 10.    cn: schema
1014 E: 11.    
1015
1016 Line 7 is a comment. Lines 8-10 identify this as the root of
1017 the schema subtree. The actual schema definitions in this entry
1018 are hardcoded into slapd so no additional attributes are specified here.
1019 Line 11 is a blank line, indicating the end of this entry.
1020
1021 E: 12.    # include the core schema
1022 E: 13.    include: file:///usr/local/etc/openldap/schema/core.ldif
1023 E: 14.    
1024
1025 Line 12 is a comment. Line 13 is an LDIF include directive which
1026 accesses the {{core}} schema definitions in LDIF format. Line 14
1027 is a blank line.
1028
1029 Next comes the database definitions. The first database is the
1030 special {{EX:frontend}} database whose settings are applied globally
1031 to all the other databases.
1032
1033 E: 15.    # global database parameters
1034 E: 16.    dn: olcDatabase=frontend,cn=config
1035 E: 17.    objectClass: olcDatabaseConfig
1036 E: 18.    olcDatabase: frontend
1037 E: 19.    olcAccess: to * by * read
1038 E: 20.    
1039
1040 Line 15 is a comment. Lines 16-18 identify this entry as the global
1041 database entry. Line 19 is a global access control. It applies to all
1042 entries (after any applicable database-specific access controls).
1043 Line 20 is a blank line.
1044
1045 The next entry defines the config backend.
1046
1047 E: 21.    # set a rootpw for the config database so we can bind.
1048 E: 22.    # deny access to everyone else.
1049 E: 23.    dn: olcDatabase=config,cn=config
1050 E: 24.    objectClass: olcDatabaseConfig
1051 E: 25.    olcDatabase: config
1052 E: 26.    olcRootPW: {SSHA}XKYnrjvGT3wZFQrDD5040US592LxsdLy
1053 E: 27.    olcAccess: to * by * none
1054 E: 28.
1055
1056 Lines 21-22 are comments. Lines 23-25 identify this entry as the config
1057 database entry. Line 26 defines the {{super-user}} password for this
1058 database. (The DN defaults to {{"cn=config"}}.) Line 27 denies all access
1059 to this database, so only the super-user will be able to access it. (This
1060 is already the default access on the config database. It is just listed
1061 here for illustration, and to reiterate that unless a means to authenticate
1062 as the super-user is explicitly configured, the config database will be
1063 inaccessible.)
1064
1065 Line 28 is a blank line.
1066
1067 The next entry defines a BDB backend that will handle queries for things
1068 in the "dc=example,dc=com" portion of the tree. Indices are to be maintained
1069 for several attributes, and the {{EX:userPassword}} attribute is to be
1070 protected from unauthorized access.
1071
1072 E: 29.    # BDB definition for example.com
1073 E: 30.    dn: olcDatabase=bdb,cn=config
1074 E: 31.    objectClass: olcDatabaseConfig
1075 E: 32.    objectClass: olcBdbConfig
1076 E: 33.    olcDatabase: bdb
1077 E: 34.    olcSuffix: dc=example,dc=com
1078 E: 35.    olcDbDirectory: /usr/local/var/openldap-data
1079 E: 36.    olcRootDN: cn=Manager,dc=example,dc=com
1080 E: 37.    olcRootPW: secret
1081 E: 38.    olcDbIndex: uid pres,eq
1082 E: 39.    olcDbIndex: cn,sn pres,eq,approx,sub
1083 E: 40.    olcDbIndex: objectClass eq
1084 E: 41.    olcAccess: to attrs=userPassword
1085 E: 42.      by self write
1086 E: 43.      by anonymous auth
1087 E: 44.      by dn.base="cn=Admin,dc=example,dc=com" write
1088 E: 45.      by * none
1089 E: 46.    olcAccess: to *
1090 E: 47.      by self write
1091 E: 48.      by dn.base="cn=Admin,dc=example,dc=com" write
1092 E: 49.      by * read
1093 E: 50.    
1094
1095 Line 29 is a comment. Lines 30-33 identify this entry as a BDB database
1096 configuration entry.  Line 34 specifies the DN suffix
1097 for queries to pass to this database. Line 35 specifies the directory
1098 in which the database files will live.
1099
1100 Lines 36 and 37 identify the database {{super-user}} entry and associated
1101 password. This entry is not subject to access control or size or
1102 time limit restrictions.
1103
1104 Lines 38 through 40 indicate the indices to maintain for various
1105 attributes.
1106
1107 Lines 41 through 49 specify access control for entries in this
1108 database. For all applicable entries, the {{EX:userPassword}} attribute is writable
1109 by the entry itself and by the "admin" entry.  It may be used for
1110 authentication/authorization purposes, but is otherwise not readable.
1111 All other attributes are writable by the entry and the "admin"
1112 entry, but may be read by all users (authenticated or not).
1113
1114 Line 50 is a blank line, indicating the end of this entry.
1115
1116 The next entry defines another
1117 BDB database. This one handles queries involving the
1118 {{EX:dc=example,dc=net}} subtree but is managed by the same entity
1119 as the first database.  Note that without line 60, the read access
1120 would be allowed due to the global access rule at line 19.
1121
1122 E: 51.    # BDB definition for example.net
1123 E: 52.    dn: olcDatabase=bdb,cn=config
1124 E: 53.    objectClass: olcDatabaseConfig
1125 E: 54.    objectClass: olcBdbConfig
1126 E: 55.    olcDatabase: bdb
1127 E: 56.    olcSuffix: "dc=example,dc=net"
1128 E: 57.    olcDbDirectory: /usr/local/var/openldap-data-net
1129 E: 58.    olcRootDN: "cn=Manager,dc=example,dc=com"
1130 E: 59.    olcDbIndex: objectClass eq
1131 E: 60.    olcAccess: to * by users read
1132
1133
1134 H2: Converting old style {{slapd.conf}}(5) file to {{cn=config}} format
1135
1136 Before converting to the {{cn=config}} format you should make sure that the
1137 config backend is properly configured in your existing config file. While
1138 the config backend is always present inside slapd, by default it is only
1139 accessible by its rootDN, and there are no default credentials assigned
1140 so unless you explicitly configure a means to authenticate to it, it will be
1141 unusable.
1142
1143 If you do not already have a {{EX:database config}} section, add something
1144 like this to the end of {{EX:slapd.conf}}
1145
1146 > database config
1147 > rootpw VerySecret
1148
1149 Note: Since the config backend can be used to load arbitrary code into the
1150 slapd process, it is extremely important to carefully guard whatever
1151 credentials are used to access it. Since simple passwords are vulnerable to
1152 password guessing attacks, it is usually better to omit the rootpw and only
1153 use SASL authentication for the config rootDN.
1154
1155 An existing {{slapd.conf}}(5) file can be converted to the new format using
1156 {{slaptest}}(8) or any of the slap tools:
1157
1158 >       slaptest -f /usr/local/etc/openldap/slapd.conf -F /usr/local/etc/openldap/slapd.d
1159
1160 Test that you can access entries under {{EX:cn=config}} using the
1161 default {{rootdn}} and the {{rootpw}} configured above:
1162
1163 >       ldapsearch -x -D cn=config -w VerySecret -b cn=config
1164
1165 You can then discard the old {{slapd.conf}}(5) file. Make sure to launch
1166 {{slapd}}(8) with the {{-F}} option to specify the configuration directory
1167 if you are not using the default directory path.
1168
1169 Note: When converting from the slapd.conf format to slapd.d format, any
1170 included files will also be integrated into the resulting configuration
1171 database.