]> git.sur5r.net Git - openldap/blob - doc/guide/admin/slapdconf2.sdf
200abaa9de80d42dea59ee48e5f878810367cfde
[openldap] / doc / guide / admin / slapdconf2.sdf
1 # $OpenLDAP$
2 # Copyright 2005-2017 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 (deprecated)
368 config  Slapd configuration backend
369 dnssrv  DNS SRV backend
370 hdb     Hierarchical variant of bdb backend (deprecated)
371 ldap    Lightweight Directory Access Protocol (Proxy) backend
372 ldif    Lightweight Data Interchange Format backend
373 mdb     Memory-Mapped DB backend
374 meta    Meta Directory backend
375 monitor Monitor backend
376 passwd  Provides read-only access to {{passwd}}(5)
377 perl    Perl Programmable backend
378 shell   Shell (extern program) backend
379 sql     SQL Programmable backend
380 !endblock
381
382 \Example:
383
384 >       olcBackend: bdb
385
386 There are no other directives defined for this entry.  Specific backend
387 types may define additional attributes for their particular use but so
388 far none have ever been defined.  As such, these directives usually do
389 not appear in any actual configurations.
390
391
392 H4: Sample Entry
393
394 > dn: olcBackend=bdb,cn=config
395 > objectClass: olcBackendConfig
396 > olcBackend: bdb
397
398
399 H3: Database-specific Directives
400
401 Directives in this section are supported by every type of database.
402 Database entries must have the {{EX:olcDatabaseConfig}} objectClass.
403
404 H4: olcDatabase: [{<index>}]<type>
405
406 This directive names a specific database instance. The numeric {<index>} may
407 be provided to distinguish multiple databases of the same type. Usually the
408 index can be omitted, and slapd will generate it automatically.
409 {{EX:<type>}} should be one of the
410 supported backend types listed in Table 5.2 or the {{EX:frontend}} type.
411
412 The {{EX:frontend}} is a special database that is used to hold
413 database-level options that should be applied to all the other
414 databases. Subsequent database definitions may also override some
415 frontend settings.
416
417 The {{EX:config}} database is also special; both the {{EX:config}} and
418 the {{EX:frontend}} databases are always created implicitly even if they
419 are not explicitly configured, and they are created before any other
420 databases.
421
422 \Example:
423
424 >       olcDatabase: bdb
425
426 This marks the beginning of a new {{TERM:BDB}} database instance.
427
428
429 H4: olcAccess: to <what> [ by <who> [<accesslevel>] [<control>] ]+
430
431 This directive grants access (specified by <accesslevel>) to a
432 set of entries and/or attributes (specified by <what>) by one or
433 more requestors (specified by <who>).
434 See the {{SECT:Access Control}} section of this guide for basic usage.
435
436 !if 0
437 More detailed discussion of this directive can be found in the
438 {{SECT:Advanced Access Control}} chapter.
439 !endif
440
441 Note: If no {{EX:olcAccess}} directives are specified, the default
442 access control policy, {{EX:to * by * read}}, allows all
443 users (both authenticated and anonymous) read access.
444
445 Note: Access controls defined in the frontend are appended to all
446 other databases' controls.
447
448
449 H4: olcReadonly { TRUE | FALSE }
450
451 This directive puts the database into "read-only" mode. Any
452 attempts to modify the database will return an "unwilling to
453 perform" error.  If set on a consumer, modifications sent by
454 syncrepl will still occur.
455
456 \Default:
457
458 >       olcReadonly: FALSE
459
460
461 H4: olcRootDN: <DN>
462
463 This directive specifies the DN that is not subject to
464 access control or administrative limit restrictions for
465 operations on this database.  The DN need not refer to
466 an entry in this database or even in the directory. The
467 DN may refer to a SASL identity.
468
469 Entry-based Example:
470
471 >       olcRootDN: "cn=Manager,dc=example,dc=com"
472
473 SASL-based Example:
474
475 >       olcRootDN: "uid=root,cn=example.com,cn=digest-md5,cn=auth"
476
477 See the {{SECT:SASL Authentication}} section for information on
478 SASL authentication identities.
479
480
481 H4: olcRootPW: <password>
482
483 This directive can be used to specify a password for the DN for
484 the rootdn (when the rootdn is set to a DN within the database).
485
486 \Example:
487
488 >       olcRootPW: secret
489
490 It is also permissible to provide a hash of the password in
491 {{REF:RFC2307}} form.  {{slappasswd}}(8) may be used to generate
492 the password hash.
493
494 \Example:
495
496 >       olcRootPW: {SSHA}ZKKuqbEKJfKSXhUbHG3fG8MDn9j1v4QN
497
498 The hash was generated using the command {{EX:slappasswd -s secret}}.
499
500
501 H4: olcSizeLimit: <integer>
502
503 This directive specifies the maximum number of entries to return
504 from a search operation.
505
506 \Default:
507
508 >       olcSizeLimit: 500
509
510 See the {{SECT:Limits}} section of this guide and slapd-config(5)
511 for more details.
512
513
514 H4: olcSuffix: <dn suffix>
515
516 This directive specifies the DN suffix of queries that will be
517 passed to this backend database. Multiple suffix lines can be
518 given, and usually at least one is required for each database
519 definition. (Some backend types, such as {{EX:frontend}} and
520 {{EX:monitor}} use a hard-coded suffix which may not be overridden
521 in the configuration.)
522
523 \Example:
524
525 >       olcSuffix: "dc=example,dc=com"
526
527 Queries with a DN ending in "dc=example,dc=com"
528 will be passed to this backend.
529
530 Note: When the backend to pass a query to is selected, slapd
531 looks at the suffix value(s) in each database definition in the
532 order in which they were configured. Thus, if one database suffix is a
533 prefix of another, it must appear after it in the configuration.
534
535
536 H4: olcSyncrepl
537
538 >       olcSyncrepl: rid=<replica ID>
539 >               provider=ldap[s]://<hostname>[:port]
540 >               [type=refreshOnly|refreshAndPersist]
541 >               [interval=dd:hh:mm:ss]
542 >               [retry=[<retry interval> <# of retries>]+]
543 >               searchbase=<base DN>
544 >               [filter=<filter str>]
545 >               [scope=sub|one|base]
546 >               [attrs=<attr list>]
547 >               [attrsonly]
548 >               [sizelimit=<limit>]
549 >               [timelimit=<limit>]
550 >               [schemachecking=on|off]
551 >               [bindmethod=simple|sasl]
552 >               [binddn=<DN>]
553 >               [saslmech=<mech>]
554 >               [authcid=<identity>]
555 >               [authzid=<identity>]
556 >               [credentials=<passwd>]
557 >               [realm=<realm>]
558 >               [secprops=<properties>]
559 >               [starttls=yes|critical]
560 >               [tls_cert=<file>]
561 >               [tls_key=<file>]
562 >               [tls_cacert=<file>]
563 >               [tls_cacertdir=<path>]
564 >               [tls_reqcert=never|allow|try|demand]
565 >               [tls_cipher_suite=<ciphers>]
566 >               [tls_crlcheck=none|peer|all]
567 >               [logbase=<base DN>]
568 >               [logfilter=<filter str>]
569 >               [syncdata=default|accesslog|changelog]
570
571
572 This directive specifies the current database as a replica of the
573 master content by establishing the current {{slapd}}(8) as a
574 replication consumer site running a syncrepl replication engine.
575 The master database is located at the replication provider site
576 specified by the {{EX:provider}} parameter. The replica database is
577 kept up-to-date with the master content using the LDAP Content
578 Synchronization protocol. See {{REF:RFC4533}}
579 for more information on the protocol.
580
581 The {{EX:rid}} parameter is used for identification of the current
582 {{EX:syncrepl}} directive within the replication consumer server,
583 where {{EX:<replica ID>}} uniquely identifies the syncrepl specification
584 described by the current {{EX:syncrepl}} directive. {{EX:<replica ID>}}
585 is non-negative and is no more than three decimal digits in length.
586
587 The {{EX:provider}} parameter specifies the replication provider site
588 containing the master content as an LDAP URI. The {{EX:provider}}
589 parameter specifies a scheme, a host and optionally a port where the
590 provider slapd instance can be found. Either a domain name or IP
591 address may be used for <hostname>. Examples are
592 {{EX:ldap://provider.example.com:389}} or {{EX:ldaps://192.168.1.1:636}}.
593 If <port> is not given, the standard LDAP port number (389 or 636) is used.
594 Note that the syncrepl uses a consumer-initiated protocol, and hence its
595 specification is located at the consumer site, whereas the {{EX:replica}}
596 specification is located at the provider site. {{EX:syncrepl}} and
597 {{EX:replica}} directives define two independent replication
598 mechanisms. They do not represent the replication peers of each other.
599
600 The content of the syncrepl replica is defined using a search
601 specification as its result set. The consumer slapd will
602 send search requests to the provider slapd according to the search
603 specification. The search specification includes {{EX:searchbase}},
604 {{EX:scope}}, {{EX:filter}}, {{EX:attrs}}, {{EX:attrsonly}},
605 {{EX:sizelimit}}, and {{EX:timelimit}} parameters as in the normal
606 search specification. The {{EX:searchbase}} parameter has no
607 default value and must always be specified. The {{EX:scope}} defaults
608 to {{EX:sub}}, the {{EX:filter}} defaults to {{EX:(objectclass=*)}},
609 {{EX:attrs}} defaults to {{EX:"*,+"}} to replicate all user and operational
610 attributes, and {{EX:attrsonly}} is unset by default. Both {{EX:sizelimit}}
611 and {{EX:timelimit}} default to "unlimited", and only positive integers
612 or "unlimited" may be specified.
613
614 The {{TERM[expand]LDAP Sync}} protocol has two operation
615 types: {{EX:refreshOnly}} and {{EX:refreshAndPersist}}.
616 The operation type is specified by the {{EX:type}} parameter.
617 In the {{EX:refreshOnly}} operation, the next synchronization search operation
618 is periodically rescheduled at an interval time after each
619 synchronization operation finishes. The interval is specified
620 by the {{EX:interval}} parameter. It is set to one day by default.
621 In the {{EX:refreshAndPersist}} operation, a synchronization search
622 remains persistent in the provider {{slapd}} instance. Further updates to the
623 master replica will generate {{EX:searchResultEntry}} to the consumer slapd
624 as the search responses to the persistent synchronization search.
625
626 If an error occurs during replication, the consumer will attempt to reconnect
627 according to the retry parameter which is a list of the <retry interval>
628 and <# of retries> pairs. For example, retry="60 10 300 3" lets the consumer
629 retry every 60 seconds for the first 10 times and then retry every 300 seconds
630 for the next three times before stop retrying. + in <#  of retries> means
631 indefinite number of retries until success.
632
633 The schema checking can be enforced at the LDAP Sync consumer site
634 by turning on the {{EX:schemachecking}} parameter.
635 If it is turned on, every replicated entry will be checked for its
636 schema as the entry is stored into the replica content.
637 Every entry in the replica should contain those attributes
638 required by the schema definition.
639 If it is turned off, entries will be stored without checking
640 schema conformance. The default is off.
641
642 The {{EX:binddn}} parameter gives the DN to bind as for the
643 syncrepl searches to the provider slapd. It should be a DN
644 which has read access to the replication content in the
645 master database. 
646
647 The {{EX:bindmethod}} is {{EX:simple}} or {{EX:sasl}},
648 depending on whether simple password-based authentication or
649 {{TERM:SASL}} authentication is to be used when connecting
650 to the provider {{slapd}} instance.
651
652 Simple authentication should not be used unless adequate data
653 integrity and confidentiality protections are in place (e.g. TLS
654 or IPsec). Simple authentication requires specification of {{EX:binddn}}
655 and {{EX:credentials}} parameters.
656
657 SASL authentication is generally recommended.  SASL authentication
658 requires specification of a mechanism using the {{EX:saslmech}} parameter.
659 Depending on the mechanism, an authentication identity and/or
660 credentials can be specified using {{EX:authcid}} and {{EX:credentials}},
661 respectively.  The {{EX:authzid}} parameter may be used to specify
662 an authorization identity.
663
664 The {{EX:realm}} parameter specifies a realm which a certain
665 mechanisms authenticate the identity within. The {{EX:secprops}}
666 parameter specifies Cyrus SASL security properties.
667
668 The {{EX:starttls}} parameter specifies use of the StartTLS extended
669 operation to establish a TLS session before authenticating to the provider.
670 If the {{EX:critical}} argument is supplied, the session will be aborted
671 if the StartTLS request fails.  Otherwise the syncrepl session continues
672 without TLS.  The tls_reqcert setting defaults to {{EX:"demand"}} and the
673 other TLS settings default to the same as the main slapd TLS settings.
674
675 Rather than replicating whole entries, the consumer can query logs
676 of data modifications.  This mode of operation is referred to as
677 {{delta syncrepl}}.  In addition to the above parameters, the
678 {{EX:logbase}} and {{EX:logfilter}} parameters must be set appropriately
679 for the log that will be used. The {{EX:syncdata}} parameter must
680 be set to either {{EX:"accesslog"}} if the log conforms to the
681 {{slapo-accesslog}}(5) log format, or {{EX:"changelog"}} if the log
682 conforms to the obsolete {{changelog}} format. If the {{EX:syncdata}}
683 parameter is omitted or set to {{EX:"default"}} then the log
684 parameters are ignored.
685
686 The {{syncrepl}} replication mechanism is supported by the {{bdb}},
687 {{hdb}}, and {{mdb}} backends.
688
689 See the {{SECT:LDAP Sync Replication}} chapter of this guide for
690 more information on how to use this directive.
691
692
693 H4: olcTimeLimit: <integer>
694
695 This directive specifies the maximum number of seconds (in real
696 time) slapd will spend answering a search request. If a
697 request is not finished in this time, a result indicating an
698 exceeded timelimit will be returned.
699
700 \Default:
701
702 >       olcTimeLimit: 3600
703
704 See the {{SECT:Limits}} section of this guide and slapd-config(5)
705 for more details.
706
707
708 H4: olcUpdateref: <URL>
709
710 This directive is only applicable in a slave slapd. It
711 specifies the URL to return to clients which submit update
712 requests upon the replica.
713 If specified multiple times, each {{TERM:URL}} is provided.
714
715 \Example:
716
717 >       olcUpdateref:   ldap://master.example.net
718
719
720 H4: Sample Entries
721
722 >dn: olcDatabase=frontend,cn=config
723 >objectClass: olcDatabaseConfig
724 >objectClass: olcFrontendConfig
725 >olcDatabase: frontend
726 >olcReadOnly: FALSE
727 >
728 >dn: olcDatabase=config,cn=config
729 >objectClass: olcDatabaseConfig
730 >olcDatabase: config
731 >olcRootDN: cn=Manager,dc=example,dc=com
732
733
734 H3: BDB and HDB Database Directives
735
736 Directives in this category apply to both the {{TERM:BDB}}
737 and the {{TERM:HDB}} database.
738 They are used in an olcDatabase entry in addition to the generic
739 database directives defined above.  For a complete reference
740 of BDB/HDB configuration directives, see {{slapd-bdb}}(5). In
741 addition to the {{EX:olcDatabaseConfig}} objectClass, BDB and HDB
742 database entries must have the {{EX:olcBdbConfig}} and
743 {{EX:olcHdbConfig}} objectClass, respectively.
744
745
746 H4: olcDbDirectory: <directory>
747
748 This directive specifies the directory where the BDB files
749 containing the database and associated indices live.
750
751 \Default:
752
753 >       olcDbDirectory: /usr/local/var/openldap-data
754
755
756 H4: olcDbCachesize: <integer>
757
758 This directive specifies the size in entries of the in-memory
759 cache maintained by the BDB backend database instance.
760
761 \Default:
762
763 >       olcDbCachesize: 1000
764
765
766 H4: olcDbCheckpoint: <kbyte> <min>
767
768 This directive specifies how often to checkpoint the BDB transaction log.
769 A checkpoint operation flushes the database buffers to disk and writes a
770 checkpoint record in the log.
771 The checkpoint will occur if either <kbyte> data has been written or
772 <min> minutes have passed since the last checkpoint. Both arguments default
773 to zero, in which case they are ignored. When the <min> argument is
774 non-zero, an internal task will run every <min> minutes to perform the
775 checkpoint. See the Berkeley DB reference guide for more details.
776
777 \Example:
778
779 >       olcDbCheckpoint: 1024 10
780
781
782 H4: olcDbConfig: <DB_CONFIG setting>
783
784 This attribute specifies a configuration directive to be placed in the
785 {{EX:DB_CONFIG}} file of the database directory. At server startup time, if
786 no such file exists yet, the {{EX:DB_CONFIG}} file will be created and the
787 settings in this attribute will be written to it. If the file exists,
788 its contents will be read and displayed in this attribute. The attribute
789 is multi-valued, to accommodate multiple configuration directives. No default
790 is provided, but it is essential to use proper settings here to get the
791 best server performance.
792
793 Any changes made to this attribute will be written to the {{EX:DB_CONFIG}}
794 file and will cause the database environment to be reset so the changes
795 can take immediate effect. If the environment cache is large and has not
796 been recently checkpointed, this reset operation may take a long time. It
797 may be advisable to manually perform a single checkpoint using the Berkeley DB
798 {{db_checkpoint}} utility before using LDAP Modify to change this
799 attribute.
800
801 \Example:
802
803 >       olcDbConfig: set_cachesize 0 10485760 0
804 >       olcDbConfig: set_lg_bsize 2097512
805 >       olcDbConfig: set_lg_dir /var/tmp/bdb-log
806 >       olcDbConfig: set_flags DB_LOG_AUTOREMOVE
807
808 In this example, the BDB cache is set to 10MB, the BDB transaction log
809 buffer size is set to 2MB, and the transaction log files are to be stored
810 in the /var/tmp/bdb-log directory. Also a flag is set to tell BDB to
811 delete transaction log files as soon as their contents have been
812 checkpointed and they are no longer needed. Without this setting the
813 transaction log files will continue to accumulate until some other
814 cleanup procedure removes them. See the Berkeley DB documentation for the
815 {{EX:db_archive}} command for details. For a complete list of Berkeley DB 
816 flags please see - {{URL:http://www.oracle.com/technology/documentation/berkeley-db/db/api_c/env_set_flags.html}}
817
818 Ideally the BDB cache must be
819 at least as large as the working set of the database, the log buffer size
820 should be large enough to accommodate most transactions without overflowing,
821 and the log directory must be on a separate physical disk from the main
822 database files. And both the database directory and the log directory
823 should be separate from disks used for regular system activities such as
824 the root, boot, or swap filesystems. See the FAQ-o-Matic and the Berkeley DB
825 documentation for more details.
826
827
828 H4: olcDbNosync: { TRUE | FALSE }
829
830 This option causes on-disk database contents to not be immediately
831 synchronized with in memory changes upon change.  Setting this option
832 to {{EX:TRUE}} may improve performance at the expense of data integrity. This
833 directive has the same effect as using
834 >       olcDbConfig: set_flags DB_TXN_NOSYNC
835
836
837 H4: olcDbIDLcacheSize: <integer>
838
839 Specify the size of the in-memory index cache, in index slots. The
840 default is zero. A larger value will speed up frequent searches of
841 indexed entries. The optimal size will depend on the data and search
842 characteristics of the database, but using a number three times
843 the entry cache size is a good starting point.
844
845 \Example:
846
847 >       olcDbIDLcacheSize: 3000
848
849
850 H4: olcDbIndex: {<attrlist> | default} [pres,eq,approx,sub,none]
851
852 This directive specifies the indices to maintain for the given
853 attribute. If only an {{EX:<attrlist>}} is given, the default
854 indices are maintained. The index keywords correspond to the
855 common types of matches that may be used in an LDAP search filter.
856
857 \Example:
858
859 >       olcDbIndex: default pres,eq
860 >       olcDbIndex: uid
861 >       olcDbIndex: cn,sn pres,eq,sub
862 >       olcDbIndex: objectClass eq
863
864 The first line sets the default set of indices to maintain to
865 present and equality.  The second line causes the default (pres,eq)
866 set of indices to be maintained for the {{EX:uid}} attribute type.
867 The third line causes present, equality, and substring indices to
868 be maintained for {{EX:cn}} and {{EX:sn}} attribute types.  The
869 fourth line causes an equality index for the {{EX:objectClass}}
870 attribute type.
871
872 There is no index keyword for inequality matches. Generally these
873 matches do not use an index. However, some attributes do support
874 indexing for inequality matches, based on the equality index.
875
876 A substring index can be more explicitly specified as {{EX:subinitial}},
877 {{EX:subany}}, or {{EX:subfinal}}, corresponding to the three 
878 possible components
879 of a substring match filter. A subinitial index only indexes
880 substrings that appear at the beginning of an attribute value.
881 A subfinal index only indexes substrings that appear at the end
882 of an attribute value, while subany indexes substrings that occur
883 anywhere in a value.
884
885 Note that by default, setting an index for an attribute also
886 affects every subtype of that attribute. E.g., setting an equality
887 index on the {{EX:name}} attribute causes {{EX:cn}}, {{EX:sn}}, and every other
888 attribute that inherits from {{EX:name}} to be indexed.
889
890 By default, no indices are maintained.  It is generally advised
891 that minimally an equality index upon objectClass be maintained.
892
893 >       olcDbindex: objectClass eq
894
895 Additional indices should be configured corresponding to the
896 most common searches that are used on the database.
897 Presence indexing should not be configured for an attribute
898 unless the attribute occurs very rarely in the database, and
899 presence searches on the attribute occur very frequently during
900 normal use of the directory. Most applications don't use presence
901 searches, so usually presence indexing is not very useful.
902
903 If this setting is changed while slapd is running, an internal task
904 will be run to generate the changed index data. All server operations
905 can continue as normal while the indexer does its work.  If slapd is
906 stopped before the index task completes, indexing will have to be
907 manually completed using the slapindex tool.
908
909
910 H4: olcDbLinearIndex: { TRUE | FALSE }
911
912 If this setting is {{EX:TRUE}} slapindex will index one attribute
913 at a time. The default settings is {{EX:FALSE}} in which case all
914 indexed attributes of an entry are processed at the same time. When
915 enabled, each indexed attribute is processed individually, using
916 multiple passes through the entire database. This option improves
917 slapindex performance when the database size exceeds the BDB cache
918 size. When the BDB cache is large enough, this option is not needed
919 and will decrease performance. Also by default, slapadd performs
920 full indexing and so a separate slapindex run is not needed. With
921 this option, slapadd does no indexing and slapindex must be used.
922
923
924 H4: olcDbMode: { <octal> | <symbolic> }
925
926 This directive specifies the file protection mode that newly
927 created database index files should have. This can be in the form
928 {{EX:0600}} or {{EX:-rw-------}}
929
930 \Default:
931
932 >       olcDbMode: 0600
933
934
935 H4: olcDbSearchStack: <integer>
936
937 Specify the depth of the stack used for search filter evaluation.
938 Search filters are evaluated on a stack to accommodate nested {{EX:AND}} /
939 {{EX:OR}} clauses. An individual stack is allocated for each server thread.
940 The depth of the stack determines how complex a filter can be evaluated
941 without requiring any additional memory allocation. Filters that are
942 nested deeper than the search stack depth will cause a separate stack to
943 be allocated for that particular search operation. These separate allocations
944 can have a major negative impact on server performance, but specifying
945 too much stack will also consume a great deal of memory. Each search
946 uses 512K bytes per level on a 32-bit machine, or 1024K bytes per level
947 on a 64-bit machine. The default stack depth is 16, thus 8MB or 16MB
948 per thread is used on 32 and 64 bit machines, respectively. Also the
949 512KB size of a single stack slot is set by a compile-time constant which
950 may be changed if needed; the code must be recompiled for the change
951 to take effect.
952
953 \Default:
954
955 >       olcDbSearchStack: 16
956
957
958 H4: olcDbShmKey: <integer>
959
960 Specify a key for a shared memory BDB environment. By default the BDB
961 environment uses memory mapped files. If a non-zero value is specified,
962 it will be used as the key to identify a shared memory region that will
963 house the environment.
964
965 \Example:
966
967 >       olcDbShmKey: 42
968
969
970 H4: Sample Entry
971
972 >dn: olcDatabase=hdb,cn=config
973 >objectClass: olcDatabaseConfig
974 >objectClass: olcHdbConfig
975 >olcDatabase: hdb
976 >olcSuffix: "dc=example,dc=com"
977 >olcDbDirectory: /usr/local/var/openldap-data
978 >olcDbCacheSize: 1000
979 >olcDbCheckpoint: 1024 10
980 >olcDbConfig: set_cachesize 0 10485760 0
981 >olcDbConfig: set_lg_bsize 2097152
982 >olcDbConfig: set_lg_dir /var/tmp/bdb-log
983 >olcDbConfig: set_flags DB_LOG_AUTOREMOVE
984 >olcDbIDLcacheSize: 3000
985 >olcDbIndex: objectClass eq
986
987
988 H2: Configuration Example
989
990 The following is an example configuration, interspersed
991 with explanatory text. It defines two databases to handle
992 different parts of the {{TERM:X.500}} tree; both are {{TERM:BDB}}
993 database instances. The line numbers shown are provided for
994 reference only and are not included in the actual file. First, the
995 global configuration section:
996
997 E:  1.    # example config file - global configuration entry
998 E:  2.    dn: cn=config
999 E:  3.    objectClass: olcGlobal
1000 E:  4.    cn: config
1001 E:  5.    olcReferral: ldap://root.openldap.org
1002 E:  6.    
1003
1004 Line 1 is a comment. Lines 2-4 identify this as the global
1005 configuration entry.
1006 The {{EX:olcReferral:}} directive on line 5
1007 means that queries not local to one of the databases defined
1008 below will be referred to the LDAP server running on the
1009 standard port (389) at the host {{EX:root.openldap.org}}.
1010 Line 6 is a blank line, indicating the end of this entry.
1011
1012 E:  7.    # internal schema
1013 E:  8.    dn: cn=schema,cn=config
1014 E:  9.    objectClass: olcSchemaConfig
1015 E: 10.    cn: schema
1016 E: 11.    
1017
1018 Line 7 is a comment. Lines 8-10 identify this as the root of
1019 the schema subtree. The actual schema definitions in this entry
1020 are hardcoded into slapd so no additional attributes are specified here.
1021 Line 11 is a blank line, indicating the end of this entry.
1022
1023 E: 12.    # include the core schema
1024 E: 13.    include: file:///usr/local/etc/openldap/schema/core.ldif
1025 E: 14.    
1026
1027 Line 12 is a comment. Line 13 is an LDIF include directive which
1028 accesses the {{core}} schema definitions in LDIF format. Line 14
1029 is a blank line.
1030
1031 Next comes the database definitions. The first database is the
1032 special {{EX:frontend}} database whose settings are applied globally
1033 to all the other databases.
1034
1035 E: 15.    # global database parameters
1036 E: 16.    dn: olcDatabase=frontend,cn=config
1037 E: 17.    objectClass: olcDatabaseConfig
1038 E: 18.    olcDatabase: frontend
1039 E: 19.    olcAccess: to * by * read
1040 E: 20.    
1041
1042 Line 15 is a comment. Lines 16-18 identify this entry as the global
1043 database entry. Line 19 is a global access control. It applies to all
1044 entries (after any applicable database-specific access controls).
1045 Line 20 is a blank line.
1046
1047 The next entry defines the config backend.
1048
1049 E: 21.    # set a rootpw for the config database so we can bind.
1050 E: 22.    # deny access to everyone else.
1051 E: 23.    dn: olcDatabase=config,cn=config
1052 E: 24.    objectClass: olcDatabaseConfig
1053 E: 25.    olcDatabase: config
1054 E: 26.    olcRootPW: {SSHA}XKYnrjvGT3wZFQrDD5040US592LxsdLy
1055 E: 27.    olcAccess: to * by * none
1056 E: 28.
1057
1058 Lines 21-22 are comments. Lines 23-25 identify this entry as the config
1059 database entry. Line 26 defines the {{super-user}} password for this
1060 database. (The DN defaults to {{"cn=config"}}.) Line 27 denies all access
1061 to this database, so only the super-user will be able to access it. (This
1062 is already the default access on the config database. It is just listed
1063 here for illustration, and to reiterate that unless a means to authenticate
1064 as the super-user is explicitly configured, the config database will be
1065 inaccessible.)
1066
1067 Line 28 is a blank line.
1068
1069 The next entry defines a BDB backend that will handle queries for things
1070 in the "dc=example,dc=com" portion of the tree. Indices are to be maintained
1071 for several attributes, and the {{EX:userPassword}} attribute is to be
1072 protected from unauthorized access.
1073
1074 E: 29.    # BDB definition for example.com
1075 E: 30.    dn: olcDatabase=bdb,cn=config
1076 E: 31.    objectClass: olcDatabaseConfig
1077 E: 32.    objectClass: olcBdbConfig
1078 E: 33.    olcDatabase: bdb
1079 E: 34.    olcSuffix: dc=example,dc=com
1080 E: 35.    olcDbDirectory: /usr/local/var/openldap-data
1081 E: 36.    olcRootDN: cn=Manager,dc=example,dc=com
1082 E: 37.    olcRootPW: secret
1083 E: 38.    olcDbIndex: uid pres,eq
1084 E: 39.    olcDbIndex: cn,sn pres,eq,approx,sub
1085 E: 40.    olcDbIndex: objectClass eq
1086 E: 41.    olcAccess: to attrs=userPassword
1087 E: 42.      by self write
1088 E: 43.      by anonymous auth
1089 E: 44.      by dn.base="cn=Admin,dc=example,dc=com" write
1090 E: 45.      by * none
1091 E: 46.    olcAccess: to *
1092 E: 47.      by self write
1093 E: 48.      by dn.base="cn=Admin,dc=example,dc=com" write
1094 E: 49.      by * read
1095 E: 50.    
1096
1097 Line 29 is a comment. Lines 30-33 identify this entry as a BDB database
1098 configuration entry.  Line 34 specifies the DN suffix
1099 for queries to pass to this database. Line 35 specifies the directory
1100 in which the database files will live.
1101
1102 Lines 36 and 37 identify the database {{super-user}} entry and associated
1103 password. This entry is not subject to access control or size or
1104 time limit restrictions.
1105
1106 Lines 38 through 40 indicate the indices to maintain for various
1107 attributes.
1108
1109 Lines 41 through 49 specify access control for entries in this
1110 database. For all applicable entries, the {{EX:userPassword}} attribute is writable
1111 by the entry itself and by the "admin" entry.  It may be used for
1112 authentication/authorization purposes, but is otherwise not readable.
1113 All other attributes are writable by the entry and the "admin"
1114 entry, but may be read by all users (authenticated or not).
1115
1116 Line 50 is a blank line, indicating the end of this entry.
1117
1118 The next entry defines another
1119 BDB database. This one handles queries involving the
1120 {{EX:dc=example,dc=net}} subtree but is managed by the same entity
1121 as the first database.  Note that without line 60, the read access
1122 would be allowed due to the global access rule at line 19.
1123
1124 E: 51.    # BDB definition for example.net
1125 E: 52.    dn: olcDatabase=bdb,cn=config
1126 E: 53.    objectClass: olcDatabaseConfig
1127 E: 54.    objectClass: olcBdbConfig
1128 E: 55.    olcDatabase: bdb
1129 E: 56.    olcSuffix: "dc=example,dc=net"
1130 E: 57.    olcDbDirectory: /usr/local/var/openldap-data-net
1131 E: 58.    olcRootDN: "cn=Manager,dc=example,dc=com"
1132 E: 59.    olcDbIndex: objectClass eq
1133 E: 60.    olcAccess: to * by users read
1134
1135
1136 H2: Converting old style {{slapd.conf}}(5) file to {{cn=config}} format
1137
1138 Before converting to the {{cn=config}} format you should make sure that the
1139 config backend is properly configured in your existing config file. While
1140 the config backend is always present inside slapd, by default it is only
1141 accessible by its rootDN, and there are no default credentials assigned
1142 so unless you explicitly configure a means to authenticate to it, it will be
1143 unusable.
1144
1145 If you do not already have a {{EX:database config}} section, add something
1146 like this to the end of {{EX:slapd.conf}}
1147
1148 > database config
1149 > rootpw VerySecret
1150
1151 Note: Since the config backend can be used to load arbitrary code into the
1152 slapd process, it is extremely important to carefully guard whatever
1153 credentials are used to access it. Since simple passwords are vulnerable to
1154 password guessing attacks, it is usually better to omit the rootpw and only
1155 use SASL authentication for the config rootDN.
1156
1157 An existing {{slapd.conf}}(5) file can be converted to the new format using
1158 {{slaptest}}(8) or any of the slap tools:
1159
1160 >       slaptest -f /usr/local/etc/openldap/slapd.conf -F /usr/local/etc/openldap/slapd.d
1161
1162 Test that you can access entries under {{EX:cn=config}} using the
1163 default {{rootdn}} and the {{rootpw}} configured above:
1164
1165 >       ldapsearch -x -D cn=config -w VerySecret -b cn=config
1166
1167 You can then discard the old {{slapd.conf}}(5) file. Make sure to launch
1168 {{slapd}}(8) with the {{-F}} option to specify the configuration directory
1169 if you are not using the default directory path.
1170
1171 Note: When converting from the slapd.conf format to slapd.d format, any
1172 included files will also be integrated into the resulting configuration
1173 database.