xref: /netbsd-src/external/bsd/openldap/dist/doc/guide/admin/slapdconfig.sdf (revision e670fd5c413e99c2f6a37901bb21c537fcd322d2)
1# $OpenLDAP$
2# Copyright 1999-2021 The OpenLDAP Foundation, All Rights Reserved.
3# COPYING RESTRICTIONS APPLY, see COPYRIGHT.
4
5H1: The slapd Configuration File
6
7This chapter describes configuring {{slapd}}(8) via the {{slapd.conf}}(5)
8configuration file.  {{slapd.conf}}(5) has been deprecated and should
9only be used if your site requires one of the backends that hasn't yet
10been updated to work with the newer {{slapd-config}}(5) system.  Configuring
11{{slapd}}(8) via {{slapd-config}}(5) is described in the previous chapter.
12
13The {{slapd.conf}}(5) file is normally installed in the
14{{EX:/usr/local/etc/openldap}} directory.  An alternate configuration
15file location can be specified via a command-line option to {{slapd}}(8).
16
17
18H2: Configuration File Format
19
20The {{slapd.conf}}(5) file consists of three types of configuration
21information: global, backend specific, and database specific.  Global
22information is specified first, followed by information associated
23with a particular backend type, which is then followed by information
24associated with a particular database instance.  Global directives can
25be overridden in backend and/or database directives, and backend directives
26can be overridden by database directives.
27
28Blank lines and comment lines beginning with a '{{EX:#}}' character
29are ignored.  If a line begins with whitespace, it is considered a
30continuation of the previous line (even if the previous line is a
31comment).
32
33The general format of slapd.conf is as follows:
34
35>	# global configuration directives
36>	<global config directives>
37>
38>	# backend definition
39>	backend <typeA>
40>	<backend-specific directives>
41>
42>	# first database definition & config directives
43>	database <typeA>
44>	<database-specific directives>
45>
46>	# second database definition & config directives
47>	database <typeB>
48>	<database-specific directives>
49>
50>	# second database definition & config directives
51>	database <typeA>
52>	<database-specific directives>
53>
54>	# subsequent backend & database definitions & config directives
55>	...
56
57A configuration directive may take arguments.  If so, they are
58separated by whitespace.  If an argument contains whitespace,
59the argument should be enclosed in double quotes {{EX:"like this"}}. If
60an argument contains a double quote or a backslash character `{{EX:\}}',
61the character should be preceded by a backslash character `{{EX:\}}'.
62
63The distribution contains an example configuration file that will
64be installed in the {{F: /usr/local/etc/openldap}} directory.
65A number of files containing schema definitions (attribute types
66and object classes) are also provided in the
67{{F: /usr/local/etc/openldap/schema}} directory.
68
69
70H2: Configuration File Directives
71
72This section details commonly used configuration directives.  For
73a complete list, see the {{slapd.conf}}(5) manual page.  This section
74separates the configuration file directives into global,
75backend-specific and data-specific categories, describing each
76directive and its default value (if any), and giving an example of
77its use.
78
79
80
81H3: Global Directives
82
83Directives described in this section apply to all backends
84and databases unless specifically overridden in a backend or
85database definition.  Arguments that should be replaced
86by actual text are shown in brackets {{EX:<>}}.
87
88
89H4: access to <what> [ by <who> [<accesslevel>] [<control>] ]+
90
91This directive grants access (specified by <accesslevel>) to a set
92of entries and/or attributes (specified by <what>) by one or more
93requestors (specified by <who>).  See the {{SECT:Access Control}} section of
94this guide for basic usage.
95
96!if 0
97More details discussion of this directive can be found in the
98{{SECT:Advanced Access Control}} chapter.
99!endif
100
101Note: If no {{EX:access}} directives are specified, the default
102access control policy, {{EX:access to * by * read}}, allows all
103both authenticated and anonymous users read access.
104
105
106H4: attributetype <{{REF:RFC4512}} Attribute Type Description>
107
108This directive defines an attribute type.
109Please see the {{SECT:Schema Specification}} chapter
110for information regarding how to use this directive.
111
112H4: idletimeout <integer>
113
114Specify the number of seconds to wait before forcibly closing
115an idle client connection.  An idletimeout of 0, the default,
116disables this feature.
117
118
119H4: include <filename>
120
121This directive specifies that slapd should read additional
122configuration information from the given file before continuing
123with the next line of the current file. The included file should
124follow the normal slapd config file format.  The file is commonly
125used to include files containing schema specifications.
126
127Note: You should be careful when using this directive - there is
128no small limit on the number of nested include directives, and no
129loop detection is done.
130
131H4: loglevel <level>
132
133This directive specifies the level at which log statements
134and operation statistics should be sent to syslog (currently logged to
135the {{syslogd}}(8) {{EX:LOG_LOCAL4}} facility). You must have
136configured OpenLDAP {{EX:--enable-debug}} (the default) for this
137to work, except for the two statistics levels, which are always
138enabled. Log levels may be specified as integers or by keyword.
139Multiple log levels may be used and the levels are additive.
140The possible values for <integer> are:
141
142!block table; colaligns="RL"; align=Center; \
143	title="Table 6.1: Logging Levels"
144Level	Keyword		Description
145-1	any		enable all debugging
1460			no debugging
1471	(0x1 trace)	trace function calls
1482	(0x2 packets)	debug packet handling
1494	(0x4 args)	heavy trace debugging
1508	(0x8 conns)	connection management
15116	(0x10 BER)	print out packets sent and received
15232	(0x20 filter)	search filter processing
15364	(0x40 config)	configuration processing
154128	(0x80 ACL)	access control list processing
155256	(0x100 stats)	stats log connections/operations/results
156512	(0x200 stats2)	stats log entries sent
1571024	(0x400 shell)	print communication with shell backends
1582048	(0x800 parse)	print entry parsing debugging
15916384	(0x4000 sync)	syncrepl consumer processing
16032768	(0x8000 none)	only messages that get logged regardless of configured log level
161!endblock
162
163The desired log level can be input as a single integer that
164combines the (ORed) desired levels, both in decimal or in hexadecimal
165notation, as a list of integers (that are ORed internally), or as a list of the names that are shown between brackets, such that
166
167>		loglevel 129
168>		loglevel 0x81
169>		loglevel 128 1
170>		loglevel 0x80 0x1
171>		loglevel acl trace
172
173are equivalent.
174
175\Examples:
176
177E: loglevel -1
178
179This will enable all log levels.
180
181E: loglevel conns filter
182
183Just log the connection and search filter processing.
184
185E: loglevel none
186
187Log those messages that are logged regardless of the configured loglevel. This
188differs from setting the log level to 0, when no logging occurs. At least the
189{{EX:None}} level is required to have high priority messages logged.
190
191\Default:
192
193E: loglevel stats
194
195Basic stats logging is configured by default.
196
197H4: objectclass <{{REF:RFC4512}} Object Class Description>
198
199This directive defines an object class.
200Please see the {{SECT:Schema Specification}} chapter for
201information regarding how to use this directive.
202
203
204H4: referral <URI>
205
206This directive specifies the referral to pass back when slapd
207cannot find a local database to handle a request.
208
209\Example:
210
211>	referral ldap://root.openldap.org
212
213This will refer non-local queries to the global root LDAP server
214at the OpenLDAP Project. Smart LDAP clients can re-ask their
215query at that server, but note that most of these clients are
216only going to know how to handle simple LDAP URLs that
217contain a host part and optionally a distinguished name part.
218
219
220H4: sizelimit <integer>
221
222This directive specifies the maximum number of entries to return
223from a search operation.
224
225\Default:
226
227>	sizelimit 500
228
229See the {{SECT:Limits}} section of this guide and {{slapd.conf}}(5)
230for more details.
231
232H4: timelimit <integer>
233
234This directive specifies the maximum number of seconds (in real
235time) slapd will spend answering a search request. If a
236request is not finished in this time, a result indicating an
237exceeded timelimit will be returned.
238
239\Default:
240
241>	timelimit 3600
242
243See the {{SECT:Limits}} section of this guide and {{slapd.conf}}(5)
244for more details.
245
246
247H3: General Backend Directives
248
249Directives in this section apply only to the backend in which
250they are defined. They are supported by every type of backend.
251Backend directives apply to all databases instances of the
252same type and, depending on the directive, may be overridden
253by database directives.
254
255H4: backend <type>
256
257This directive marks the beginning of a backend declaration.
258{{EX:<type>}} should be one of the
259supported backend types listed in Table 6.2.
260
261!block table; align=Center; coltags="EX,N"; \
262	title="Table 6.2: Database Backends"
263Types	Description
264asyncmeta	Asynchronous Metadirectory backend
265config	Slapd configuration backend
266dnssrv	DNS SRV backend
267ldap	Lightweight Directory Access Protocol (Proxy) backend
268ldif	Lightweight Data Interchange Format backend
269mdb	Memory-Mapped DB backend
270meta	Metadirectory backend
271monitor	Monitor backend
272ndb	MySQL NDB backend
273null	Null backend
274passwd	Provides read-only access to {{passwd}}(5)
275perl	Perl Programmable backend
276relay	Relay backend
277sock	Socket backend
278sql	SQL Programmable backend
279wt	WiredTiger backend
280!endblock
281
282\Example:
283
284>	backend mdb
285>	idlexp 16
286
287This marks the beginning of a new {{TERM:MDB}} backend
288definition. At present, only back-mdb implements any options
289of this type, so this setting is not needed for any other backends.
290
291
292H3: General Database Directives
293
294Directives in this section apply only to the database in which
295they are defined. They are supported by every type of database.
296
297H4: database <type>
298
299This directive marks the beginning of a database instance
300declaration.
301{{EX:<type>}} should be one of the
302supported backend types listed in Table 6.2.
303
304\Example:
305
306>	database mdb
307
308This marks the beginning of a new {{TERM:MDB}} database instance
309declaration.
310
311
312H4: limits <selector> <limit> [<limit> [...]]
313
314Specify time and size limits based on the operation's initiator or base
315DN.
316
317See the {{SECT:Limits}} section of this guide and {{slapd.conf}}(5)
318for more details.
319
320
321H4: readonly { on | off }
322
323This directive puts the database into "read-only" mode. Any
324attempts to modify the database will return an "unwilling to
325perform" error.  If set on a consumer, modifications sent by
326syncrepl will still occur.
327
328\Default:
329
330>	readonly off
331
332
333H4: rootdn <DN>
334
335This directive specifies the DN that is not subject to
336access control or administrative limit restrictions for
337operations on this database.  The DN need not refer to
338an entry in this database or even in the directory. The
339DN may refer to a SASL identity.
340
341Entry-based Example:
342
343>	rootdn "cn=Manager,dc=example,dc=com"
344
345SASL-based Example:
346
347>	rootdn "uid=root,cn=example.com,cn=digest-md5,cn=auth"
348
349See the {{SECT:SASL Authentication}} section for information on
350SASL authentication identities.
351
352
353H4: rootpw <password>
354
355This directive can be used to specifies a password for the DN for
356the rootdn (when the rootdn is set to a DN within the database).
357
358\Example:
359
360>	rootpw secret
361
362It is also permissible to provide hash of the password in {{REF:RFC2307}}
363form.  {{slappasswd}}(8) may be used to generate the password hash.
364
365\Example:
366
367>	rootpw {SSHA}ZKKuqbEKJfKSXhUbHG3fG8MDn9j1v4QN
368
369The hash was generated using the command {{EX:slappasswd -s secret}}.
370
371
372H4: suffix <dn suffix>
373
374This directive specifies the DN suffix of queries that will be
375passed to this backend database. Multiple suffix lines can be
376given, and at least one is required for each database
377definition.
378
379\Example:
380
381>	suffix "dc=example,dc=com"
382
383Queries with a DN ending in "dc=example,dc=com"
384will be passed to this backend.
385
386Note: When the backend to pass a query to is selected, slapd
387looks at the suffix line(s) in each database definition in the
388order they appear in the file. Thus, if one database suffix is a
389prefix of another, it must appear after it in the config file.
390
391
392H4: syncrepl
393
394>	syncrepl rid=<replica ID>
395>		provider=ldap[s]://<hostname>[:port]
396>		searchbase=<base DN>
397>		[type=refreshOnly|refreshAndPersist]
398>		[interval=dd:hh:mm:ss]
399>		[retry=[<retry interval> <# of retries>]+]
400>		[filter=<filter str>]
401>		[scope=sub|one|base]
402>		[attrs=<attr list>]
403>		[exattrs=<attr list>]
404>		[attrsonly]
405>		[sizelimit=<limit>]
406>		[timelimit=<limit>]
407>		[schemachecking=on|off]
408>		[network-timeout=<seconds>]
409>		[timeout=<seconds>]
410>		[bindmethod=simple|sasl]
411>		[binddn=<DN>]
412>		[saslmech=<mech>]
413>		[authcid=<identity>]
414>		[authzid=<identity>]
415>		[credentials=<passwd>]
416>		[realm=<realm>]
417>		[secprops=<properties>]
418>		[keepalive=<idle>:<probes>:<interval>]
419>		[starttls=yes|critical]
420>		[tls_cert=<file>]
421>		[tls_key=<file>]
422>		[tls_cacert=<file>]
423>		[tls_cacertdir=<path>]
424>		[tls_reqcert=never|allow|try|demand]
425>		[tls_cipher_suite=<ciphers>]
426>		[tls_crlcheck=none|peer|all]
427>		[tls_protocol_min=<major>[.<minor>]]
428>		[suffixmassage=<real DN>]
429>		[logbase=<base DN>]
430>		[logfilter=<filter str>]
431>		[syncdata=default|accesslog|changelog]
432
433
434This directive specifies the current database as a consumer of the
435provider content by establishing the current {{slapd}}(8) as a
436replication consumer site running a syncrepl replication engine.
437The provider database is located at the replication provider site
438specified by the {{EX:provider}} parameter. The consumer database is
439kept up-to-date with the provider content using the LDAP Content
440Synchronization protocol. See {{REF:RFC4533}}
441for more information on the protocol.
442
443The {{EX:rid}} parameter is used for identification of the current
444{{EX:syncrepl}} directive within the replication consumer server,
445where {{EX:<replica ID>}} uniquely identifies the syncrepl specification
446described by the current {{EX:syncrepl}} directive. {{EX:<replica ID>}}
447is non-negative and is no more than three decimal digits in length.
448
449The {{EX:provider}} parameter specifies the replication provider site
450containing the provider content as an LDAP URI. The {{EX:provider}}
451parameter specifies a scheme, a host and optionally a port where the
452provider slapd instance can be found. Either a domain name or IP
453address may be used for <hostname>. Examples are
454{{EX:ldap://provider.example.com:389}} or {{EX:ldaps://192.168.1.1:636}}.
455If <port> is not given, the standard LDAP port number (389 or 636) is used.
456Note that the syncrepl uses a consumer-initiated protocol, and hence its
457specification is located on the consumer.
458
459The content of the syncrepl consumer is defined using a search
460specification as its result set. The consumer slapd will
461send search requests to the provider slapd according to the search
462specification. The search specification includes {{EX:searchbase}},
463{{EX:scope}}, {{EX:filter}}, {{EX:attrs}}, {{EX:exattrs}}, {{EX:attrsonly}},
464{{EX:sizelimit}}, and {{EX:timelimit}} parameters as in the normal
465search specification. The {{EX:searchbase}} parameter has no
466default value and must always be specified. The {{EX:scope}} defaults
467to {{EX:sub}}, the {{EX:filter}} defaults to {{EX:(objectclass=*)}},
468{{EX:attrs}} defaults to {{EX:"*,+"}} to replicate all user and operational
469attributes, and {{EX:attrsonly}} is unset by default. Both {{EX:sizelimit}}
470and {{EX:timelimit}} default to "unlimited", and only positive integers
471or "unlimited" may be specified. The {{EX:exattrs}} option may also be used
472to specify attributes that should be omitted from incoming entries.
473
474The {{TERM[expand]LDAP Sync}} protocol has two operation
475types: {{EX:refreshOnly}} and {{EX:refreshAndPersist}}.
476The operation type is specified by the {{EX:type}} parameter.
477In the {{EX:refreshOnly}} operation, the next synchronization search operation
478is periodically rescheduled at an interval time after each
479synchronization operation finishes. The interval is specified
480by the {{EX:interval}} parameter. It is set to one day by default.
481In the {{EX:refreshAndPersist}} operation, a synchronization search
482remains persistent in the provider {{slapd}} instance. Further updates to the
483provider will generate {{EX:searchResultEntry}} to the consumer slapd
484as the search responses to the persistent synchronization search.
485
486If an error occurs during replication, the consumer will attempt to reconnect
487according to the retry parameter which is a list of the <retry interval>
488and <# of retries> pairs. For example, retry="60 10 300 3" lets the consumer
489retry every 60 seconds for the first 10 times and then retry every 300 seconds
490for the next three times before stop retrying. + in <#  of retries> means
491indefinite number of retries until success.
492
493The schema checking can be enforced at the LDAP Sync consumer site
494by turning on the {{EX:schemachecking}} parameter.
495If it is turned on, every replicated entry will be checked for its
496schema as the entry is stored on the consumer.
497Every entry in the consumer should contain those attributes
498required by the schema definition.
499If it is turned off, entries will be stored without checking
500schema conformance. The default is off.
501
502The {{EX:network-timeout}} parameter sets how long the consumer will
503wait to establish a network connection to the provider.  Once a
504connection is established, the {{EX:timeout}} parameter determines how
505long the consumer will wait for the initial Bind request to complete.  The
506defaults for these parameters come from {{ldap.conf}}(5).
507
508The {{EX:binddn}} parameter gives the DN to bind as for the
509syncrepl searches to the provider slapd. It should be a DN
510which has read access to the replication content in the
511provider database.
512
513The {{EX:bindmethod}} is {{EX:simple}} or {{EX:sasl}},
514depending on whether simple password-based authentication or
515{{TERM:SASL}} authentication is to be used when connecting
516to the provider {{slapd}} instance.
517
518Simple authentication should not be used unless adequate data
519integrity and confidentiality protections are in place (e.g. TLS
520or IPsec). Simple authentication requires specification of {{EX:binddn}}
521and {{EX:credentials}} parameters.
522
523SASL authentication is generally recommended.  SASL authentication
524requires specification of a mechanism using the {{EX:saslmech}} parameter.
525Depending on the mechanism, an authentication identity and/or
526credentials can be specified using {{EX:authcid}} and {{EX:credentials}},
527respectively.  The {{EX:authzid}} parameter may be used to specify
528an authorization identity.
529
530The {{EX:realm}} parameter specifies a realm which a certain
531mechanisms authenticate the identity within. The {{EX:secprops}}
532parameter specifies Cyrus SASL security properties.
533
534The {{EX:keepalive}} parameter sets the values of idle, probes, and interval
535used to check whether a socket is alive;  idle is the number of seconds a
536connection needs to remain idle before TCP starts sending keepalive probes;
537probes is the maximum number of keepalive probes TCP should send before
538dropping the connection; interval is interval in seconds between individual
539keepalive probes.  Only some systems support the customization of these
540values; the keepalive parameter is ignored otherwise, and system-wide
541settings are used. For example, keepalive="240:10:30" will send a keepalive
542probe 10 times, every 30 seconds, after 240 seconds of idle activity.  If
543no response to the probes is received, the connection will be dropped.
544
545The {{EX:starttls}} parameter specifies use of the StartTLS extended
546operation to establish a TLS session before authenticating to the provider.
547If the {{EX:critical}} argument is supplied, the session will be aborted
548if the StartTLS request fails.  Otherwise the syncrepl session continues
549without TLS.  The tls_reqcert setting defaults to {{EX:"demand"}} and the
550other TLS settings default to the same as the main slapd TLS settings.
551
552The {{EX:suffixmassage}} parameter allows the consumer to pull entries
553from a remote directory whose DN suffix differs from the local directory.
554The portion of the remote entries' DNs that matches the searchbase will
555be replaced with the suffixmassage DN.
556
557Rather than replicating whole entries, the consumer can query logs
558of data modifications.  This mode of operation is referred to as
559{{delta syncrepl}}.  In addition to the above parameters, the
560{{EX:logbase}} and {{EX:logfilter}} parameters must be set appropriately
561for the log that will be used. The {{EX:syncdata}} parameter must
562be set to either {{EX:"accesslog"}} if the log conforms to the
563{{slapo-accesslog}}(5) log format, or {{EX:"changelog"}} if the log
564conforms to the obsolete {{changelog}} format. If the {{EX:syncdata}}
565parameter is omitted or set to {{EX:"default"}} then the log
566parameters are ignored.
567
568The {{syncrepl}} replication mechanism is supported by the {{mdb}} backend.
569
570See the {{SECT:LDAP Sync Replication}} chapter of this guide for
571more information on how to use this directive.
572
573
574H4: updateref <URL>
575
576This directive is only applicable in a {{replica}} (or {{shadow}})
577{{slapd}}(8) instance. It
578specifies the URL to return to clients which submit update
579requests upon the replica.
580If specified multiple times, each {{TERM:URL}} is provided.
581
582\Example:
583
584>	updateref	ldap://provider.example.net
585
586
587H3: MDB Backend Directives
588
589Directives in this category only apply to the {{TERM:MDB}}
590database backend. They will apply to all "database mdb"
591instances in the configuration. For a complete reference
592of MDB backend configuration directives, see {{slapd-mdb}}(5).
593
594H4: idlexp <exponent>
595
596Specify a power of 2 for the maximum size of an index slot.
597The default is 16, yielding a maximum slot size of 2^16 or 65536.
598The specified value must be in the range of 16-31.
599
600This setting helps with the case where certain search filters are
601slow to return results due to an index slot having collapsed to a
602range value.  This occurs when the number of candidate entries that
603match the filter for the index slot exceed the configured slot size.
604
605If this setting is decreased on a server with existing {{TERM:MDB}}
606databases, each db will immediately need its indices to be rebuilt
607while slapd is offline with the "slapindex -q -t" command.
608
609If this setting is increased on a server with existing {{TERM:MDB}}
610databases, each db will need its indices rebuilt to take advantage
611of the change for indices that have already been converted to ranges.
612
613
614H3: MDB Database Directives
615
616Directives in this category only apply to the {{TERM:MDB}}
617database backend.
618That is, they must follow a "database mdb" line
619and come before any subsequent "backend" or "database" lines.
620For a complete reference of MDB configuration directives, see {{slapd-mdb}}(5).
621
622H4: directory <directory>
623
624This directive specifies the directory where the MDB files
625containing the database and associated indices live.
626
627\Default:
628
629>	directory /usr/local/var/openldap-data
630
631H4: checkpoint <kbyte> <min>
632
633This directive specifies the frequency for flushing the database disk
634buffers. This directive is only needed if the {{dbnosync}} option is
635{{EX:TRUE}}.
636The checkpoint will occur if either <kbyte> data has been written or
637<min> minutes have passed since the last checkpoint. Both arguments default
638to zero, in which case they are ignored. When the <min> argument is
639non-zero, an internal task will run every <min> minutes to perform the
640checkpoint. Note: currently the _kbyte_ setting is unimplemented.
641
642\Example:
643
644>   checkpoint: 1024 10
645
646H4: dbnosync: { TRUE | FALSE }
647
648This directive causes on-disk database contents to not be immediately
649synchronized with in memory changes upon change.  Setting this option
650to {{EX:TRUE}} may improve performance at the expense of data integrity.
651
652
653H4: envflags: {nosync,nometasync,writemap,mapasync,nordahead}
654
655This option specifies flags for finer-grained control of  the  LMDB  library's
656operation.
657
658* {{F:nosync}}: This is exactly the same as the dbnosync directive.
659
660* {{F:nometasync}}: Flush the data on a commit, but skip the sync of the meta
661page. This mode is slightly faster than doing a full sync, but can
662potentially lose the last committed transaction if the operating system
663crashes. If both nometasync and nosync are set, the nosync flag takes
664precedence.
665
666* {{F:writemap}}: Use a writable memory map instead of just read-only. This
667speeds up write operations but makes the database vulnerable to corruption in
668case any bugs in slapd cause stray writes into the mmap region.
669
670* {{F:mapasync}}: When using a writable memory map and performing flushes on
671each commit, use an asynchronous flush instead of a synchronous flush (the
672default). This option has no effect if writemap has not been set. It also has
673no effect if nosync is set.
674
675* {{F:nordahead}}: Turn off file readahead. Usually the OS performs readahead
676on every read request. This usually boosts read performance but can be
677harmful to random access read performance if the system's memory is full and
678the DB is larger than RAM. This option is not implemented on Windows.
679
680
681H4: index: {<attrlist> | default} [pres,eq,approx,sub,none]
682
683This directive specifies the indices to maintain for the given
684attribute. If only an {{EX:<attrlist>}} is given, the default
685indices are maintained. The index keywords correspond to the
686common types of matches that may be used in an LDAP search filter.
687
688\Example:
689
690>   index: default pres,eq
691>   index: uid
692>   index: cn,sn pres,eq,sub
693>   index: objectClass eq
694
695The first line sets the default set of indices to maintain to
696present and equality.  The second line causes the default (pres,eq)
697set of indices to be maintained for the {{EX:uid}} attribute type.
698The third line causes present, equality, and substring indices to
699be maintained for {{EX:cn}} and {{EX:sn}} attribute types.  The
700fourth line causes an equality index for the {{EX:objectClass}}
701attribute type.
702
703There is no index keyword for inequality matches. Generally these
704matches do not use an index. However, some attributes do support
705indexing for inequality matches, based on the equality index.
706
707A substring index can be more explicitly specified as {{EX:subinitial}},
708{{EX:subany}}, or {{EX:subfinal}}, corresponding to the three
709possible components
710of a substring match filter. A subinitial index only indexes
711substrings that appear at the beginning of an attribute value.
712A subfinal index only indexes substrings that appear at the end
713of an attribute value, while subany indexes substrings that occur
714anywhere in a value.
715
716Note that by default, setting an index for an attribute also
717affects every subtype of that attribute. E.g., setting an equality
718index on the {{EX:name}} attribute causes {{EX:cn}}, {{EX:sn}}, and every other
719attribute that inherits from {{EX:name}} to be indexed.
720
721By default, no indices are maintained.  It is generally advised
722that minimally an equality index upon objectClass be maintained.
723
724>   index: objectClass eq
725
726Additional indices should be configured corresponding to the
727most common searches that are used on the database.
728Presence indexing should not be configured for an attribute
729unless the attribute occurs very rarely in the database, and
730presence searches on the attribute occur very frequently during
731normal use of the directory. Most applications don't use presence
732searches, so usually presence indexing is not very useful.
733
734
735H4: maxentrysize: <bytes>
736
737Specify the maximum size of an entry in bytes. Attempts to store
738an entry larger than this size will be rejected with the error
739LDAP_ADMINLIMIT_EXCEEDED. The default is 0, which is unlimited.
740
741
742H4: maxreaders: <integer>
743
744This directive specifies the maximum number of threads that may have
745concurrent read access to the database. Tools such as slapcat count as a
746single thread, in addition to threads in any active slapd processes. The
747default is 126.
748
749
750H4: maxsize: <bytes>
751
752This directive specifies the maximum size of the database in bytes. A memory
753map of this size is allocated at startup time and the database will not be
754allowed to grow beyond this size. The default is 10485760 bytes (10MB). This
755setting may be changed upward if the configured limit needs to be increased.
756
757Note: It is important to set this to as large a value as possible, (relative
758to anticipated growth of the actual data over time) since growing the size
759later may not be practical when the system is under heavy load.
760
761
762H4: mode: { <octal> | <symbolic> }
763
764This directive specifies the file protection mode that newly
765created database index files should have. This can be in the form
766{{EX:0600}} or {{EX:-rw-------}}
767
768\Default:
769
770>   mode: 0600
771
772
773H4: multival: { <attrlist> | default } <integer> hi,<integer> lo
774
775Specify the number of values for which a multivalued attribute is
776stored in a separate table. Normally entries are stored as a single
777blob inside the database. When an entry gets very large or contains
778attributes with a very large number of values, modifications on that
779entry may get very slow. Splitting the large attributes out to a separate
780table can improve the performance of modification operations.
781The threshold is specified as a pair of integers. If the number of
782values exceeds the hi threshold the values will be split out. If
783a modification deletes enough values to bring an attribute below
784the lo threshold the values will be removed from the separate
785table and merged back into the main entry blob.
786The threshold can be set for a specific list of attributes, or
787the default can be configured for all other attributes.
788The default value for both hi and lo thresholds is UINT_MAX, which keeps
789all attributes in the main blob.
790
791In addition to increasing write performance of operations the use of
792multival can also decrease fragmentation of the primary {{TERM:MDB}} database.
793
794
795H4: rtxnsize: <entries>
796
797This directive specifies the maximum number of entries to process in a single
798read transaction when executing a large search. Long-lived read transactions
799prevent old database pages from being reused in write transactions, and so
800can cause significant growth of the database file when there is heavy write
801traffic. This setting causes the read transaction in large searches to be
802released and reacquired after the given number of entries has been read, to
803give writers the opportunity to reclaim old database pages. The default is
80410000.
805
806
807H4: searchstack: <integer>
808
809Specify the depth of the stack used for search filter evaluation.
810Search filters are evaluated on a stack to accommodate nested {{EX:AND}} /
811{{EX:OR}} clauses. An individual stack is allocated for each server thread.
812The depth of the stack determines how complex a filter can be evaluated
813without requiring any additional memory allocation. Filters that are
814nested deeper than the search stack depth will cause a separate stack to
815be allocated for that particular search operation. These separate allocations
816can have a major negative impact on server performance, but specifying
817too much stack will also consume a great deal of memory. Each search
818uses 512K bytes per level on a 32-bit machine, or 1024K bytes per level
819on a 64-bit machine. The default stack depth is 16, thus 8MB or 16MB
820per thread is used on 32 and 64 bit machines, respectively. Also the
821512KB size of a single stack slot is set by a compile-time constant which
822may be changed if needed; the code must be recompiled for the change
823to take effect.
824
825\Default:
826
827>   searchstack: 16
828
829
830H4: Sample Entry
831
832>database mdb
833>suffix: "dc=example,dc=com"
834>directory: /usr/local/var/openldap-data
835>index: objectClass eq
836
837
838H2: Configuration File Example
839
840The following is an example configuration file, interspersed
841with explanatory text. It defines two databases to handle
842different parts of the {{TERM:X.500}} tree; both are {{TERM:MDB}}
843database instances. The line numbers shown are provided for
844reference only and are not included in the actual file. First, the
845global configuration section:
846
847E:  1.    # example config file - global configuration section
848E:  2.    include /usr/local/etc/schema/core.schema
849E:  3.    referral ldap://root.openldap.org
850E:  4.    access to * by * read
851
852Line 1 is a comment. Line 2 includes another config file
853which contains {{core}} schema definitions.
854The {{EX:referral}} directive on line 3
855means that queries not local to one of the databases defined
856below will be referred to the LDAP server running on the
857standard port (389) at the host {{EX:root.openldap.org}}.
858
859Line 4 is a global access control.  It applies to all
860entries (after any applicable database-specific access
861controls).
862
863The next section of the configuration file defines a MDB
864backend that will handle queries for things in the
865"dc=example,dc=com" portion of the tree. The
866database is to be replicated to two replica slapds, one on
867truelies, the other on judgmentday. Indices are to be
868maintained for several attributes, and the {{EX:userPassword}}
869attribute is to be protected from unauthorized access.
870
871E:  5.    # MDB definition for the example.com
872E:  6.    database mdb
873E:  7.    suffix "dc=example,dc=com"
874E:  8.    directory /usr/local/var/openldap-data
875E:  9.    rootdn "cn=Manager,dc=example,dc=com"
876E: 10.    rootpw secret
877E: 11.    # indexed attribute definitions
878E: 12.    index uid pres,eq
879E: 13.    index cn,sn pres,eq,approx,sub
880E: 14.    index objectClass eq
881E: 15.    # database access control definitions
882E: 16.    access to attrs=userPassword
883E: 17.        by self write
884E: 18.        by anonymous auth
885E: 19.        by dn.base="cn=Admin,dc=example,dc=com" write
886E: 20.        by * none
887E: 21.    access to *
888E: 22.        by self write
889E: 23.        by dn.base="cn=Admin,dc=example,dc=com" write
890E: 24.        by * read
891
892Line 5 is a comment. The start of the database definition is marked
893by the database keyword on line 6. Line 7 specifies the DN suffix
894for queries to pass to this database. Line 8 specifies the directory
895in which the database files will live.
896
897Lines 9 and 10 identify the database {{super-user}} entry and associated
898password. This entry is not subject to access control or size or
899time limit restrictions.
900
901Lines 12 through 14 indicate the indices to maintain for various
902attributes.
903
904Lines 16 through 24 specify access control for entries in this
905database. For all applicable entries, the {{EX:userPassword}} attribute is writable
906by the entry itself and by the "admin" entry.  It may be used for
907authentication/authorization purposes, but is otherwise not readable.
908All other attributes are writable by the entry and the "admin"
909entry, but may be read by all users (authenticated or not).
910
911The next section of the example configuration file defines another
912MDB database. This one handles queries involving the
913{{EX:dc=example,dc=net}} subtree but is managed by the same entity
914as the first database.  Note that without line 39, the read access
915would be allowed due to the global access rule at line 4.
916
917E: 33.    # MDB definition for example.net
918E: 34.    database mdb
919E: 35.    suffix "dc=example,dc=net"
920E: 36.    directory /usr/local/var/openldap-data-net
921E: 37.    rootdn "cn=Manager,dc=example,dc=com"
922E: 38.    index objectClass eq
923E: 39.    access to * by users read
924