2 # Copyright 2005, The OpenLDAP Foundation, All Rights Reserved.
3 # COPYING RESTRICTIONS APPLY, see COPYRIGHT.
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 runtime configuration in 2.3 is
10 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.d}}(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.
23 An alternate configuration directory (or file) can be specified via a
24 command-line option to {{slapd}}(8) or {{slurpd}}(8). This chapter
25 describes the general format of the configuration system, followed by a
26 detailed description of commonly used config settings.
29 H2: Configuration Layout
31 The slapd configuration is stored as a special LDAP directory with
32 a predefined schema and DIT. There are specific objectClasses used to
33 carry global configuration options, schema definitions, backend and
34 database definitions, and assorted other items. A sample config tree
35 is shown in Figure 5.1.
37 !import "config_dit.gif"; align="center"; title="Sample configuration tree"
38 FT[align="Center"] Figure 5.1: Sample configuration tree.
40 Other objects may be part of the configuration but were omitted from
41 the illustration for clarity.
43 The {{slapd.d}} configuration tree has a very specific structure. The
44 root of the tree is named {{EX:cn=config}} and contains global configuration
45 settings. Additional settings are contained in separate child entries:
47 .. Usually these are just pathnames left over from a converted
48 {{EX:slapd.conf}} file.
49 .. Otherwise use of Include files is deprecated.
50 * Dynamically loaded modules
51 .. These may only be used if the {{EX:--enable-modules}} option was
52 used to configure the software.
54 .. The {{EX:cn=schema,cn=config}} entry contains the system schema (all
55 the schema that is hard-coded in slapd).
56 .. Child entries of {{EX:cn=schema,cn=config}} contain user schema as
57 loaded from config files or added at runtime.
58 * Backend-specific configuration
59 * Database-specific configuration
60 .. Overlays are defined in children of the Database entry.
61 .. Databases and Overlays may also have other miscellaneous children.
63 The usual rules for LDIF files apply to the configuration information:
64 Comment lines beginning with a '{{EX:#}}' character
65 are ignored. If a line begins with white space, it is considered a
66 continuation of the previous line (even if the previous line is a
67 comment). Entries are separated by blank lines.
69 The general layout of the config LDIF is as follows:
71 > # global configuration settings
73 > objectClass: olcGlobal
75 > <global config settings>
77 > # schema definitions
78 > dn: cn=schema,cn=config
79 > objectClass: olcSchemaConfig
83 > dn: cn={X}core,cn=schema,cn=config
84 > objectClass: olcSchemaConfig
88 > # additional user-specified schema
91 > # backend definitions
92 > dn: olcBackend=<typeA>,cn=config
93 > objectClass: olcBackendConfig
95 > <backend-specific settings>
97 > # database definitions
98 > dn: olcDatabase={X}<typeA>,cn=config
99 > objectClass: olcDatabaseConfig
100 > olcDatabase: {X}<typeA>
101 > <database-specific settings>
103 > # subsequent definitions and settings
106 Some of the entries listed above have a numeric index {{EX:"{X}"}} in
107 their names. While most configuration settings have an inherent ordering
108 dependency (i.e., one setting must take effect before a subsequent one
109 may be set), LDAP databases are inherently unordered. The numeric index
110 is used to enforce a consistent ordering in the configuration database,
111 so that all ordering dependencies are preserved. In most cases the index
112 does not have to be provided; it will be automatically generated based
113 on the order in which entries are created.
115 Configuration directives are specified as values of individual
117 Most of the attributes and objectClasses used in the slapd
118 configuration have a prefix of {{EX:"olc"}} (OpenLDAP Configuration)
119 in their names. Generally there is a one-to-one correspondence
120 between the attributes and the old-style {{EX:slapd.conf}} configuration
121 keywords, using the keyword as the attribute name, with the "olc"
124 A configuration directive may take arguments. If so, the arguments are
125 separated by white space. If an argument contains white space,
126 the argument should be enclosed in double quotes {{EX:"like this"}}. If
127 an argument contains a double quote or a backslash character `{{EX:\}}',
128 the character should be preceded by a backslash character `{{EX:\}}'.
129 In the descriptions that follow, arguments that should be replaced
130 by actual text are shown in brackets {{EX:<>}}.
132 The distribution contains an example configuration file that will
133 be installed in the {{F: /usr/local/etc/openldap}} directory.
134 A number of files containing schema definitions (attribute types
135 and object classes) are also provided in the
136 {{F: /usr/local/etc/openldap/schema}} directory.
139 H2: Configuration Directives
141 This section details commonly used configuration directives. For
142 a complete list, see the {{slapd.d}}(5) manual page. This section
143 will treat the configuration directives in a top-down order, starting
144 with the global directives in the {{EX:cn=config}} entry. Each
145 directive will be described along with its default value (if any) and
146 an example of its use.
151 Directives contained in this entry generally apply to the server as a whole.
152 Most of them are system or connection oriented, not database related. This
153 entry must have the {{EX:olcGlobal}} objectClass.
156 H4: olcIdleTimeout: <integer>
158 Specify the number of seconds to wait before forcibly closing
159 an idle client connection. A value of 0, the default,
160 disables this feature.
163 H4: olcLogLevel: <level>
165 This directive specifies the level at which debugging statements
166 and operation statistics should be syslogged (currently logged to
167 the {{syslogd}}(8) {{EX:LOG_LOCAL4}} facility). You must have
168 configured OpenLDAP {{EX:--enable-debug}} (the default) for this
169 to work (except for the two statistics levels, which are always
170 enabled). Log levels may be specified as integers or by keyword.
171 Multiple log levels may be used and the levels are additive.
172 To display what levels
173 correspond to what kind of debugging, invoke slapd with {{EX:-?}}
174 or consult the table below. The possible values for <level> are:
176 !block table; colaligns="RL"; align=Center; \
177 title="Table 5.1: Debugging Levels"
178 Level Keyword Description
179 -1 Any enable all debugging
181 1 Trace trace function calls
182 2 Packets debug packet handling
183 4 Args heavy trace debugging
184 8 Conns connection management
185 16 BER print out packets sent and received
186 32 Filter search filter processing
187 64 Config configuration processing
188 128 ACL access control list processing
189 256 Stats stats log connections/operations/results
190 512 Stats2 stats log entries sent
191 1024 Shell print communication with shell backends
192 2048 Parse print entry parsing debugging
193 4096 Cache database cache processing
194 8192 Index database indexing
195 16384 Sync syncrepl consumer processing
202 This will cause lots and lots of debugging information to be
205 E: olcLogLevel: Conns Filter
207 Just log the connection and search filter processing.
211 E: olcLogLevel: Stats
214 H4: olcReferral <URI>
216 This directive specifies the referral to pass back when slapd
217 cannot find a local database to handle a request.
221 > olcReferral: ldap://root.openldap.org
223 This will refer non-local queries to the global root LDAP server
224 at the OpenLDAP Project. Smart LDAP clients can re-ask their
225 query at that server, but note that most of these clients are
226 only going to know how to handle simple LDAP URLs that
227 contain a host part and optionally a distinguished name part.
233 >objectClass: olcGlobal
237 >olcReferral: ldap://root.openldap.org
243 An include entry holds the pathname of one include file. Include files
244 are part of the old style slapd.conf configuration system and must be in
245 slapd.conf format. Include files were commonly used to load schema
246 specifications. While they are still supported, their use is deprecated.
247 Include entries must have the {{EX:olcIncludeFile}} objectClass.
250 H4: olcInclude: <filename>
252 This directive specifies that slapd should read additional
253 configuration information from the given file.
255 Note: You should be careful when using this directive - there is
256 no small limit on the number of nested include directives, and no
257 loop detection is done.
262 >dn: cn=include{0},cn=config
263 >objectClass: olcIncludeFile
265 >olcInclude: ./schema/core.schema
267 >dn: cn=include{1},cn=config
268 >objectClass: olcIncludeFile
270 >olcInclude: ./schema/cosine.schema
275 The cn=schema entry holds all of the schema definitions that are hard-coded
276 in slapd. As such, the values in this entry are generated by slapd so no
277 schema values need to be provided in the config file. The entry must still
278 be defined though, to serve as a base for the user-defined schema to add
279 in underneath. Schema entries must have the {{EX:olcSchemaConfig}}
283 H4: olcAttributeTypes: <{{REF:RFC2252}} Attribute Type Description>
285 This directive defines an attribute type.
286 Please see the {{SECT:Schema Specification}} chapter
287 for information regarding how to use this directive.
290 H4: olcObjectClasses: <{{REF:RFC2252}} Object Class Description>
292 This directive defines an object class.
293 Please see the {{SECT:Schema Specification}} chapter for
294 information regarding how to use this directive.
299 >dn: cn=schema,cn=config
300 >objectClass: olcSchemaConfig
303 >dn: cn=test,cn=schema,cn=config
304 >objectClass: olcSchemaConfig
306 >olcAttributeTypes: ( 1.1.1
308 > EQUALITY integerMatch
309 > SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )
310 >olcAttributeTypes: ( 1.1.2 NAME 'testTwo' EQUALITY caseIgnoreMatch
311 > SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.44 )
312 >olcObjectClasses: ( 1.1.3 NAME 'testObject'
313 > MAY ( testAttr $ testTwo ) AUXILIARY )
316 H3: Backend-specific Directives
318 Backend directives apply to all database instances of the
319 same type and, depending on the directive, may be overridden
320 by database directives. Backend entries must have the
321 {{EX:olcBackendConfig}} objectClass.
323 H4: olcBackend: <type>
325 This directive names a backend-specific configuration entry.
326 {{EX:<type>}} should be one of the
327 supported backend types listed in Table 5.2.
329 !block table; align=Center; coltags="EX,N"; \
330 title="Table 5.2: Database Backends"
332 bdb Berkeley DB transactional backend
333 dnssrv DNS SRV backend
334 ldap Lightweight Directory Access Protocol (Proxy) backend
335 ldbm Lightweight DBM backend
336 ldif Lightweight Data Interchange Format backend
337 meta Meta Directory backend
338 monitor Monitor backend
339 passwd Provides read-only access to {{passwd}}(5)
340 perl Perl Programmable backend
341 shell Shell (extern program) backend
342 sql SQL Programmable backend
349 There are no other directives defined for this entry, so generally
350 it will not be needed. However, specific backend types may define
351 additional attributes for their particular use.
356 > dn: olcBackend=bdb,cn=config
357 > objectClass: olcBackendConfig
361 H3: Database-specific Directives
363 Directives in this section are supported by every type of database.
364 Database entries must have the {{EX:olcDatabaseConfig}} objectClass.
366 H4: olcDatabase: [{<index>}]<type>
368 This directive names a specific database instance. The numeric {<index>} may
369 be provided to distinguish multiple databases of the same type. Usually the
370 index can be omitted, and slapd will generate it automatically.
371 {{EX:<type>}} should be one of the
372 supported backend types listed in Table 5.2 or the {{EX:frontend}} type.
374 The {{EX:frontend}} is a special database that is used to hold
375 database-level options that should be applied to all the other
376 databases. Subsequent database definitions may also override some
383 This marks the beginning of a new {{TERM:BDB}} database instance.
386 H4: olcAccess: to <what> [ by <who> <accesslevel> <control> ]+
388 This directive grants access (specified by <accesslevel>) to a
389 set of entries and/or attributes (specified by <what>) by one or
390 more requesters (specified by <who>).
391 See the {{SECT:Access Control}} section of this chapter for a
392 summary of basic usage.
395 More detailed discussion of this directive can be found in the
396 {{SECT:Advanced Access Control}} chapter.
399 Note: If no {{EX:olcAccess}} directives are specified, the default
400 access control policy, {{EX:to * by * read}}, allows all
401 users (both authenticated and anonymous) read access.
403 Note: Access controls defined in the frontend are appended to all
404 other databases' controls.
407 H4: olcReadonly { TRUE | FALSE }
409 This directive puts the database into "read-only" mode. Any
410 attempts to modify the database will return an "unwilling to
420 > olcReplica: uri=ldap[s]://<hostname>[:<port>] | host=<hostname>[:<port>]
421 > [bindmethod={simple|sasl}]
424 > [authcid=<identity>]
425 > [authzid=<identity>]
426 > [credentials=<password>]
428 This directive specifies a replication site for this database for
430 {{EX:uri=}} parameter specifies a scheme, a host and optionally a port where
431 the slave slapd instance can be found. Either a domain name
432 or IP address may be used for <hostname>. If <port> is not
433 given, the standard LDAP port number (389 or 636) is used.
435 {{EX:host}} is deprecated in favor of the {{EX:uri}} parameter.
437 {{EX:uri}} allows the replica LDAP server to be specified as an LDAP
438 URI such as {{EX:ldap://slave.example.com:389}} or
439 {{EX:ldaps://slave.example.com:636}}.
441 The {{EX:binddn=}} parameter gives the DN to bind as for updates
442 to the slave slapd. It should be a DN which has read/write access
443 to the slave slapd's database. It must also match the {{EX:updatedn}}
444 directive in the slave slapd's config file. Generally, this DN
445 {{should not}} be the same as the {{EX:rootdn}} of the master
446 database. Since DNs are likely to contain embedded spaces, the
447 entire {{EX:"binddn=<DN>"}} string should be enclosed in double
450 The {{EX:bindmethod}} is {{EX:simple}} or {{EX:sasl}},
451 depending on whether simple password-based authentication
452 or {{TERM:SASL}} authentication is to be used when connecting
455 Simple authentication should not be used unless adequate data
456 integrity and confidentiality protections are in place (e.g. TLS
457 or IPSEC). Simple authentication requires specification of
458 {{EX:binddn}} and {{EX:credentials}} parameters.
460 SASL authentication is generally recommended. SASL authentication
461 requires specification of a mechanism using the {{EX:saslmech}} parameter.
462 Depending on the mechanism, an authentication identity and/or
463 credentials can be specified using {{EX:authcid}} and {{EX:credentials}}
464 respectively. The {{EX:authzid}} parameter may be used to specify
465 an authorization identity.
467 See the chapter entitled {{SECT:Replication with slurpd}} for more
468 information on how to use this directive.
471 H4: olcReplogfile: <filename>
473 This directive specifies the name of the replication log file to
474 which slapd will log changes. The replication log is typically
475 written by slapd and read by slurpd. Normally, this directive is
476 only used if slurpd is being used to replicate the database.
477 However, you can also use it to generate a transaction log, if
478 slurpd is not running. In this case, you will need to periodically
479 truncate the file, since it will grow indefinitely otherwise.
481 See the chapter entitled {{SECT:Replication with slurpd}} for more
482 information on how to use this directive.
487 This directive specifies the DN that is not subject to
488 access control or administrative limit restrictions for
489 operations on this database. The DN need not refer to
490 an entry in this database or even in the directory. The
491 DN may refer to a SASL identity.
495 > olcRootDN: "cn=Manager,dc=example,dc=com"
499 > olcRootDN: "uid=root,cn=example.com,cn=digest-md5,cn=auth"
501 See the {{SECT:SASL Authentication}} section for information on
502 SASL authentication identities.
505 H4: olcRootPW: <password>
507 This directive can be used to specify a password for the DN for
508 the rootdn (when the rootdn is set to a DN within the database).
514 It is also permissible to provide a hash of the password in RFC 2307
515 form. {{slappasswd}}(8) may be used to generate the password hash.
519 > olcRootPW: {SSHA}ZKKuqbEKJfKSXhUbHG3fG8MDn9j1v4QN
521 The hash was generated using the command {{EX:slappasswd -s secret}}.
524 H4: olcSizeLimit: <integer>
526 This directive specifies the maximum number of entries to return
527 from a search operation.
535 H4: olcSuffix: <dn suffix>
537 This directive specifies the DN suffix of queries that will be
538 passed to this backend database. Multiple suffix lines can be
539 given, and usually at least one is required for each database
540 definition. (Some backend types, such as {{EX:frontend}} and
541 {{EX:monitor}} use a hard-coded suffix which may not be overridden
542 in the configuration.)
546 > olcSuffix: "dc=example,dc=com"
548 Queries with a DN ending in "dc=example,dc=com"
549 will be passed to this backend.
551 Note: When the backend to pass a query to is selected, slapd
552 looks at the suffix value(s) in each database definition in the
553 order in which they were configured. Thus, if one database suffix is a
554 prefix of another, it must appear after it in the configuration.
559 > olcSyncrepl: rid=<replica ID>
560 > provider=ldap[s]://<hostname>[:port]
561 > [type=refreshOnly|refreshAndPersist]
562 > [interval=dd:hh:mm:ss]
563 > [retry=[<retry interval> <# of retries>]+]
564 > [searchbase=<base DN>]
565 > [filter=<filter str>]
566 > [scope=sub|one|base]
567 > [attrs=<attr list>]
569 > [sizelimit=<limit>]
570 > [timelimit=<limit>]
571 > [schemachecking=on|off]
572 > [bindmethod=simple|sasl]
575 > [authcid=<identity>]
576 > [authzid=<identity>]
577 > [credentials=<passwd>]
579 > [secprops=<properties>]
582 This directive specifies the current database as a replica of the
583 master content by establishing the current {{slapd}}(8) as a
584 replication consumer site running a syncrepl replication engine.
585 The master database is located at the replication provider site
586 specified by the {{EX:provider}} parameter. The replica database is
587 kept up-to-date with the master content using the LDAP Content
588 Synchronization protocol. See {{EX:draft-zeilenga-ldup-sync-xx.txt}}
589 ({{a work in progress}}) for more information on the protocol.
591 The {{EX:rid}} parameter is used for identification of the current
592 {{EX:syncrepl}} directive within the replication consumer server,
593 where {{EX:<replica ID>}} uniquely identifies the syncrepl specification
594 described by the current {{EX:syncrepl}} directive. {{EX:<replica ID>}}
595 is non-negative and is no more than three decimal digits in length.
597 The {{EX:provider}} parameter specifies the replication provider site
598 containing the master content as an LDAP URI. The {{EX:provider}}
599 parameter specifies a scheme, a host and optionally a port where the
600 provider slapd instance can be found. Either a domain name or IP
601 address may be used for <hostname>. Examples are
602 {{EX:ldap://provider.example.com:389}} or {{EX:ldaps://192.168.1.1:636}}.
603 If <port> is not given, the standard LDAP port number (389 or 636) is used.
604 Note that the syncrepl uses a consumer-initiated protocol, and hence its
605 specification is located at the consumer site, whereas the {{EX:replica}}
606 specification is located at the provider site. {{EX:syncrepl}} and
607 {{EX:replica}} directives define two independent replication
608 mechanisms. They do not represent the replication peers of each other.
610 The content of the syncrepl replica is defined using a search
611 specification as its result set. The consumer slapd will
612 send search requests to the provider slapd according to the search
613 specification. The search specification includes {{EX:searchbase}},
614 {{EX:scope}}, {{EX:filter}}, {{EX:attrs}}, {{EX:attrsonly}},
615 {{EX:sizelimit}}, and {{EX:timelimit}} parameters as in the normal
616 search specification. The syncrepl search specification has
617 the same value syntax and the same default values as in the
618 {{ldapsearch}}(1) client search tool.
620 The LDAP Content Synchronization protocol has two operation
621 types: {{EX:refreshOnly}} and {{EX:refreshAndPersist}}.
622 The operation type is specified by the {{EX:type}} parameter.
623 In the {{EX:refreshOnly}} operation, the next synchronization search operation
624 is periodically rescheduled at an interval time after each
625 synchronization operation finishes. The interval is specified
626 by the {{EX:interval}} parameter. It is set to one day by default.
627 In the {{EX:refreshAndPersist}} operation, a synchronization search
628 remains persistent in the provider slapd. Further updates to the
629 master replica will generate {{EX:searchResultEntry}} to the consumer slapd
630 as the search responses to the persistent synchronization search.
632 If an error occurs during replication, the consumer will attempt to reconnect
633 according to the retry parameter which is a list of the <retry interval>
634 and <# of retries> pairs. For example, retry="60 10 300 3" lets the consumer
635 retry every 60 seconds for the first 10 times and then retry every 300 seconds
636 for the next three times before stop retrying. + in <# of retries> means
637 indefinite number of retries until success.
639 The schema checking can be enforced at the LDAP Sync consumer site
640 by turning on the {{EX:schemachecking}} parameter.
641 If it is turned on, every replicated entry will be checked for its
642 schema as the entry is stored into the replica content.
643 Every entry in the replica should contain those attributes
644 required by the schema definition.
645 If it is turned off, entries will be stored without checking
646 schema conformance. The default is off.
648 The {{EX:binddn}} parameter gives the DN to bind as for the
649 syncrepl searches to the provider slapd. It should be a DN
650 which has read access to the replication content in the
653 The {{EX:bindmethod}} is {{EX:simple}} or {{EX:sasl}},
654 depending on whether simple password-based authentication or
655 {{TERM:SASL}} authentication is to be used when connecting
656 to the provider slapd.
658 Simple authentication should not be used unless adequate data
659 integrity and confidentiality protections are in place (e.g. TLS
660 or IPSEC). Simple authentication requires specification of {{EX:binddn}}
661 and {{EX:credentials}} parameters.
663 SASL authentication is generally recommended. SASL authentication
664 requires specification of a mechanism using the {{EX:saslmech}} parameter.
665 Depending on the mechanism, an authentication identity and/or
666 credentials can be specified using {{EX:authcid}} and {{EX:credentials}},
667 respectively. The {{EX:authzid}} parameter may be used to specify
668 an authorization identity.
670 The {{EX:realm}} parameter specifies a realm which a certain
671 mechanisms authenticate the identity within. The {{EX:secprops}}
672 parameter specifies Cyrus SASL security properties.
674 The syncrepl replication mechanism is supported by the
675 three native backends: back-bdb, back-hdb, and back-ldbm.
677 See the {{SECT:LDAP Sync Replication}} chapter of the admin guide
678 for more information on how to use this directive.
681 H4: olcTimeLimit: <integer>
683 This directive specifies the maximum number of seconds (in real
684 time) slapd will spend answering a search request. If a
685 request is not finished in this time, a result indicating an
686 exceeded timelimit will be returned.
693 H4: olcUpdateDN: <DN>
695 This directive is only applicable in a slave slapd. It specifies
696 the DN allowed to make changes to the replica. This may be the DN
697 {{slurpd}}(8) binds as when making changes to the replica or the DN
698 associated with a SASL identity.
702 > olcUpdateDN: "cn=Update Daemon,dc=example,dc=com"
706 > olcUpdateDN: "uid=slurpd,cn=example.com,cn=digest-md5,cn=auth"
708 See the {{SECT:Replication with slurpd}} chapter for more information
709 on how to use this directive.
711 H4: olcUpdateref: <URL>
713 This directive is only applicable in a slave slapd. It
714 specifies the URL to return to clients which submit update
715 requests upon the replica.
716 If specified multiple times, each {{TERM:URL}} is provided.
720 > olcUpdateref: ldap://master.example.net
725 >dn: olcDatabase=frontend,cn=config
726 >objectClass: olcDatabaseConfig
727 >olcDatabase: frontend
730 H3: BDB and HDB Database Directives
732 Directives in this category apply to both the {{TERM:BDB}}
733 and the {{TERM:HDB}} database.
734 They are used in an olcDatabase entry in addition to the generic
735 database directives defined above. For a complete reference
736 of BDB/HDB configuration directives, see {{slapd-bdb}}(5). BDB and
737 HDB database entries must have the {{EX:olcBdbConfig}} objectClass.
740 H4: olcDbDirectory: <directory>
742 This directive specifies the directory where the BDB files
743 containing the database and associated indices live.
747 > olcDbDirectory: /usr/local/var/openldap-data
750 H4: olcDbCachesize: <integer>
752 This directive specifies the size in entries of the in-memory
753 cache maintained by the BDB backend database instance.
757 > olcDbCachesize: 1000
760 H4: olcDbCheckpoint: <kbyte> <min>
762 This directive specifies how often to checkpoint the BDB transaction log.
763 A checkpoint operation flushes the database buffers to disk and writes a
764 checkpoint record in the log.
765 The checkpoint will occur if either <kbyte> data has been written or
766 <min> minutes have passed since the last checkpont. Both arguments default
767 to zero, in which case they are ignored. When the <min> argument is
768 non-zero, an internal task will run every <min> minutes to perform the
769 checkpoint. See the Berkeley DB reference guide for more details.
773 > olcDbCheckpoint: 1024 10
776 H4: olcDbConfig: <DB_CONFIG setting>
778 This attribute specifies a configuration directive to be placed in the
779 {{EX:DB_CONFIG}} file of the database directory. At server startup time, if
780 no such file exists yet, the {{EX:DB_CONFIG}} file will be created and the
781 settings in this attribute will be written to it. If the file exists,
782 its contents will be read and displayed in this attribute. The attribute
783 is multi-valued, to accomodate multiple configuration directives. No default
784 is provided, but it is essential to use proper settings here to get the
785 best server performance.
789 > olcDbConfig: set_cachesize 0 10485760 0
790 > olcDbConfig: set_lg_bsize 2097512
791 > olcDbConfig: set_lg_dir /var/tmp/bdb-log
792 > olcDbConfig: set_flags DB_LOG_AUTOREMOVE
794 In this example, the BDB cache is set to 10MB, the BDB transaction log
795 buffer size is set to 2MB, and the transaction log files are to be stored
796 in the /var/tmp/bdb-log directory. Also a flag is set to tell BDB to
797 delete transaction log files as soon as their contents have been
798 checkpointed and they are no longer needed. Without this setting the
799 transaction log files will continue to accumulate until some other
800 cleanup procedure removes them. See the SleepyCat documentation for the
801 {{EX:db_archive}} command for details.
803 Ideally the BDB cache must be
804 at least as large as the working set of the database, the log buffer size
805 should be large enough to accomodate most transactions without overflowing,
806 and the log directory must be on a separate physical disk from the main
807 database files. And both the database directory and the log directory
808 should be separate from disks used for regular system activities such as
809 the root, boot, or swap filesystems. See the FAQ-o-Matic and the SleepyCat
810 documentation for more details.
813 H4: olcDbNosync: <TRUE|FALSE>
815 This option causes on-disk database contents to not be immediately
816 synchronized with in memory changes upon change. Setting this option
817 to TRUE may improve performance at the expense of data integrity. This
818 directive has the same effect as using
819 > olcDbConfig: set_flags DB_TXN_NOSYNC
822 H4: olcDbIDLcacheSize: <integer>
824 Specify the size of the in-memory index cache, in index slots. The
825 default is zero. A larger value will speed up frequent searches of
826 indexed entries. The optimal size will depend on the data and search
827 characteristics of the database, but using a number three times
828 the entry cache size is a good starting point.
832 > olcDbIDLcacheSize: 3000
835 H4: olcDbIndex: {<attrlist> | default} [pres,eq,approx,sub,none]
837 This directive specifies the indices to maintain for the given
838 attribute. If only an {{EX:<attrlist>}} is given, the default
839 indices are maintained.
843 > olcDbIndex: default pres,eq
845 > olcDbIndex: cn,sn pres,eq,sub
846 > olcDbIndex: objectClass eq
848 The first line sets the default set of indices to maintain to
849 present and equality. The second line causes the default (pres,eq)
850 set of indices to be maintained for the {{EX:uid}} attribute type.
851 The third line causes present, equality, and substring indices to
852 be maintained for {{EX:cn}} and {{EX:sn}} attribute types. The
853 fourth line causes an equality index for the {{EX:objectClass}}
856 By default, no indices are maintained. It is generally advised
857 that minimally an equality index upon objectClass be maintained.
859 > olcDbindex: objectClass eq
861 If this setting is changed while slapd is running, an internal task
862 will be run to generate the changed index data. All server operations
863 can continue as normal while the indexer does its work. If slapd is
864 stopped before the index task completes, indexing will have to be
865 manually completed using the slapindex tool.
868 H4: olcDbLinearIndex: <TRUE|FALSE>
870 If this setting is {{EX:TRUE}} slapindex will index one attribute
871 at a time. The default settings is {{EX:FALSE}} in which case all
872 indexed attributes of an entry are processed at the same time. When
873 enabled, each indexed attribute is processed individually, using
874 multiple passes through the entire database. This option improves
875 slapindex performance when the database size exceeds the BDB cache
876 size. When the BDB cache is large enough, this option is not needed
877 and will decrease performance. Also by default, slapadd performs
878 full indexing and so a separate slapindex run is not needed. With
879 this option, slapadd does no indexing and slapindex must be used.
882 H4: olcDbMode: <integer>
884 This directive specifies the file protection mode that newly
885 created database index files should have.
892 H4: olcDbSearchStack: <integer>
894 Specify the depth of the stack used for search filter evaluation.
895 Search filters are evaluated on a stack to accomodate nested {{EX:AND}} /
896 {{EX:OR}} clauses. An individual stack is allocated for each server thread.
897 The depth of the stack determines how complex a filter can be evaluated
898 without requiring any additional memory allocation. Filters that are
899 nested deeper than the search stack depth will cause a separate stack to
900 be allocated for that particular search operation. These separate allocations
901 can have a major negative impact on server performance, but specifying
902 too much stack will also consume a great deal of memory. Each search
903 uses 512K bytes per level on a 32-bit machine, or 1024K bytes per level
904 on a 64-bit machine. The default stack depth is 16, thus 8MB or 16MB
905 per thread is used on 32 and 64 bit machines, respectively. Also the
906 512KB size of a single stack slot is set by a compile-time constant which
907 may be changed if needed; the code must be recompiled for the change
912 > olcDbSearchStack: 16
915 H4: olcDbShmKey: <integer>
917 Specify a key for a shared memory BDB environment. By default the BDB
918 environment uses memory mapped files. If a non-zero value is specified,
919 it will be used as the key to identify a shared memory region that will
920 house the environment.
929 >dn: olcDatabase=hdb,cn=config
930 >objectClass: olcDatabaseConfig
931 >objectClass: olcBdbConfig
933 >olcSuffix: "dc=example,dc=com"
934 >olcDbDirectory: /usr/local/var/openldap-data
935 >olcDbCacheSize: 1000
936 >olcDbCheckpoint: 1024 10
937 >olcDbConfig: set_cachesize 0 10485760 0
938 >olcDbConfig: set_lg_bsize 2097152
939 >olcDbConfig: set_lg_dir /var/tmp/bdb-log
940 >olcDbConfig: set_flags DB_LOG_AUTOREMOVE
941 >olcDbIDLcacheSize: 3000
942 >olcDbIndex: objectClass eq
945 Note: the remainder of this chapter has not yet been updated to reflect
946 the new cn=config mechanisms.
950 Access to slapd entries and attributes is controlled by the
951 access configuration file directive. The general form of an
954 > <access directive> ::= access to <what>
955 > [by <who> <access> <control>]+
957 > [dn[.<basic-style>]=<regex> | dn.<scope-style>=<DN>]
958 > [filter=<ldapfilter>] [attrs=<attrlist>]
959 > <basic-style> ::= regex | exact
960 > <scope-style> ::= base | one | subtree | children
961 > <attrlist> ::= <attr> [val[.<basic-style>]=<regex>] | <attr> , <attrlist>
962 > <attr> ::= <attrname> | entry | children
963 > <who> ::= * | [anonymous | users | self
964 > | dn[.<basic-style>]=<regex> | dn.<scope-style>=<DN>]
965 > [dnattr=<attrname>]
966 > [group[/<objectclass>[/<attrname>][.<basic-style>]]=<regex>]
967 > [peername[.<basic-style>]=<regex>]
968 > [sockname[.<basic-style>]=<regex>]
969 > [domain[.<basic-style>]=<regex>]
970 > [sockurl[.<basic-style>]=<regex>]
973 > <access> ::= [self]{<level>|<priv>}
974 > <level> ::= none | auth | compare | search | read | write
975 > <priv> ::= {=|+|-}{w|r|s|c|x|0}+
976 > <control> ::= [stop | continue | break]
978 where the <what> part selects the entries and/or attributes to which
979 the access applies, the {{EX:<who>}} part specifies which entities
980 are granted access, and the {{EX:<access>}} part specifies the
981 access granted. Multiple {{EX:<who> <access> <control>}} triplets
982 are supported, allowing many entities to be granted different access
983 to the same set of entries and attributes. Not all of these access
984 control options are described here; for more details see the
985 {{slapd.access}}(5) man page.
988 H3: What to control access to
990 The <what> part of an access specification determines the entries
991 and attributes to which the access control applies. Entries are
992 commonly selected in two ways: by DN and by filter. The following
993 qualifiers select entries by DN:
996 > to dn[.<basic-style>]=<regex>
997 > to dn.<scope-style>=<DN>
999 The first form is used to select all entries. The second form may
1000 be used to select entries by matching a regular expression against
1001 the target entry's {{normalized DN}}. (The second form is not
1002 discussed further in this document.) The third form is used to
1003 select entries which are within the requested scope of DN. The
1004 <DN> is a string representation of the Distinguished Name, as
1005 described in {{REF:RFC2253}}.
1007 The scope can be either {{EX:base}}, {{EX:one}}, {{EX:subtree}},
1008 or {{EX:children}}. Where {{EX:base}} matches only the entry with
1009 provided DN, {{EX:one}} matches the entries whose parent is the
1010 provided DN, {{EX:subtree}} matches all entries in the subtree whose
1011 root is the provided DN, and {{EX:children}} matches all entries
1012 under the DN (but not the entry named by the DN).
1014 For example, if the directory contained entries named:
1017 > 1: cn=Manager,o=suffix
1018 > 2: ou=people,o=suffix
1019 > 3: uid=kdz,ou=people,o=suffix
1020 > 4: cn=addresses,uid=kdz,ou=people,o=suffix
1021 > 5: uid=hyc,ou=people,o=suffix
1024 . {{EX:dn.base="ou=people,o=suffix"}} match 2;
1025 . {{EX:dn.one="ou=people,o=suffix"}} match 3, and 5;
1026 . {{EX:dn.subtree="ou=people,o=suffix"}} match 2, 3, 4, and 5; and
1027 . {{EX:dn.children="ou=people,o=suffix"}} match 3, 4, and 5.
1030 Entries may also be selected using a filter:
1032 > to filter=<ldap filter>
1034 where <ldap filter> is a string representation of an LDAP
1035 search filter, as described in {{REF:RFC2254}}. For example:
1037 > to filter=(objectClass=person)
1039 Note that entries may be selected by both DN and filter by
1040 including both qualifiers in the <what> clause.
1042 > to dn.one="ou=people,o=suffix" filter=(objectClass=person)
1044 Attributes within an entry are selected by including a comma-separated
1045 list of attribute names in the <what> selector:
1047 > attrs=<attribute list>
1049 A specific value of an attribute is selected by using a single
1050 attribute name and also using a value selector:
1052 > attrs=<attribute> val[.<style>]=<regex>
1054 There are two special {{pseudo}} attributes {{EX:entry}} and
1055 {{EX:children}}. To read (and hence return) a target entry, the
1056 subject must have {{EX:read}} access to the target's {{entry}}
1057 attribute. To add or delete an entry, the subject must have
1058 {{EX:write}} access to the entry's {{EX:entry}} attribute AND must
1059 have {{EX:write}} access to the entry's parent's {{EX:children}}
1060 attribute. To rename an entry, the subject must have {{EX:write}}
1061 access to entry's {{EX:entry}} attribute AND have {{EX:write}}
1062 access to both the old parent's and new parent's {{EX:children}}
1063 attributes. The complete examples at the end of this section should
1064 help clear things up.
1066 Lastly, there is a special entry selector {{EX:"*"}} that is used to
1067 select any entry. It is used when no other {{EX:<what>}}
1068 selector has been provided. It's equivalent to "{{EX:dn=.*}}"
1071 H3: Who to grant access to
1073 The <who> part identifies the entity or entities being granted
1074 access. Note that access is granted to "entities" not "entries."
1075 The following table summarizes entity specifiers:
1077 !block table; align=Center; coltags="EX,N"; \
1078 title="Table 5.3: Access Entity Specifiers"
1080 *|All, including anonymous and authenticated users
1081 anonymous|Anonymous (non-authenticated) users
1082 users|Authenticated users
1083 self|User associated with target entry
1084 dn[.<basic-style>]=<regex>|Users matching a regular expression
1085 dn.<scope-style>=<DN>|Users within scope of a DN
1088 The DN specifier behaves much like <what> clause DN specifiers.
1090 Other control factors are also supported. For example, a {{EX:<who>}}
1091 can be restricted by an entry listed in a DN-valued attribute in
1092 the entry to which the access applies:
1094 > dnattr=<dn-valued attribute name>
1096 The dnattr specification is used to give access to an entry
1097 whose DN is listed in an attribute of the entry (e.g., give
1098 access to a group entry to whoever is listed as the owner of
1101 Some factors may not be appropriate in all environments (or any).
1102 For example, the domain factor relies on IP to domain name lookups.
1103 As these can easily spoofed, the domain factor should not be avoided.
1106 H3: The access to grant
1109 The kind of <access> granted can be one of the following:
1112 !block table; colaligns="LRL"; coltags="EX,EX,N"; align=Center; \
1113 title="Table 5.4: Access Levels"
1114 Level Privileges Description
1116 auth =x needed to bind
1117 compare =cx needed to compare
1118 search =scx needed to apply search filters
1119 read =rscx needed to read search results
1120 write =wrscx needed to modify/rename
1123 Each level implies all lower levels of access. So, for
1124 example, granting someone {{EX:write}} access to an entry also
1125 grants them {{EX:read}}, {{EX:search}}, {{EX:compare}}, and
1126 {{EX:auth}} access. However, one may use the privileges specifier
1127 to grant specific permissions.
1130 H3: Access Control Evaluation
1132 When evaluating whether some requester should be given access to
1133 an entry and/or attribute, slapd compares the entry and/or attribute
1134 to the {{EX:<what>}} selectors given in the configuration file.
1135 For each entry, access controls provided in the database which holds
1136 the entry (or the first database if not held in any database) apply
1137 first, followed by the global access directives. Within this
1138 priority, access directives are examined in the order in which they
1139 appear in the config file. Slapd stops with the first {{EX:<what>}}
1140 selector that matches the entry and/or attribute. The corresponding
1141 access directive is the one slapd will use to evaluate access.
1143 Next, slapd compares the entity requesting access to the {{EX:<who>}}
1144 selectors within the access directive selected above in the order
1145 in which they appear. It stops with the first {{EX:<who>}} selector
1146 that matches the requester. This determines the access the entity
1147 requesting access has to the entry and/or attribute.
1149 Finally, slapd compares the access granted in the selected
1150 {{EX:<access>}} clause to the access requested by the client. If
1151 it allows greater or equal access, access is granted. Otherwise,
1154 The order of evaluation of access directives makes their placement
1155 in the configuration file important. If one access directive is
1156 more specific than another in terms of the entries it selects, it
1157 should appear first in the config file. Similarly, if one {{EX:<who>}}
1158 selector is more specific than another it should come first in the
1159 access directive. The access control examples given below should
1160 help make this clear.
1164 H3: Access Control Examples
1166 The access control facility described above is quite powerful. This
1167 section shows some examples of its use for descriptive purposes.
1171 > access to * by * read
1173 This access directive grants read access to everyone.
1180 This directive allows the user to modify their entry, allows anonymous
1181 to authentication against these entries, and allows all others to
1182 read these entries. Note that only the first {{EX:by <who>}} clause
1183 which matches applies. Hence, the anonymous users are granted
1184 {{EX:auth}}, not {{EX:read}}. The last clause could just as well
1185 have been "{{EX:by users read}}".
1187 It is often desirable to restrict operations based upon the level
1188 of protection in place. The following shows how security strength
1189 factors (SSF) can be used.
1192 > by ssf=128 self write
1193 > by ssf=64 anonymous auth
1194 > by ssf=64 users read
1196 This directive allows users to modify their own entries if security
1197 protections have of strength 128 or better have been established,
1198 allows authentication access to anonymous users, and read access
1199 when 64 or better security protections have been established. If
1200 client has not establish sufficient security protections, the
1201 implicit {{EX:by * none}} clause would be applied.
1203 The following example shows the use of a style specifiers to select
1204 the entries by DN in two access directives where ordering is
1207 > access to dn.children="dc=example,dc=com"
1209 > access to dn.children="dc=com"
1212 Read access is granted to entries under the {{EX:dc=com}} subtree,
1213 except for those entries under the {{EX:dc=example,dc=com}} subtree,
1214 to which search access is granted. No access is granted to
1215 {{EX:dc=com}} as neither access directive matches this DN. If the
1216 order of these access directives was reversed, the trailing directive
1217 would never be reached, since all entries under {{EX:dc=example,dc=com}}
1218 are also under {{EX:dc=com}} entries.
1220 Also note that if no {{EX:access to}} directive matches or no {{EX:by
1221 <who>}} clause, {{B:access is denied}}. That is, every {{EX:access
1222 to}} directive ends with an implicit {{EX:by * none}} clause and
1223 every access list ends with an implicit {{EX:access to * by * none}}
1226 The next example again shows the importance of ordering, both of
1227 the access directives and the {{EX:by <who>}} clauses. It also
1228 shows the use of an attribute selector to grant access to a specific
1229 attribute and various {{EX:<who>}} selectors.
1231 > access to dn.subtree="dc=example,dc=com" attr=homePhone
1233 > by dn.children=dc=example,dc=com" search
1234 > by peername.regex=IP:10\..+ read
1235 > access to dn.subtree="dc=example,dc=com"
1237 > by dn.children="dc=example,dc=com" search
1240 This example applies to entries in the "{{EX:dc=example,dc=com}}"
1241 subtree. To all attributes except {{EX:homePhone}}, an entry can
1242 write to itself, entries under {{EX:example.com}} entries can search
1243 by them, anybody else has no access (implicit {{EX:by * none}})
1244 excepting for authentication/authorization (which is always done
1245 anonymously). The {{EX:homePhone}} attribute is writable by the
1246 entry, searchable by entries under {{EX:example.com}}, readable by
1247 clients connecting from network 10, and otherwise not readable
1248 (implicit {{EX:by * none}}). All other access is denied by the
1249 implicit {{EX:access to * by * none}}.
1251 Sometimes it is useful to permit a particular DN to add or
1252 remove itself from an attribute. For example, if you would like to
1253 create a group and allow people to add and remove only
1254 their own DN from the member attribute, you could accomplish
1255 it with an access directive like this:
1257 > access to attr=member,entry
1258 > by dnattr=member selfwrite
1260 The dnattr {{EX:<who>}} selector says that the access applies to
1261 entries listed in the {{EX:member}} attribute. The {{EX:selfwrite}} access
1262 selector says that such members can only add or delete their
1263 own DN from the attribute, not other values. The addition of
1264 the entry attribute is required because access to the entry is
1265 required to access any of the entry's attributes.
1268 For more details on how to use the {{EX:access}} directive,
1269 consult the {{Advanced Access Control}} chapter.
1273 H2: Configuration File Example
1275 The following is an example configuration file, interspersed
1276 with explanatory text. It defines two databases to handle
1277 different parts of the {{TERM:X.500}} tree; both are {{TERM:BDB}}
1278 database instances. The line numbers shown are provided for
1279 reference only and are not included in the actual file. First, the
1280 global configuration section:
1282 E: 1. # example config file - global configuration section
1283 E: 2. include /usr/local/etc/schema/core.schema
1284 E: 3. referral ldap://root.openldap.org
1285 E: 4. access to * by * read
1287 Line 1 is a comment. Line 2 includes another config file
1288 which contains {{core}} schema definitions.
1289 The {{EX:referral}} directive on line 3
1290 means that queries not local to one of the databases defined
1291 below will be referred to the LDAP server running on the
1292 standard port (389) at the host {{EX:root.openldap.org}}.
1294 Line 4 is a global access control. It applies to all
1295 entries (after any applicable database-specific access
1298 The next section of the configuration file defines a BDB
1299 backend that will handle queries for things in the
1300 "dc=example,dc=com" portion of the tree. The
1301 database is to be replicated to two slave slapds, one on
1302 truelies, the other on judgmentday. Indices are to be
1303 maintained for several attributes, and the {{EX:userPassword}}
1304 attribute is to be protected from unauthorized access.
1306 E: 5. # BDB definition for the example.com
1308 E: 7. suffix "dc=example,dc=com"
1309 E: 8. directory /usr/local/var/openldap-data
1310 E: 9. rootdn "cn=Manager,dc=example,dc=com"
1311 E: 10. rootpw secret
1312 E: 11. # replication directives
1313 E: 12. replogfile /usr/local/var/openldap/slapd.replog
1314 E: 13. replica uri=ldap://slave1.example.com:389
1315 E: 14. binddn="cn=Replicator,dc=example,dc=com"
1316 E: 15. bindmethod=simple credentials=secret
1317 E: 16. replica uri=ldaps://slave2.example.com:636
1318 E: 17. binddn="cn=Replicator,dc=example,dc=com"
1319 E: 18. bindmethod=simple credentials=secret
1320 E: 19. # indexed attribute definitions
1321 E: 20. index uid pres,eq
1322 E: 21. index cn,sn,uid pres,eq,approx,sub
1323 E: 22. index objectClass eq
1324 E: 23. # database access control definitions
1325 E: 24. access to attr=userPassword
1326 E: 25. by self write
1327 E: 26. by anonymous auth
1328 E: 27. by dn.base="cn=Admin,dc=example,dc=com" write
1331 E: 30. by self write
1332 E: 31. by dn.base="cn=Admin,dc=example,dc=com" write
1335 Line 5 is a comment. The start of the database definition is marked
1336 by the database keyword on line 6. Line 7 specifies the DN suffix
1337 for queries to pass to this database. Line 8 specifies the directory
1338 in which the database files will live.
1340 Lines 9 and 10 identify the database {{super-user}} entry and associated
1341 password. This entry is not subject to access control or size or
1342 time limit restrictions.
1344 Lines 11 through 18 are for replication. Line 12 specifies the
1345 replication log file (where changes to the database are logged -
1346 this file is written by slapd and read by slurpd). Lines 13 through
1347 15 specify the hostname and port for a replicated host, the DN to
1348 bind as when performing updates, the bind method (simple) and the
1349 credentials (password) for the binddn. Lines 16 through 18 specify
1350 a second replication site. See the {{SECT:Replication with slurpd}}
1351 chapter for more information on these directives.
1353 Lines 20 through 22 indicate the indices to maintain for various
1356 Lines 24 through 32 specify access control for entries in this
1357 database. As this is the first database, the controls also apply
1358 to entries not held in any database (such as the Root DSE). For
1359 all applicable entries, the {{EX:userPassword}} attribute is writable
1360 by the entry itself and by the "admin" entry. It may be used for
1361 authentication/authorization purposes, but is otherwise not readable.
1362 All other attributes are writable by the entry and the "admin"
1363 entry, but may be read by all users (authenticated or not).
1365 The next section of the example configuration file defines another
1366 BDB database. This one handles queries involving the
1367 {{EX:dc=example,dc=net}} subtree but is managed by the same entity
1368 as the first database. Note that without line 39, the read access
1369 would be allowed due to the global access rule at line 4.
1371 E: 33. # BDB definition for example.net
1373 E: 35. suffix "dc=example,dc=net"
1374 E: 36. directory /usr/local/var/openldap-data-net
1375 E: 37. rootdn "cn=Manager,dc=example,dc=com"
1376 E: 38. index objectClass eq
1377 E: 39. access to * by users read