xref: /netbsd-src/external/bsd/openldap/dist/doc/guide/admin/slapdconfig.sdf (revision b7b7574d3bf8eeb51a1fa3977b59142ec6434a55)
1# $OpenLDAP$
2# Copyright 1999-2014 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 debugging statements
134and operation statistics should be syslogged (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. To display what
140numbers correspond to what kind of debugging, invoke slapd with {{EX:-d?}}
141or consult the table below. The possible values for <integer> are:
142
143!block table; colaligns="RL"; align=Center; \
144	title="Table 6.1: Debugging Levels"
145Level	Keyword		Description
146-1	any		enable all debugging
1470			no debugging
1481	(0x1 trace)	trace function calls
1492	(0x2 packets)	debug packet handling
1504	(0x4 args)	heavy trace debugging
1518	(0x8 conns)	connection management
15216	(0x10 BER)	print out packets sent and received
15332	(0x20 filter)	search filter processing
15464	(0x40 config)	configuration processing
155128	(0x80 ACL)	access control list processing
156256	(0x100 stats)	stats log connections/operations/results
157512	(0x200 stats2)	stats log entries sent
1581024	(0x400 shell)	print communication with shell backends
1592048	(0x800 parse)	print entry parsing debugging
16016384	(0x4000 sync)	syncrepl consumer processing
16132768	(0x8000 none)	only messages that get logged whatever log level is set
162!endblock
163
164The desired log level can be input as a single integer that
165combines the (ORed) desired levels, both in decimal or in hexadecimal
166notation, as a list of integers (that are ORed internally), or as a list of the names that are shown between brackets, such that
167
168>		loglevel 129
169>		loglevel 0x81
170>		loglevel 128 1
171>		loglevel 0x80 0x1
172>		loglevel acl trace
173
174are equivalent.
175
176\Examples:
177
178E: loglevel -1
179
180This will cause lots and lots of debugging information to be
181logged.
182
183E: loglevel conns filter
184
185Just log the connection and search filter processing.
186
187E: loglevel none
188
189Log those messages that are logged regardless of the configured loglevel. This
190differs from setting the log level to 0, when no logging occurs. At least the
191{{EX:None}} level is required to have high priority messages logged.
192
193\Default:
194
195E: loglevel stats
196
197Basic stats logging is configured by default. However, if no loglevel is
198defined, no logging occurs (equivalent to a 0 level).
199
200H4: objectclass <{{REF:RFC4512}} Object Class Description>
201
202This directive defines an object class.
203Please see the {{SECT:Schema Specification}} chapter for
204information regarding how to use this directive.
205
206
207H4: referral <URI>
208
209This directive specifies the referral to pass back when slapd
210cannot find a local database to handle a request.
211
212\Example:
213
214>	referral ldap://root.openldap.org
215
216This will refer non-local queries to the global root LDAP server
217at the OpenLDAP Project. Smart LDAP clients can re-ask their
218query at that server, but note that most of these clients are
219only going to know how to handle simple LDAP URLs that
220contain a host part and optionally a distinguished name part.
221
222
223H4: sizelimit <integer>
224
225This directive specifies the maximum number of entries to return
226from a search operation.
227
228\Default:
229
230>	sizelimit 500
231
232See the {{SECT:Limits}} section of this guide and slapd.conf(5)
233for more details.
234
235H4: timelimit <integer>
236
237This directive specifies the maximum number of seconds (in real
238time) slapd will spend answering a search request. If a
239request is not finished in this time, a result indicating an
240exceeded timelimit will be returned.
241
242\Default:
243
244>	timelimit 3600
245
246See the {{SECT:Limits}} section of this guide and slapd.conf(5)
247for more details.
248
249
250H3: General Backend Directives
251
252Directives in this section apply only to the backend in which
253they are defined. They are supported by every type of backend.
254Backend directives apply to all databases instances of the
255same type and, depending on the directive, may be overridden
256by database directives.
257
258H4: backend <type>
259
260This directive marks the beginning of a backend declaration.
261{{EX:<type>}} should be one of the
262supported backend types listed in Table 6.2.
263
264!block table; align=Center; coltags="EX,N"; \
265	title="Table 6.2: Database Backends"
266Types	Description
267bdb	Berkeley DB transactional backend
268dnssrv	DNS SRV backend
269hdb	Hierarchical variant of bdb backend
270ldap	Lightweight Directory Access Protocol (Proxy) backend
271meta	Meta Directory backend
272monitor	Monitor backend
273passwd	Provides read-only access to {{passwd}}(5)
274perl	Perl Programmable backend
275shell	Shell (extern program) backend
276sql	SQL Programmable backend
277!endblock
278
279\Example:
280
281>	backend bdb
282
283This marks the beginning of a new {{TERM:BDB}} backend
284definition.
285
286
287H3: General Database Directives
288
289Directives in this section apply only to the database in which
290they are defined. They are supported by every type of database.
291
292H4: database <type>
293
294This directive marks the beginning of a database instance
295declaration.
296{{EX:<type>}} should be one of the
297supported backend types listed in Table 6.2.
298
299\Example:
300
301>	database bdb
302
303This marks the beginning of a new {{TERM:BDB}} database instance
304declaration.
305
306
307H4: limits <who> <limit> [<limit> [...]]
308
309Specify time and size limits based on who initiated an operation.
310
311See the {{SECT:Limits}} section of this guide and slapd.conf(5)
312for more details.
313
314
315H4: readonly { on | off }
316
317This directive puts the database into "read-only" mode. Any
318attempts to modify the database will return an "unwilling to
319perform" error.
320
321\Default:
322
323>	readonly off
324
325
326H4: rootdn <DN>
327
328This directive specifies the DN that is not subject to
329access control or administrative limit restrictions for
330operations on this database.  The DN need not refer to
331an entry in this database or even in the directory. The
332DN may refer to a SASL identity.
333
334Entry-based Example:
335
336>	rootdn "cn=Manager,dc=example,dc=com"
337
338SASL-based Example:
339
340>	rootdn "uid=root,cn=example.com,cn=digest-md5,cn=auth"
341
342See the {{SECT:SASL Authentication}} section for information on
343SASL authentication identities.
344
345
346H4: rootpw <password>
347
348This directive can be used to specifies a password for the DN for
349the rootdn (when the rootdn is set to a DN within the database).
350
351\Example:
352
353>	rootpw secret
354
355It is also permissible to provide hash of the password in {{REF:RFC2307}}
356form.  {{slappasswd}}(8) may be used to generate the password hash.
357
358\Example:
359
360>	rootpw {SSHA}ZKKuqbEKJfKSXhUbHG3fG8MDn9j1v4QN
361
362The hash was generated using the command {{EX:slappasswd -s secret}}.
363
364
365H4: suffix <dn suffix>
366
367This directive specifies the DN suffix of queries that will be
368passed to this backend database. Multiple suffix lines can be
369given, and at least one is required for each database
370definition.
371
372\Example:
373
374>	suffix "dc=example,dc=com"
375
376Queries with a DN ending in "dc=example,dc=com"
377will be passed to this backend.
378
379Note: When the backend to pass a query to is selected, slapd
380looks at the suffix line(s) in each database definition in the
381order they appear in the file. Thus, if one database suffix is a
382prefix of another, it must appear after it in the config file.
383
384
385H4: syncrepl
386
387>	syncrepl rid=<replica ID>
388>		provider=ldap[s]://<hostname>[:port]
389>		[type=refreshOnly|refreshAndPersist]
390>		[interval=dd:hh:mm:ss]
391>		[retry=[<retry interval> <# of retries>]+]
392>		searchbase=<base DN>
393>		[filter=<filter str>]
394>		[scope=sub|one|base]
395>		[attrs=<attr list>]
396>		[attrsonly]
397>		[sizelimit=<limit>]
398>		[timelimit=<limit>]
399>		[schemachecking=on|off]
400>		[bindmethod=simple|sasl]
401>		[binddn=<DN>]
402>		[saslmech=<mech>]
403>		[authcid=<identity>]
404>		[authzid=<identity>]
405>		[credentials=<passwd>]
406>		[realm=<realm>]
407>		[secprops=<properties>]
408>		[starttls=yes|critical]
409>		[tls_cert=<file>]
410>		[tls_key=<file>]
411>		[tls_cacert=<file>]
412>		[tls_cacertdir=<path>]
413>		[tls_reqcert=never|allow|try|demand]
414>		[tls_ciphersuite=<ciphers>]
415>		[tls_crlcheck=none|peer|all]
416>		[logbase=<base DN>]
417>		[logfilter=<filter str>]
418>		[syncdata=default|accesslog|changelog]
419
420
421This directive specifies the current database as a replica of the
422master content by establishing the current {{slapd}}(8) as a
423replication consumer site running a syncrepl replication engine.
424The master database is located at the replication provider site
425specified by the {{EX:provider}} parameter. The replica database is
426kept up-to-date with the master content using the LDAP Content
427Synchronization protocol. See {{REF:RFC4533}}
428for more information on the protocol.
429
430The {{EX:rid}} parameter is used for identification of the current
431{{EX:syncrepl}} directive within the replication consumer server,
432where {{EX:<replica ID>}} uniquely identifies the syncrepl specification
433described by the current {{EX:syncrepl}} directive. {{EX:<replica ID>}}
434is non-negative and is no more than three decimal digits in length.
435
436The {{EX:provider}} parameter specifies the replication provider site
437containing the master content as an LDAP URI. The {{EX:provider}}
438parameter specifies a scheme, a host and optionally a port where the
439provider slapd instance can be found. Either a domain name or IP
440address may be used for <hostname>. Examples are
441{{EX:ldap://provider.example.com:389}} or {{EX:ldaps://192.168.1.1:636}}.
442If <port> is not given, the standard LDAP port number (389 or 636) is used.
443Note that the syncrepl uses a consumer-initiated protocol, and hence its
444specification is located at the consumer site, whereas the {{EX:replica}}
445specification is located at the provider site. {{EX:syncrepl}} and
446{{EX:replica}} directives define two independent replication
447mechanisms. They do not represent the replication peers of each other.
448
449The content of the syncrepl replica is defined using a search
450specification as its result set. The consumer slapd will
451send search requests to the provider slapd according to the search
452specification. The search specification includes {{EX:searchbase}},
453{{EX:scope}}, {{EX:filter}}, {{EX:attrs}}, {{EX:attrsonly}},
454{{EX:sizelimit}}, and {{EX:timelimit}} parameters as in the normal
455search specification. The {{EX:searchbase}} parameter has no
456default value and must always be specified. The {{EX:scope}} defaults
457to {{EX:sub}}, the {{EX:filter}} defaults to {{EX:(objectclass=*)}},
458{{EX:attrs}} defaults to {{EX:"*,+"}} to replicate all user and operational
459attributes, and {{EX:attrsonly}} is unset by default. Both {{EX:sizelimit}}
460and {{EX:timelimit}} default to "unlimited", and only positive integers
461or "unlimited" may be specified.
462
463The {{TERM[expand]LDAP Sync}} protocol has two operation
464types: {{EX:refreshOnly}} and {{EX:refreshAndPersist}}.
465The operation type is specified by the {{EX:type}} parameter.
466In the {{EX:refreshOnly}} operation, the next synchronization search operation
467is periodically rescheduled at an interval time after each
468synchronization operation finishes. The interval is specified
469by the {{EX:interval}} parameter. It is set to one day by default.
470In the {{EX:refreshAndPersist}} operation, a synchronization search
471remains persistent in the provider {{slapd}} instance. Further updates to the
472master replica will generate {{EX:searchResultEntry}} to the consumer slapd
473as the search responses to the persistent synchronization search.
474
475If an error occurs during replication, the consumer will attempt to reconnect
476according to the retry parameter which is a list of the <retry interval>
477and <# of retries> pairs. For example, retry="60 10 300 3" lets the consumer
478retry every 60 seconds for the first 10 times and then retry every 300 seconds
479for the next three times before stop retrying. + in <#  of retries> means
480indefinite number of retries until success.
481
482The schema checking can be enforced at the LDAP Sync consumer site
483by turning on the {{EX:schemachecking}} parameter.
484If it is turned on, every replicated entry will be checked for its
485schema as the entry is stored into the replica content.
486Every entry in the replica should contain those attributes
487required by the schema definition.
488If it is turned off, entries will be stored without checking
489schema conformance. The default is off.
490
491The {{EX:binddn}} parameter gives the DN to bind as for the
492syncrepl searches to the provider slapd. It should be a DN
493which has read access to the replication content in the
494master database.
495
496The {{EX:bindmethod}} is {{EX:simple}} or {{EX:sasl}},
497depending on whether simple password-based authentication or
498{{TERM:SASL}} authentication is to be used when connecting
499to the provider {{slapd}} instance.
500
501Simple authentication should not be used unless adequate data
502integrity and confidentiality protections are in place (e.g. TLS
503or IPsec). Simple authentication requires specification of {{EX:binddn}}
504and {{EX:credentials}} parameters.
505
506SASL authentication is generally recommended.  SASL authentication
507requires specification of a mechanism using the {{EX:saslmech}} parameter.
508Depending on the mechanism, an authentication identity and/or
509credentials can be specified using {{EX:authcid}} and {{EX:credentials}},
510respectively.  The {{EX:authzid}} parameter may be used to specify
511an authorization identity.
512
513The {{EX:realm}} parameter specifies a realm which a certain
514mechanisms authenticate the identity within. The {{EX:secprops}}
515parameter specifies Cyrus SASL security properties.
516
517The {{EX:starttls}} parameter specifies use of the StartTLS extended
518operation to establish a TLS session before authenticating to the provider.
519If the {{EX:critical}} argument is supplied, the session will be aborted
520if the StartTLS request fails.  Otherwise the syncrepl session continues
521without TLS.  Note that the main slapd TLS settings are not used by the
522syncrepl engine; by default the TLS parameters from a {{ldap.conf}}(5)
523configuration file will be used.  TLS settings may be specified here,
524in which case any {{ldap.conf}}(5) settings will be completely ignored.
525
526Rather than replicating whole entries, the consumer can query logs
527of data modifications.  This mode of operation is referred to as
528{{delta syncrepl}}.  In addition to the above parameters, the
529{{EX:logbase}} and {{EX:logfilter}} parameters must be set appropriately
530for the log that will be used. The {{EX:syncdata}} parameter must
531be set to either {{EX:"accesslog"}} if the log conforms to the
532{{slapo-accesslog}}(5) log format, or {{EX:"changelog"}} if the log
533conforms to the obsolete {{changelog}} format. If the {{EX:syncdata}}
534parameter is omitted or set to {{EX:"default"}} then the log
535parameters are ignored.
536
537The {{syncrepl}} replication mechanism is supported by the {{bdb}} and
538{{hdb}} backends.
539
540See the {{SECT:LDAP Sync Replication}} chapter of this guide for
541more information on how to use this directive.
542
543
544H4: updateref <URL>
545
546This directive is only applicable in a {{slave}} (or {{shadow}})
547{{slapd}}(8) instance. It
548specifies the URL to return to clients which submit update
549requests upon the replica.
550If specified multiple times, each {{TERM:URL}} is provided.
551
552\Example:
553
554>	updateref	ldap://master.example.net
555
556
557H3: BDB and HDB Database Directives
558
559Directives in this category only apply to both the {{TERM:BDB}}
560and the {{TERM:HDB}} database.
561That is, they must follow a "database bdb" or "database hdb" line
562and come before any
563subsequent "backend" or "database" line.  For a complete reference
564of BDB/HDB configuration directives, see {{slapd-bdb}}(5).
565
566
567H4: directory <directory>
568
569This directive specifies the directory where the BDB files
570containing the database and associated indices live.
571
572\Default:
573
574>	directory /usr/local/var/openldap-data
575
576
577H2: Configuration File Example
578
579The following is an example configuration file, interspersed
580with explanatory text. It defines two databases to handle
581different parts of the {{TERM:X.500}} tree; both are {{TERM:BDB}}
582database instances. The line numbers shown are provided for
583reference only and are not included in the actual file. First, the
584global configuration section:
585
586E:  1.    # example config file - global configuration section
587E:  2.    include /usr/local/etc/schema/core.schema
588E:  3.    referral ldap://root.openldap.org
589E:  4.    access to * by * read
590
591Line 1 is a comment. Line 2 includes another config file
592which contains {{core}} schema definitions.
593The {{EX:referral}} directive on line 3
594means that queries not local to one of the databases defined
595below will be referred to the LDAP server running on the
596standard port (389) at the host {{EX:root.openldap.org}}.
597
598Line 4 is a global access control.  It applies to all
599entries (after any applicable database-specific access
600controls).
601
602The next section of the configuration file defines a BDB
603backend that will handle queries for things in the
604"dc=example,dc=com" portion of the tree. The
605database is to be replicated to two slave slapds, one on
606truelies, the other on judgmentday. Indices are to be
607maintained for several attributes, and the {{EX:userPassword}}
608attribute is to be protected from unauthorized access.
609
610E:  5.    # BDB definition for the example.com
611E:  6.    database bdb
612E:  7.    suffix "dc=example,dc=com"
613E:  8.    directory /usr/local/var/openldap-data
614E:  9.    rootdn "cn=Manager,dc=example,dc=com"
615E: 10.    rootpw secret
616E: 11.    # indexed attribute definitions
617E: 12.    index uid pres,eq
618E: 13.    index cn,sn pres,eq,approx,sub
619E: 14.    index objectClass eq
620E: 15.    # database access control definitions
621E: 16.    access to attrs=userPassword
622E: 17.        by self write
623E: 18.        by anonymous auth
624E: 19.        by dn.base="cn=Admin,dc=example,dc=com" write
625E: 20.        by * none
626E: 21.    access to *
627E: 22.        by self write
628E: 23.        by dn.base="cn=Admin,dc=example,dc=com" write
629E: 24.        by * read
630
631Line 5 is a comment. The start of the database definition is marked
632by the database keyword on line 6. Line 7 specifies the DN suffix
633for queries to pass to this database. Line 8 specifies the directory
634in which the database files will live.
635
636Lines 9 and 10 identify the database {{super-user}} entry and associated
637password. This entry is not subject to access control or size or
638time limit restrictions.
639
640Lines 12 through 14 indicate the indices to maintain for various
641attributes.
642
643Lines 16 through 24 specify access control for entries in this
644database. For all applicable entries, the {{EX:userPassword}} attribute is writable
645by the entry itself and by the "admin" entry.  It may be used for
646authentication/authorization purposes, but is otherwise not readable.
647All other attributes are writable by the entry and the "admin"
648entry, but may be read by all users (authenticated or not).
649
650The next section of the example configuration file defines another
651BDB database. This one handles queries involving the
652{{EX:dc=example,dc=net}} subtree but is managed by the same entity
653as the first database.  Note that without line 39, the read access
654would be allowed due to the global access rule at line 4.
655
656E: 33.    # BDB definition for example.net
657E: 34.    database bdb
658E: 35.    suffix "dc=example,dc=net"
659E: 36.    directory /usr/local/var/openldap-data-net
660E: 37.    rootdn "cn=Manager,dc=example,dc=com"
661E: 38.    index objectClass eq
662E: 39.    access to * by users read
663