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