]> git.sur5r.net Git - openldap/blob - doc/guide/admin/slapdconf2.sdf
89d106c9e45f1cff8bc869ea4c19c9e574731c6b
[openldap] / doc / guide / admin / slapdconf2.sdf
1 # $OpenLDAP$
2 # Copyright 2005-2014 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_ciphersuite=<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.  Note that the main slapd TLS settings are not used by the
673 syncrepl engine; by default the TLS parameters from a {{ldap.conf}}(5)
674 configuration file will be used.  TLS settings may be specified here,
675 in which case any {{ldap.conf}}(5) settings will be completely ignored.
676
677 Rather than replicating whole entries, the consumer can query logs
678 of data modifications.  This mode of operation is referred to as
679 {{delta syncrepl}}.  In addition to the above parameters, the
680 {{EX:logbase}} and {{EX:logfilter}} parameters must be set appropriately
681 for the log that will be used. The {{EX:syncdata}} parameter must
682 be set to either {{EX:"accesslog"}} if the log conforms to the
683 {{slapo-accesslog}}(5) log format, or {{EX:"changelog"}} if the log
684 conforms to the obsolete {{changelog}} format. If the {{EX:syncdata}}
685 parameter is omitted or set to {{EX:"default"}} then the log
686 parameters are ignored.
687
688 The {{syncrepl}} replication mechanism is supported by the {{bdb}} and
689 {{hdb}} backends.
690
691 See the {{SECT:LDAP Sync Replication}} chapter of this guide for
692 more information on how to use this directive.
693
694
695 H4: olcTimeLimit: <integer>
696
697 This directive specifies the maximum number of seconds (in real
698 time) slapd will spend answering a search request. If a
699 request is not finished in this time, a result indicating an
700 exceeded timelimit will be returned.
701
702 \Default:
703
704 >       olcTimeLimit: 3600
705
706 See the {{SECT:Limits}} section of this guide and slapd-config(5)
707 for more details.
708
709
710 H4: olcUpdateref: <URL>
711
712 This directive is only applicable in a slave slapd. It
713 specifies the URL to return to clients which submit update
714 requests upon the replica.
715 If specified multiple times, each {{TERM:URL}} is provided.
716
717 \Example:
718
719 >       olcUpdateref:   ldap://master.example.net
720
721
722 H4: Sample Entries
723
724 >dn: olcDatabase=frontend,cn=config
725 >objectClass: olcDatabaseConfig
726 >objectClass: olcFrontendConfig
727 >olcDatabase: frontend
728 >olcReadOnly: FALSE
729 >
730 >dn: olcDatabase=config,cn=config
731 >objectClass: olcDatabaseConfig
732 >olcDatabase: config
733 >olcRootDN: cn=Manager,dc=example,dc=com
734
735
736 H3: BDB and HDB Database Directives
737
738 Directives in this category apply to both the {{TERM:BDB}}
739 and the {{TERM:HDB}} database.
740 They are used in an olcDatabase entry in addition to the generic
741 database directives defined above.  For a complete reference
742 of BDB/HDB configuration directives, see {{slapd-bdb}}(5). In
743 addition to the {{EX:olcDatabaseConfig}} objectClass, BDB and HDB
744 database entries must have the {{EX:olcBdbConfig}} and
745 {{EX:olcHdbConfig}} objectClass, respectively.
746
747
748 H4: olcDbDirectory: <directory>
749
750 This directive specifies the directory where the BDB files
751 containing the database and associated indices live.
752
753 \Default:
754
755 >       olcDbDirectory: /usr/local/var/openldap-data
756
757
758 H4: olcDbCachesize: <integer>
759
760 This directive specifies the size in entries of the in-memory
761 cache maintained by the BDB backend database instance.
762
763 \Default:
764
765 >       olcDbCachesize: 1000
766
767
768 H4: olcDbCheckpoint: <kbyte> <min>
769
770 This directive specifies how often to checkpoint the BDB transaction log.
771 A checkpoint operation flushes the database buffers to disk and writes a
772 checkpoint record in the log.
773 The checkpoint will occur if either <kbyte> data has been written or
774 <min> minutes have passed since the last checkpoint. Both arguments default
775 to zero, in which case they are ignored. When the <min> argument is
776 non-zero, an internal task will run every <min> minutes to perform the
777 checkpoint. See the Berkeley DB reference guide for more details.
778
779 \Example:
780
781 >       olcDbCheckpoint: 1024 10
782
783
784 H4: olcDbConfig: <DB_CONFIG setting>
785
786 This attribute specifies a configuration directive to be placed in the
787 {{EX:DB_CONFIG}} file of the database directory. At server startup time, if
788 no such file exists yet, the {{EX:DB_CONFIG}} file will be created and the
789 settings in this attribute will be written to it. If the file exists,
790 its contents will be read and displayed in this attribute. The attribute
791 is multi-valued, to accommodate multiple configuration directives. No default
792 is provided, but it is essential to use proper settings here to get the
793 best server performance.
794
795 Any changes made to this attribute will be written to the {{EX:DB_CONFIG}}
796 file and will cause the database environment to be reset so the changes
797 can take immediate effect. If the environment cache is large and has not
798 been recently checkpointed, this reset operation may take a long time. It
799 may be advisable to manually perform a single checkpoint using the Berkeley DB
800 {{db_checkpoint}} utility before using LDAP Modify to change this
801 attribute.
802
803 \Example:
804
805 >       olcDbConfig: set_cachesize 0 10485760 0
806 >       olcDbConfig: set_lg_bsize 2097512
807 >       olcDbConfig: set_lg_dir /var/tmp/bdb-log
808 >       olcDbConfig: set_flags DB_LOG_AUTOREMOVE
809
810 In this example, the BDB cache is set to 10MB, the BDB transaction log
811 buffer size is set to 2MB, and the transaction log files are to be stored
812 in the /var/tmp/bdb-log directory. Also a flag is set to tell BDB to
813 delete transaction log files as soon as their contents have been
814 checkpointed and they are no longer needed. Without this setting the
815 transaction log files will continue to accumulate until some other
816 cleanup procedure removes them. See the Berkeley DB documentation for the
817 {{EX:db_archive}} command for details. For a complete list of Berkeley DB 
818 flags please see - {{URL:http://www.oracle.com/technology/documentation/berkeley-db/db/api_c/env_set_flags.html}}
819
820 Ideally the BDB cache must be
821 at least as large as the working set of the database, the log buffer size
822 should be large enough to accommodate most transactions without overflowing,
823 and the log directory must be on a separate physical disk from the main
824 database files. And both the database directory and the log directory
825 should be separate from disks used for regular system activities such as
826 the root, boot, or swap filesystems. See the FAQ-o-Matic and the Berkeley DB
827 documentation for more details.
828
829
830 H4: olcDbNosync: { TRUE | FALSE }
831
832 This option causes on-disk database contents to not be immediately
833 synchronized with in memory changes upon change.  Setting this option
834 to {{EX:TRUE}} may improve performance at the expense of data integrity. This
835 directive has the same effect as using
836 >       olcDbConfig: set_flags DB_TXN_NOSYNC
837
838
839 H4: olcDbIDLcacheSize: <integer>
840
841 Specify the size of the in-memory index cache, in index slots. The
842 default is zero. A larger value will speed up frequent searches of
843 indexed entries. The optimal size will depend on the data and search
844 characteristics of the database, but using a number three times
845 the entry cache size is a good starting point.
846
847 \Example:
848
849 >       olcDbIDLcacheSize: 3000
850
851
852 H4: olcDbIndex: {<attrlist> | default} [pres,eq,approx,sub,none]
853
854 This directive specifies the indices to maintain for the given
855 attribute. If only an {{EX:<attrlist>}} is given, the default
856 indices are maintained. The index keywords correspond to the
857 common types of matches that may be used in an LDAP search filter.
858
859 \Example:
860
861 >       olcDbIndex: default pres,eq
862 >       olcDbIndex: uid
863 >       olcDbIndex: cn,sn pres,eq,sub
864 >       olcDbIndex: objectClass eq
865
866 The first line sets the default set of indices to maintain to
867 present and equality.  The second line causes the default (pres,eq)
868 set of indices to be maintained for the {{EX:uid}} attribute type.
869 The third line causes present, equality, and substring indices to
870 be maintained for {{EX:cn}} and {{EX:sn}} attribute types.  The
871 fourth line causes an equality index for the {{EX:objectClass}}
872 attribute type.
873
874 There is no index keyword for inequality matches. Generally these
875 matches do not use an index. However, some attributes do support
876 indexing for inequality matches, based on the equality index.
877
878 A substring index can be more explicitly specified as {{EX:subinitial}},
879 {{EX:subany}}, or {{EX:subfinal}}, corresponding to the three 
880 possible components
881 of a substring match filter. A subinitial index only indexes
882 substrings that appear at the beginning of an attribute value.
883 A subfinal index only indexes substrings that appear at the end
884 of an attribute value, while subany indexes substrings that occur
885 anywhere in a value.
886
887 Note that by default, setting an index for an attribute also
888 affects every subtype of that attribute. E.g., setting an equality
889 index on the {{EX:name}} attribute causes {{EX:cn}}, {{EX:sn}}, and every other
890 attribute that inherits from {{EX:name}} to be indexed.
891
892 By default, no indices are maintained.  It is generally advised
893 that minimally an equality index upon objectClass be maintained.
894
895 >       olcDbindex: objectClass eq
896
897 Additional indices should be configured corresponding to the
898 most common searches that are used on the database.
899 Presence indexing should not be configured for an attribute
900 unless the attribute occurs very rarely in the database, and
901 presence searches on the attribute occur very frequently during
902 normal use of the directory. Most applications don't use presence
903 searches, so usually presence indexing is not very useful.
904
905 If this setting is changed while slapd is running, an internal task
906 will be run to generate the changed index data. All server operations
907 can continue as normal while the indexer does its work.  If slapd is
908 stopped before the index task completes, indexing will have to be
909 manually completed using the slapindex tool.
910
911
912 H4: olcDbLinearIndex: { TRUE | FALSE }
913
914 If this setting is {{EX:TRUE}} slapindex will index one attribute
915 at a time. The default settings is {{EX:FALSE}} in which case all
916 indexed attributes of an entry are processed at the same time. When
917 enabled, each indexed attribute is processed individually, using
918 multiple passes through the entire database. This option improves
919 slapindex performance when the database size exceeds the BDB cache
920 size. When the BDB cache is large enough, this option is not needed
921 and will decrease performance. Also by default, slapadd performs
922 full indexing and so a separate slapindex run is not needed. With
923 this option, slapadd does no indexing and slapindex must be used.
924
925
926 H4: olcDbMode: { <octal> | <symbolic> }
927
928 This directive specifies the file protection mode that newly
929 created database index files should have. This can be in the form
930 {{EX:0600}} or {{EX:-rw-------}}
931
932 \Default:
933
934 >       olcDbMode: 0600
935
936
937 H4: olcDbSearchStack: <integer>
938
939 Specify the depth of the stack used for search filter evaluation.
940 Search filters are evaluated on a stack to accommodate nested {{EX:AND}} /
941 {{EX:OR}} clauses. An individual stack is allocated for each server thread.
942 The depth of the stack determines how complex a filter can be evaluated
943 without requiring any additional memory allocation. Filters that are
944 nested deeper than the search stack depth will cause a separate stack to
945 be allocated for that particular search operation. These separate allocations
946 can have a major negative impact on server performance, but specifying
947 too much stack will also consume a great deal of memory. Each search
948 uses 512K bytes per level on a 32-bit machine, or 1024K bytes per level
949 on a 64-bit machine. The default stack depth is 16, thus 8MB or 16MB
950 per thread is used on 32 and 64 bit machines, respectively. Also the
951 512KB size of a single stack slot is set by a compile-time constant which
952 may be changed if needed; the code must be recompiled for the change
953 to take effect.
954
955 \Default:
956
957 >       olcDbSearchStack: 16
958
959
960 H4: olcDbShmKey: <integer>
961
962 Specify a key for a shared memory BDB environment. By default the BDB
963 environment uses memory mapped files. If a non-zero value is specified,
964 it will be used as the key to identify a shared memory region that will
965 house the environment.
966
967 \Example:
968
969 >       olcDbShmKey: 42
970
971
972 H4: Sample Entry
973
974 >dn: olcDatabase=hdb,cn=config
975 >objectClass: olcDatabaseConfig
976 >objectClass: olcHdbConfig
977 >olcDatabase: hdb
978 >olcSuffix: "dc=example,dc=com"
979 >olcDbDirectory: /usr/local/var/openldap-data
980 >olcDbCacheSize: 1000
981 >olcDbCheckpoint: 1024 10
982 >olcDbConfig: set_cachesize 0 10485760 0
983 >olcDbConfig: set_lg_bsize 2097152
984 >olcDbConfig: set_lg_dir /var/tmp/bdb-log
985 >olcDbConfig: set_flags DB_LOG_AUTOREMOVE
986 >olcDbIDLcacheSize: 3000
987 >olcDbIndex: objectClass eq
988
989
990 H2: Configuration Example
991
992 The following is an example configuration, interspersed
993 with explanatory text. It defines two databases to handle
994 different parts of the {{TERM:X.500}} tree; both are {{TERM:BDB}}
995 database instances. The line numbers shown are provided for
996 reference only and are not included in the actual file. First, the
997 global configuration section:
998
999 E:  1.    # example config file - global configuration entry
1000 E:  2.    dn: cn=config
1001 E:  3.    objectClass: olcGlobal
1002 E:  4.    cn: config
1003 E:  5.    olcReferral: ldap://root.openldap.org
1004 E:  6.    
1005
1006 Line 1 is a comment. Lines 2-4 identify this as the global
1007 configuration entry.
1008 The {{EX:olcReferral:}} directive on line 5
1009 means that queries not local to one of the databases defined
1010 below will be referred to the LDAP server running on the
1011 standard port (389) at the host {{EX:root.openldap.org}}.
1012 Line 6 is a blank line, indicating the end of this entry.
1013
1014 E:  7.    # internal schema
1015 E:  8.    dn: cn=schema,cn=config
1016 E:  9.    objectClass: olcSchemaConfig
1017 E: 10.    cn: schema
1018 E: 11.    
1019
1020 Line 7 is a comment. Lines 8-10 identify this as the root of
1021 the schema subtree. The actual schema definitions in this entry
1022 are hardcoded into slapd so no additional attributes are specified here.
1023 Line 11 is a blank line, indicating the end of this entry.
1024
1025 E: 12.    # include the core schema
1026 E: 13.    include: file:///usr/local/etc/openldap/schema/core.ldif
1027 E: 14.    
1028
1029 Line 12 is a comment. Line 13 is an LDIF include directive which
1030 accesses the {{core}} schema definitions in LDIF format. Line 14
1031 is a blank line.
1032
1033 Next comes the database definitions. The first database is the
1034 special {{EX:frontend}} database whose settings are applied globally
1035 to all the other databases.
1036
1037 E: 15.    # global database parameters
1038 E: 16.    dn: olcDatabase=frontend,cn=config
1039 E: 17.    objectClass: olcDatabaseConfig
1040 E: 18.    olcDatabase: frontend
1041 E: 19.    olcAccess: to * by * read
1042 E: 20.    
1043
1044 Line 15 is a comment. Lines 16-18 identify this entry as the global
1045 database entry. Line 19 is a global access control. It applies to all
1046 entries (after any applicable database-specific access controls).
1047 Line 20 is a blank line.
1048
1049 The next entry defines the config backend.
1050
1051 E: 21.    # set a rootpw for the config database so we can bind.
1052 E: 22.    # deny access to everyone else.
1053 E: 23.    dn: olcDatabase=config,cn=config
1054 E: 24.    objectClass: olcDatabaseConfig
1055 E: 25.    olcDatabase: config
1056 E: 26.    olcRootPW: {SSHA}XKYnrjvGT3wZFQrDD5040US592LxsdLy
1057 E: 27.    olcAccess: to * by * none
1058 E: 28.
1059
1060 Lines 21-22 are comments. Lines 23-25 identify this entry as the config
1061 database entry. Line 26 defines the {{super-user}} password for this
1062 database. (The DN defaults to {{"cn=config"}}.) Line 27 denies all access
1063 to this database, so only the super-user will be able to access it. (This
1064 is already the default access on the config database. It is just listed
1065 here for illustration, and to reiterate that unless a means to authenticate
1066 as the super-user is explicitly configured, the config database will be
1067 inaccessible.)
1068
1069 Line 28 is a blank line.
1070
1071 The next entry defines a BDB backend that will handle queries for things
1072 in the "dc=example,dc=com" portion of the tree. Indices are to be maintained
1073 for several attributes, and the {{EX:userPassword}} attribute is to be
1074 protected from unauthorized access.
1075
1076 E: 29.    # BDB definition for example.com
1077 E: 30.    dn: olcDatabase=bdb,cn=config
1078 E: 31.    objectClass: olcDatabaseConfig
1079 E: 32.    objectClass: olcBdbConfig
1080 E: 33.    olcDatabase: bdb
1081 E: 34.    olcSuffix: dc=example,dc=com
1082 E: 35.    olcDbDirectory: /usr/local/var/openldap-data
1083 E: 36.    olcRootDN: cn=Manager,dc=example,dc=com
1084 E: 37.    olcRootPW: secret
1085 E: 38.    olcDbIndex: uid pres,eq
1086 E: 39.    olcDbIndex: cn,sn pres,eq,approx,sub
1087 E: 40.    olcDbIndex: objectClass eq
1088 E: 41.    olcAccess: to attrs=userPassword
1089 E: 42.      by self write
1090 E: 43.      by anonymous auth
1091 E: 44.      by dn.base="cn=Admin,dc=example,dc=com" write
1092 E: 45.      by * none
1093 E: 46.    olcAccess: to *
1094 E: 47.      by self write
1095 E: 48.      by dn.base="cn=Admin,dc=example,dc=com" write
1096 E: 49.      by * read
1097 E: 50.    
1098
1099 Line 29 is a comment. Lines 30-33 identify this entry as a BDB database
1100 configuration entry.  Line 34 specifies the DN suffix
1101 for queries to pass to this database. Line 35 specifies the directory
1102 in which the database files will live.
1103
1104 Lines 36 and 37 identify the database {{super-user}} entry and associated
1105 password. This entry is not subject to access control or size or
1106 time limit restrictions.
1107
1108 Lines 38 through 40 indicate the indices to maintain for various
1109 attributes.
1110
1111 Lines 41 through 49 specify access control for entries in this
1112 database. For all applicable entries, the {{EX:userPassword}} attribute is writable
1113 by the entry itself and by the "admin" entry.  It may be used for
1114 authentication/authorization purposes, but is otherwise not readable.
1115 All other attributes are writable by the entry and the "admin"
1116 entry, but may be read by all users (authenticated or not).
1117
1118 Line 50 is a blank line, indicating the end of this entry.
1119
1120 The next entry defines another
1121 BDB database. This one handles queries involving the
1122 {{EX:dc=example,dc=net}} subtree but is managed by the same entity
1123 as the first database.  Note that without line 60, the read access
1124 would be allowed due to the global access rule at line 19.
1125
1126 E: 51.    # BDB definition for example.net
1127 E: 52.    dn: olcDatabase=bdb,cn=config
1128 E: 53.    objectClass: olcDatabaseConfig
1129 E: 54.    objectClass: olcBdbConfig
1130 E: 55.    olcDatabase: bdb
1131 E: 56.    olcSuffix: "dc=example,dc=net"
1132 E: 57.    olcDbDirectory: /usr/local/var/openldap-data-net
1133 E: 58.    olcRootDN: "cn=Manager,dc=example,dc=com"
1134 E: 59.    olcDbIndex: objectClass eq
1135 E: 60.    olcAccess: to * by users read
1136
1137
1138 H2: Converting old style {{slapd.conf}}(5) file to {{cn=config}} format
1139
1140 Before converting to the {{cn=config}} format you should make sure that the
1141 config backend is properly configured in your existing config file. While
1142 the config backend is always present inside slapd, by default it is only
1143 accessible by its rootDN, and there are no default credentials assigned
1144 so unless you explicitly configure a means to authenticate to it, it will be
1145 unusable.
1146
1147 If you do not already have a {{EX:database config}} section, add something
1148 like this to the end of {{EX:slapd.conf}}
1149
1150 > database config
1151 > rootpw VerySecret
1152
1153 Note: Since the config backend can be used to load arbitrary code into the
1154 slapd process, it is extremely important to carefully guard whatever
1155 credentials are used to access it. Since simple passwords are vulnerable to
1156 password guessing attacks, it is usually better to omit the rootpw and only
1157 use SASL authentication for the config rootDN.
1158
1159 An existing {{slapd.conf}}(5) file can be converted to the new format using
1160 {{slaptest}}(8) or any of the slap tools:
1161
1162 >       slaptest -f /usr/local/etc/openldap/slapd.conf -F /usr/local/etc/openldap/slapd.d
1163
1164 Test that you can access entries under {{EX:cn=config}} using the
1165 default {{rootdn}} and the {{rootpw}} configured above:
1166
1167 >       ldapsearch -x -D cn=config -w VerySecret -b cn=config
1168
1169 You can then discard the old {{slapd.conf}}(5) file. Make sure to launch
1170 {{slapd}}(8) with the {{-F}} option to specify the configuration directory
1171 if you are not using the default directory path.
1172
1173 Note: When converting from the slapd.conf format to slapd.d format, any
1174 included files will also be integrated into the resulting configuration
1175 database.