xref: /netbsd-src/external/bsd/openldap/dist/doc/guide/admin/slapdconfig.sdf (revision 962766853c385b86328bab806c19ccdf4e22f287)
1# $OpenLDAP: pkg/openldap-guide/admin/slapdconfig.sdf,v 1.87.2.14 2008/04/14 20:48:16 quanah Exp $
2# Copyright 1999-2008 The OpenLDAP Foundation, All Rights Reserved.
3# COPYING RESTRICTIONS APPLY, see COPYRIGHT.
4
5H1: The slapd Configuration File
6
7Once the software has been built and installed, you are ready
8to configure {{slapd}}(8) for use at your site. The slapd
9runtime configuration is primarily accomplished through the
10{{slapd.conf}}(5) file, normally installed in the
11{{EX:/usr/local/etc/openldap}} directory.
12
13An alternate configuration file location can be specified via a command-line
14option to {{slapd}}(8). This chapter describes the general format
15of the {{slapd.conf}}(5) configuration file, followed by a detailed
16description of commonly used config file directives.
17
18
19H2: Configuration File Format
20
21The {{slapd.conf}}(5) file consists of three types of configuration
22information: global, backend specific, and database specific.  Global
23information is specified first, followed by information associated
24with a particular backend type, which is then followed by information
25associated with a particular database instance.  Global directives can
26be overridden in backend and/or database directives, and backend directives
27can be overridden by database directives.
28
29Blank lines and comment lines beginning with a '{{EX:#}}' character
30are ignored.  If a line begins with white space, it is considered a
31continuation of the previous line (even if the previous line is a
32comment).
33
34The general format of slapd.conf is as follows:
35
36>	# global configuration directives
37>	<global config directives>
38>
39>	# backend definition
40>	backend <typeA>
41>	<backend-specific directives>
42>
43>	# first database definition & config directives
44>	database <typeA>
45>	<database-specific directives>
46>
47>	# second database definition & config directives
48>	database <typeB>
49>	<database-specific directives>
50>
51>	# second database definition & config directives
52>	database <typeA>
53>	<database-specific directives>
54>
55>	# subsequent backend & database definitions & config directives
56>	...
57
58A configuration directive may take arguments.  If so, they are
59separated by white space.  If an argument contains white space,
60the argument should be enclosed in double quotes {{EX:"like this"}}. If
61an argument contains a double quote or a backslash character `{{EX:\}}',
62the character should be preceded by a backslash character `{{EX:\}}'.
63
64The distribution contains an example configuration file that will
65be installed in the {{F: /usr/local/etc/openldap}} directory.
66A number of files containing schema definitions (attribute types
67and object classes) are also provided in the
68{{F: /usr/local/etc/openldap/schema}} directory.
69
70
71H2: Configuration File Directives
72
73This section details commonly used configuration directives.  For
74a complete list, see the {{slapd.conf}}(5) manual page.  This section
75separates the configuration file directives into global,
76backend-specific and data-specific categories, describing each
77directive and its default value (if any), and giving an example of
78its use.
79
80
81
82H3: Global Directives
83
84Directives described in this section apply to all backends
85and databases unless specifically overridden in a backend or
86database definition.  Arguments that should be replaced
87by actual text are shown in brackets {{EX:<>}}.
88
89
90H4: access to <what> [ by <who> [<accesslevel>] [<control>] ]+
91
92This directive grants access (specified by <accesslevel>) to a set
93of entries and/or attributes (specified by <what>) by one or more
94requestors (specified by <who>).  See the {{SECT:Access Control}} section of
95this guide for basic usage.
96
97!if 0
98More details discussion of this directive can be found in the
99{{SECT:Advanced Access Control}} chapter.
100!endif
101
102Note: If no {{EX:access}} directives are specified, the default
103access control policy, {{EX:access to * by * read}}, allows all
104both authenticated and anonymous users read access.
105
106
107H4: attributetype <{{REF:RFC4512}} Attribute Type Description>
108
109This directive defines an attribute type.
110Please see the {{SECT:Schema Specification}} chapter
111for information regarding how to use this directive.
112
113H4: idletimeout <integer>
114
115Specify the number of seconds to wait before forcibly closing
116an idle client connection.  An idletimeout of 0, the default,
117disables this feature.
118
119
120H4: include <filename>
121
122This directive specifies that slapd should read additional
123configuration information from the given file before continuing
124with the next line of the current file. The included file should
125follow the normal slapd config file format.  The file is commonly
126used to include files containing schema specifications.
127
128Note: You should be careful when using this directive - there is
129no small limit on the number of nested include directives, and no
130loop detection is done.
131
132H4: loglevel <integer>
133
134This directive specifies the level at which debugging statements
135and operation statistics should be syslogged (currently logged to
136the {{syslogd}}(8) {{EX:LOG_LOCAL4}} facility). You must have
137configured OpenLDAP {{EX:--enable-debug}} (the default) for this
138to work (except for the two statistics levels, which are always
139enabled).  Log levels are additive. To display what numbers
140correspond to what kind of debugging, invoke slapd with {{EX:-?}}
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	Description
146-1	enable all debugging
1470	no debugging
1481	trace function calls
1492	debug packet handling
1504	heavy trace debugging
1518	connection management
15216	print out packets sent and received
15332	search filter processing
15464	configuration file processing
155128	access control list processing
156256	stats log connections/operations/results
157512	stats log entries sent
1581024	print communication with shell backends
1592048	print entry parsing debugging
160!endblock
161
162\Example:
163
164E: loglevel -1
165
166This will cause lots and lots of debugging information to be
167logged.
168
169\Default:
170
171E: loglevel 256
172
173
174H4: objectclass <{{REF:RFC4512}} Object Class Description>
175
176This directive defines an object class.
177Please see the {{SECT:Schema Specification}} chapter for
178information regarding how to use this directive.
179
180
181H4: referral <URI>
182
183This directive specifies the referral to pass back when slapd
184cannot find a local database to handle a request.
185
186\Example:
187
188>	referral ldap://root.openldap.org
189
190This will refer non-local queries to the global root LDAP server
191at the OpenLDAP Project. Smart LDAP clients can re-ask their
192query at that server, but note that most of these clients are
193only going to know how to handle simple LDAP URLs that
194contain a host part and optionally a distinguished name part.
195
196
197H4: sizelimit <integer>
198
199This directive specifies the maximum number of entries to return
200from a search operation.
201
202\Default:
203
204>	sizelimit 500
205
206
207H4: timelimit <integer>
208
209This directive specifies the maximum number of seconds (in real
210time) slapd will spend answering a search request. If a
211request is not finished in this time, a result indicating an
212exceeded timelimit will be returned.
213
214\Default:
215
216>	timelimit 3600
217
218
219H3: General Backend Directives
220
221Directives in this section apply only to the backend in which
222they are defined. They are supported by every type of backend.
223Backend directives apply to all databases instances of the
224same type and, depending on the directive, may be overridden
225by database directives.
226
227H4: backend <type>
228
229This directive marks the beginning of a backend declaration.
230{{EX:<type>}} should be one of the
231supported backend types listed in Table 6.2.
232
233!block table; align=Center; coltags="EX,N"; \
234	title="Table 5.2: Database Backends"
235Types	Description
236bdb	Berkeley DB transactional backend
237dnssrv	DNS SRV backend
238hdb	Hierarchical variant of bdb backend
239ldap	Lightweight Directory Access Protocol (Proxy) backend
240meta	Meta Directory backend
241monitor	Monitor backend
242passwd	Provides read-only access to {{passwd}}(5)
243perl	Perl Programmable backend
244shell	Shell (extern program) backend
245sql	SQL Programmable backend
246!endblock
247
248\Example:
249
250>	backend bdb
251
252This marks the beginning of a new {{TERM:BDB}} backend
253definition.
254
255
256H3: General Database Directives
257
258Directives in this section apply only to the database in which
259they are defined. They are supported by every type of database.
260
261H4: database <type>
262
263This directive marks the beginning of a database instance
264declaration.
265{{EX:<type>}} should be one of the
266supported backend types listed in Table 6.2.
267
268\Example:
269
270>	database bdb
271
272This marks the beginning of a new {{TERM:BDB}} database instance
273declaration.
274
275
276H4: readonly { on | off }
277
278This directive puts the database into "read-only" mode. Any
279attempts to modify the database will return an "unwilling to
280perform" error.
281
282\Default:
283
284>	readonly off
285
286
287H4: rootdn <DN>
288
289This directive specifies the DN that is not subject to
290access control or administrative limit restrictions for
291operations on this database.  The DN need not refer to
292an entry in this database or even in the directory. The
293DN may refer to a SASL identity.
294
295Entry-based Example:
296
297>	rootdn "cn=Manager,dc=example,dc=com"
298
299SASL-based Example:
300
301>	rootdn "uid=root,cn=example.com,cn=digest-md5,cn=auth"
302
303See the {{SECT:SASL Authentication}} section for information on
304SASL authentication identities.
305
306
307H4: rootpw <password>
308
309This directive can be used to specifies a password for the DN for
310the rootdn (when the rootdn is set to a DN within the database).
311
312\Example:
313
314>	rootpw secret
315
316It is also permissible to provide hash of the password in {{REF:RFC2307}}
317form.  {{slappasswd}}(8) may be used to generate the password hash.
318
319\Example:
320
321>	rootpw {SSHA}ZKKuqbEKJfKSXhUbHG3fG8MDn9j1v4QN
322
323The hash was generated using the command {{EX:slappasswd -s secret}}.
324
325
326H4: suffix <dn suffix>
327
328This directive specifies the DN suffix of queries that will be
329passed to this backend database. Multiple suffix lines can be
330given, and at least one is required for each database
331definition.
332
333\Example:
334
335>	suffix "dc=example,dc=com"
336
337Queries with a DN ending in "dc=example,dc=com"
338will be passed to this backend.
339
340Note: When the backend to pass a query to is selected, slapd
341looks at the suffix line(s) in each database definition in the
342order they appear in the file. Thus, if one database suffix is a
343prefix of another, it must appear after it in the config file.
344
345
346H4: syncrepl
347
348>	syncrepl rid=<replica ID>
349>		provider=ldap[s]://<hostname>[:port]
350>		[type=refreshOnly|refreshAndPersist]
351>		[interval=dd:hh:mm:ss]
352>		[retry=[<retry interval> <# of retries>]+]
353>		searchbase=<base DN>
354>		[filter=<filter str>]
355>		[scope=sub|one|base]
356>		[attrs=<attr list>]
357>		[attrsonly]
358>		[sizelimit=<limit>]
359>		[timelimit=<limit>]
360>		[schemachecking=on|off]
361>		[bindmethod=simple|sasl]
362>		[binddn=<DN>]
363>		[saslmech=<mech>]
364>		[authcid=<identity>]
365>		[authzid=<identity>]
366>		[credentials=<passwd>]
367>		[realm=<realm>]
368>		[secprops=<properties>]
369>		[starttls=yes|critical]
370>		[tls_cert=<file>]
371>		[tls_key=<file>]
372>		[tls_cacert=<file>]
373>		[tls_cacertdir=<path>]
374>		[tls_reqcert=never|allow|try|demand]
375>		[tls_ciphersuite=<ciphers>]
376>		[tls_crlcheck=none|peer|all]
377>		[logbase=<base DN>]
378>		[logfilter=<filter str>]
379>		[syncdata=default|accesslog|changelog]
380
381
382This directive specifies the current database as a replica of the
383master content by establishing the current {{slapd}}(8) as a
384replication consumer site running a syncrepl replication engine.
385The master database is located at the replication provider site
386specified by the {{EX:provider}} parameter. The replica database is
387kept up-to-date with the master content using the LDAP Content
388Synchronization protocol. See {{REF:RFC4533}}
389for more information on the protocol.
390
391The {{EX:rid}} parameter is used for identification of the current
392{{EX:syncrepl}} directive within the replication consumer server,
393where {{EX:<replica ID>}} uniquely identifies the syncrepl specification
394described by the current {{EX:syncrepl}} directive. {{EX:<replica ID>}}
395is non-negative and is no more than three decimal digits in length.
396
397The {{EX:provider}} parameter specifies the replication provider site
398containing the master content as an LDAP URI. The {{EX:provider}}
399parameter specifies a scheme, a host and optionally a port where the
400provider slapd instance can be found. Either a domain name or IP
401address may be used for <hostname>. Examples are
402{{EX:ldap://provider.example.com:389}} or {{EX:ldaps://192.168.1.1:636}}.
403If <port> is not given, the standard LDAP port number (389 or 636) is used.
404Note that the syncrepl uses a consumer-initiated protocol, and hence its
405specification is located at the consumer site, whereas the {{EX:replica}}
406specification is located at the provider site. {{EX:syncrepl}} and
407{{EX:replica}} directives define two independent replication
408mechanisms. They do not represent the replication peers of each other.
409
410The content of the syncrepl replica is defined using a search
411specification as its result set. The consumer slapd will
412send search requests to the provider slapd according to the search
413specification. The search specification includes {{EX:searchbase}},
414{{EX:scope}}, {{EX:filter}}, {{EX:attrs}}, {{EX:attrsonly}},
415{{EX:sizelimit}}, and {{EX:timelimit}} parameters as in the normal
416search specification. The {{EX:searchbase}} parameter has no
417default value and must always be specified. The {{EX:scope}} defaults
418to {{EX:sub}}, the {{EX:filter}} defaults to {{EX:(objectclass=*)}},
419{{EX:attrs}} defaults to {{EX:"*,+"}} to replicate all user and operational
420attributes, and {{EX:attrsonly}} is unset by default. Both {{EX:sizelimit}}
421and {{EX:timelimit}} default to "unlimited", and only positive integers
422or "unlimited" may be specified.
423
424The {{TERM[expand]LDAP Sync}} protocol has two operation
425types: {{EX:refreshOnly}} and {{EX:refreshAndPersist}}.
426The operation type is specified by the {{EX:type}} parameter.
427In the {{EX:refreshOnly}} operation, the next synchronization search operation
428is periodically rescheduled at an interval time after each
429synchronization operation finishes. The interval is specified
430by the {{EX:interval}} parameter. It is set to one day by default.
431In the {{EX:refreshAndPersist}} operation, a synchronization search
432remains persistent in the provider {{slapd}} instance. Further updates to the
433master replica will generate {{EX:searchResultEntry}} to the consumer slapd
434as the search responses to the persistent synchronization search.
435
436If an error occurs during replication, the consumer will attempt to reconnect
437according to the retry parameter which is a list of the <retry interval>
438and <# of retries> pairs. For example, retry="60 10 300 3" lets the consumer
439retry every 60 seconds for the first 10 times and then retry every 300 seconds
440for the next three times before stop retrying. + in <#  of retries> means
441indefinite number of retries until success.
442
443The schema checking can be enforced at the LDAP Sync consumer site
444by turning on the {{EX:schemachecking}} parameter.
445If it is turned on, every replicated entry will be checked for its
446schema as the entry is stored into the replica content.
447Every entry in the replica should contain those attributes
448required by the schema definition.
449If it is turned off, entries will be stored without checking
450schema conformance. The default is off.
451
452The {{EX:binddn}} parameter gives the DN to bind as for the
453syncrepl searches to the provider slapd. It should be a DN
454which has read access to the replication content in the
455master database.
456
457The {{EX:bindmethod}} is {{EX:simple}} or {{EX:sasl}},
458depending on whether simple password-based authentication or
459{{TERM:SASL}} authentication is to be used when connecting
460to the provider {{slapd}} instance.
461
462Simple authentication should not be used unless adequate data
463integrity and confidentiality protections are in place (e.g. TLS
464or IPsec). Simple authentication requires specification of {{EX:binddn}}
465and {{EX:credentials}} parameters.
466
467SASL authentication is generally recommended.  SASL authentication
468requires specification of a mechanism using the {{EX:saslmech}} parameter.
469Depending on the mechanism, an authentication identity and/or
470credentials can be specified using {{EX:authcid}} and {{EX:credentials}},
471respectively.  The {{EX:authzid}} parameter may be used to specify
472an authorization identity.
473
474The {{EX:realm}} parameter specifies a realm which a certain
475mechanisms authenticate the identity within. The {{EX:secprops}}
476parameter specifies Cyrus SASL security properties.
477
478The {{EX:starttls}} parameter specifies use of the StartTLS extended
479operation to establish a TLS session before authenticating to the provider.
480If the {{EX:critical}} argument is supplied, the session will be aborted
481if the StartTLS request fails.  Otherwise the syncrepl session continues
482without TLS.  Note that the main slapd TLS settings are not used by the
483syncrepl engine; by default the TLS parameters from a {{ldap.conf}}(5)
484configuration file will be used.  TLS settings may be specified here,
485in which case any {{ldap.conf}}(5) settings will be completely ignored.
486
487Rather than replicating whole entries, the consumer can query logs
488of data modifications.  This mode of operation is referred to as
489{{delta syncrepl}}.  In addition to the above parameters, the
490{{EX:logbase}} and {{EX:logfilter}} parameters must be set appropriately
491for the log that will be used. The {{EX:syncdata}} parameter must
492be set to either {{EX:"accesslog"}} if the log conforms to the
493{{slapo-accesslog}}(5) log format, or {{EX:"changelog"}} if the log
494conforms to the obsolete {{changelog}} format. If the {{EX:syncdata}}
495parameter is omitted or set to {{EX:"default"}} then the log
496parameters are ignored.
497
498The {{syncrepl}} replication mechanism is supported by the {{bdb}} and
499{{hdb}} backends.
500
501See the {{SECT:LDAP Sync Replication}} chapter of this guide for
502more information on how to use this directive.
503
504
505H4: updateref <URL>
506
507This directive is only applicable in a {{slave}} (or {{shadow}})
508{{slapd}}(8) instance. It
509specifies the URL to return to clients which submit update
510requests upon the replica.
511If specified multiple times, each {{TERM:URL}} is provided.
512
513\Example:
514
515>	updateref	ldap://master.example.net
516
517
518H3: BDB and HDB Database Directives
519
520Directives in this category only apply to both the {{TERM:BDB}}
521and the {{TERM:HDB}} database.
522That is, they must follow a "database bdb" or "database hdb" line
523and come before any
524subsequent "backend" or "database" line.  For a complete reference
525of BDB/HDB configuration directives, see {{slapd-bdb}}(5).
526
527
528H4: directory <directory>
529
530This directive specifies the directory where the BDB files
531containing the database and associated indices live.
532
533\Default:
534
535>	directory /usr/local/var/openldap-data
536