]> git.sur5r.net Git - openldap/blob - doc/guide/admin/slapdconfig.sdf
9f3151a0db4c4d944cd422e6ffd3c8223412c980
[openldap] / doc / guide / admin / slapdconfig.sdf
1 # $OpenLDAP$
2 # Copyright 1999-2000, The OpenLDAP Foundation, All Rights Reserved.
3 # COPYING RESTRICTIONS APPLY, see COPYRIGHT.
4
5 H1: The slapd Configuration File
6
7 Once the software has been built and installed, you are ready
8 to configure {{slapd}}(8) for use at your site. The slapd
9 runtime configuration is primarily accomplished through the
10 {{I:slapd.conf}}(5) file, normally installed in the
11 {{EX:/usr/local/etc/openldap}} directory.
12
13 An alternate configuration file can be specified via a
14 command-line option to {{slapd}}(8) or {{slurpd}}(8). This chapter
15 describes the general format of the config file, followed by a
16 detailed description of commonly used config file directives.
17
18
19 H2: Configuration File Format
20
21 The {{slapd.conf}}(5) file consists three types of configuration
22 information: global, backend specific, database specific.  Global
23 information is specified first, followed by information associated
24 with a particular backend type, which is then followed by information
25 associated with a particular database instance.  Global directives can
26 be overridden in a backend and/or database directives, backend directives
27 can be overridden by database directives.
28
29 Blank lines and comment lines beginning with a '{{EX:#}}' character
30 are ignored.  If a line begins with white space, it is considered a
31 continuation of the previous line. The general format of slapd.conf is
32 as follows:
33
34 >       # global configuration directives
35 >       <global config directives>
36 >
37 >       # backend definition
38 >       backend <typeA>
39 >       <backend-specific directives>
40 >
41 >       # first database definition & config directives
42 >       database <typeA>
43 >       <database-specific directives>
44 >
45 >       # second database definition & config directives
46 >       database <typeB>
47 >       <database-specific directives>
48 >
49 >       # second database definition & config directives
50 >       database <typeA>
51 >       <database-specific directives>
52 >
53 >       # subsequent backend & database definitions & config directives
54 >       ...
55
56 A configuration directive may take arguments.  If so, they are
57 separated by white space.  If an argument contains white space,
58 the argument should be enclosed in double quotes {{EX:"like this"}}. If
59 an argument contains a double quote or a backslash character `{{EX:\}}',
60 the character should be preceded by a backslash character `{{EX:\}}'.
61
62 The distribution contains an example configuration file that will
63 be installed in the {{F: /usr/local/etc/openldap}} directory.
64 A number of files containing schema definition (attribute types
65 and object classes) are also provided in the
66 {{F: /usr/local/etc/openldap/schema}} directory.
67
68
69 H2: Configuration File Directives
70
71 This section details commonly used configuration directives.  For
72 a complete list, see {{slapd.conf}}(5) manual page.  This section
73 separates the configuration file directives into global,
74 backend-specific and data-specific categories, describing each
75 directive and its default value (if any), and giving an example of
76 its use.
77
78
79
80 H3: Global Directives
81
82 Directives described in this section apply to all backends
83 and databases, unless specifically overridden in a backend or
84 database definition. Arguments to directives should be replaced
85 by actual text are shown in brackets {{EX:<>}}.
86
87
88 H4: access to <what> [ by <who> <accesslevel> <control> ]+
89
90 This directive grants access (specified by <accesslevel>) to a
91 set of entries and/or attributes (specified by <what>) by one or
92 more requesters (specified by <who>).
93 See the {{SECT:Access Control}} section of this chapter for a
94 summary of basic usage.
95 !if 0
96 More details discussion of this directive can be found in the
97 {{SECT:Advanced Access Control}} chapter.
98 !endif
99
100
101 H4: attributetype <{{REF:RFC2252}} Attribute Type Description>
102
103 This directive defines an attribute type.
104 Please see the {{SECT:Schema Specification}} chapter
105 for information regarding how to use this directive.
106
107 H4: defaultaccess { none | compare | search | read | write }
108
109 This directive specifies the default access to grant requesters
110 when no {{EX:access}} directives have been specified.  Access
111 levels implies all lesser access levels (e.g., read access
112 implies search and compare but no write).
113
114 Note: It is recommend that the {{EX:access}} directive be used
115 to specify access control.  See the {{SECT:Access Control}}
116 section of this chapter for information regarding the {{EX:access}}
117 directive.
118
119 \Default:
120
121 E: defaultaccess read
122
123
124 H4: idletimeout <integer>
125
126 Specify the number of seconds to wait before forcibly closing
127 an idle client connections.  A idletimeout of 0, the default,
128 disables this feature.
129
130
131 H4: include <filename>
132
133 This directive specifies that slapd should read additional
134 configuration information from the given file before continuing
135 with the next line of the current file. The included file should
136 follow the normal slapd config file format.  The file is commonly
137 used to include files containing schema specifications.
138
139 Note: You should be careful when using this directive - there is
140 no small limit on the number of nested include directives, and no
141 loop detection is done.
142
143 H4: loglevel <integer>
144
145 This directive specifies the level at which debugging statements
146 and operation statistics should be syslogged (currently
147 logged to the {{syslogd}}(8) LOG_LOCAL4 facility). You must
148 have compiled slapd with -DLDAP_DEBUG for this to work
149 (except for the two statistics levels, which are always enabled).
150 Log levels are additive. To display what numbers correspond
151 to what kind of debugging, invoke slapd with the  ? flag or
152 consult the table below. The possible values for <integer> are:
153
154 !block table; colaligns="RL"; align=Center; \
155         title="Table 5.1: Debugging Levels"
156 Level   Description
157 -1      enable all debugging
158 0       no debugging
159 1       trace function calls
160 2       debug packet handling
161 4       heavy trace debugging
162 8       connection management
163 16      print out packets sent and received
164 32      search filter processing
165 64      configuration file processing
166 128     access control list processing
167 256     stats log connections/operations/results
168 512     stats log entries sent
169 1024    print communication with shell backends
170 2048    print entry parsing debugging
171 !endblock
172
173 \Example:
174
175 E: loglevel -1
176
177 This will cause lots and lots of debugging information to be
178 logged.
179
180 \Default:
181
182 E: loglevel 256
183
184
185 H4: objectclass <{{REF:RFC2252}} Object Class Description>
186
187 This directive defines an object class.
188 Please see the {{SECT:Schema Specification}} chapter for
189 information regarding how to use this directive.
190
191
192 H4: referral <URI>
193
194 This directive specifies the referral to pass back when slapd
195 cannot find a local database to handle a request.
196
197 \Example:
198
199 >       referral ldap://root.openldap.org
200
201 This will refer non-local queries to the global root LDAP server
202 at the OpenLDAP Project. Smart LDAP clients can re-ask their
203 query at that server, but note that most of these clients are
204 only going to know how to handle simple LDAP URLs that
205 contain a host part and optionally a distinguished name part.
206
207
208 H4: sizelimit <integer>
209
210 This directive specifies the maximum number of entries to return
211 from a search operation.
212
213 \Default:
214
215 >       sizelimit 500
216
217
218 H4: timelimit <integer>
219
220 This directive specifies the maximum number of seconds (in real
221 time) slapd will spend answering a search request. If a
222 request is not finished in this time, a result indicating an
223 exceeded timelimit will be returned.
224
225 \Default:
226
227 >       timelimit 3600
228
229
230 H3: General Backend Directives
231
232 H3: General Database Directives
233
234 Directives in this section only apply to the database in which
235 they are defined. They are supported by every type of database.
236
237 H4: database <databasetype>
238
239 This directive marks the beginning of a new database instance
240 definition. <databasetype> should be one of ldbm, shell, or
241 passwd, depending on which backend will serve the
242 database.
243
244 \Example:
245
246 >       database ldbm
247
248 This marks the beginning of a new LDBM backend database
249 instance definition.
250
251
252 H4: readonly { on | off }
253
254 This directive puts the database into "read-only" mode. Any
255 attempts to modify the database will return an "unwilling to
256 perform" error.
257
258 \Default:
259
260 >       readonly off
261
262 H4: replica
263
264 >       replica host=<hostname>[:<port>]
265 >               "binddn=<DN>"
266 >               [bindmethod={ simple | kerberos }]
267 >               [credentials=<password>]
268 >               [srvtab=<filename>]
269
270 This directive specifies a replication site for this database. The
271 {{EX:host=}} parameter specifies a host and optionally a port where
272 the slave slapd instance can be found. Either a domain name
273 or IP address may be used for <hostname>. If <port> is not
274 given, the standard LDAP port number (389) is used.
275
276 The {{EX:binddn=}} parameter gives the DN to bind as for updates to
277 the slave slapd. It should be a DN which has read/write
278 access to the slave slapd's database, typically given as a
279 {{EX:rootdn}} in the slave's config file. It must also match the
280 updatedn directive in the slave slapd's config file. Since DNs are
281 likely to contain embedded spaces, the entire {{EX:"binddn=<DN>"}}
282 string should be enclosed in double quotes.
283
284 The {{EX:bindmethod}} is either simple or Kerberos, depending on
285 whether simple password-based authentication or Kerberos
286 authentication is to be used when connecting to the slave
287 slapd. Simple authentication requires a valid password be
288 given. Kerberos authentication requires a valid srvtab file.
289
290 The {{EX:credentials=}} parameter, which is only required if using
291 simple authentication, gives the password for {{EX:binddn}} on the
292 slave slapd.  Simple authentication is deprecated in favor of
293 {{TERM:SASL}} based authentication services.
294
295 The {{EX:srvtab=}} parameter is deprecated in favor of SASL
296 based authentication services.
297
298 See the {{SECT:Replication}} chapter for more information on how to
299 use this directive.
300
301
302 H4: replogfile <filename>
303
304 This directive specifies the name of the replication log file to
305 which slapd will log changes. The replication log is typically
306 written by slapd and read by slurpd. Normally, this directive is
307 only used if slurpd is being used to replicate the database.
308 However, you can also use it to generate a transaction log, if
309 slurpd is not running. In this case, you will need to periodically
310 truncate the file, since it will grow indefinitely otherwise.
311
312 See the {{SECT:Replication}} chapter for more information on how to
313 use this directive.
314
315
316 H4: rootdn <dn>
317
318 This directive specifies the DN that is not subject to
319 access control or administrative limit restrictions for
320 operations on this database.  The DN need not refer to
321 an entry in the directory. The DN may refer to a SASL
322 identity.
323
324 Entry-based Example:
325
326 >       rootdn "cn=Manager, dc=example, dc=com"
327
328 SASL-based Example:
329
330 >       rootdn "uid=root@EXAMPLE.COM"
331
332
333 H4: rootpw <password>
334
335 This directive specifies a password for the DN given above that
336 will always work, regardless of whether an entry with the given
337 DN exists or has a password.
338 This directive is deprecated in favor of SASL based authentication.
339
340 \Example:
341
342 >       rootpw secret
343
344
345 H4: suffix <dn suffix>
346
347 This directive specifies the DN suffix of queries that will be
348 passed to this backend database. Multiple suffix lines can be
349 given, and at least one is required for each database
350 definition.
351
352 \Example:
353
354 >       suffix "dc=example, dc=com"
355
356 Queries with a DN ending in "dc=example, dc=com"
357 will be passed to this backend.
358
359 Note: when the backend to pass a query to is selected, slapd
360 looks at the suffix line(s) in each database definition in the
361 order they appear in the file. Thus, if one database suffix is a
362 prefix of another, it must appear after it in the config file.
363
364 H4: updatedn <dn>
365
366 This directive is only applicable in a slave slapd. It specifies the
367 DN allowed to make changes to the replica.  This may be the
368 the DN slurpd binds as when making changes to the replica or
369 the DN associated with a SASL identity.
370
371 Entry-based Example:
372
373 >       updatedn "cn=Update Daemon, dc=example, dc=com"
374
375 SASL-based Example:
376
377 >       updatedn "uid=slurpd@EXAMPLE.COM"
378
379 See the {{SECT:Replication}} chapter for more information on how to
380 use this directive.
381
382 H4: updateref <URL>
383
384 This directive is only applicable in a slave slapd. It
385 specifies the URL to return to clients which submit update
386 requests upon the replica.
387 If specified multiple times, each {{TERM:URL}} is provided.
388
389 \Example:
390
391 >       update  ldap://master.example.net
392
393
394 H3: LDBM Backend-Specific Directives
395
396 Directives in this category only apply to the LDBM backend
397 database. That is, they must follow a "database ldbm" line and
398 come before any other "database" line.
399
400 H4: cachesize <integer>
401
402 This directive specifies the size in entries of the in-memory
403 cache maintained by the LDBM backend database instance.
404
405 \Default:
406
407 >       cachesize 1000
408
409
410 H4: dbcachesize <integer>
411
412 This directive specifies the size in bytes of the in-memory cache
413 associated with each open index file. If not supported by the
414 underlying database method, this directive is ignored without
415 comment. Increasing this number uses more memory but can
416 cause a dramatic performance increase, especially during
417 modifies or when building indexes.
418
419 \Default:
420
421 >       dbcachesize 100000
422
423
424 H4: dbnolocking
425
426 This option, if present, disables database locking.
427 Enabling this option may improve performance at the expense
428 of data security.
429
430
431 H4: dbnosync
432
433 This option causes on-disk database contents not be immediately
434 synchronized with in memory changes upon change.  Enabling this option
435 may improve performance at the expense of data security.
436
437
438 H4: directory <directory>
439
440 This directive specifies the directory where the LDBM files
441 containing the database and associated indexes live.
442
443 \Default:
444
445 >       directory /usr/local/var/openldap-ldbm
446
447
448 H4: index {<attrlist> | default} [pres,eq,approx,sub,none]
449
450 This directive specifies the indexes to maintain for the given
451 attribute. If only an {{EX:<attrlist>}} is given, the default
452 indexes are maintained.
453
454
455 \Example:
456
457 >       index default pres,eq
458 >       index objectClass,uid
459 >       index cn,sn eq,sub,approx
460
461 The first line sets the default to indices to maintain to present
462 and equality.  The second line causes the default (pres,eq) set
463 of indices to be maintained for {{EX:objectClass}} and {{EX:uid}} attribute
464 types.  The third line causes equality, substring, and approximate
465 filters to be maintained for {{EX:cn}} and {{EX:sn}} attribute types.
466
467 H4: mode <integer>
468
469 This directive specifies the file protection mode that newly
470 created database index files should have.
471
472 \Default:
473
474 >       mode 0600
475
476
477
478 H3: Other Backend and Databases
479
480 {{slapd}}(8) supports a number of other backend database types.
481
482 !block table; align=Center; coltags="EX,N"; \
483         title="Table 5.2: Backend Database Types"
484 Types   Description
485 passwd  Provides read-only access to {{F:/etc/passwd}}
486 shell   Shell (extern program) backend
487 sql     SQL Programmable backend
488 !endblock
489
490 See {{slapd.conf}}(5) for details.
491
492
493
494 H2: Access Control
495
496 Access to slapd entries and attributes is controlled by the
497 access configuration file directive. The general form of an
498 access line is:
499
500 >       <access directive> ::= access to <what>
501 >               [by <who> <access> <control>]+
502 >       <what> ::= * | [ dn[.<target style>]=<regex>]
503 >               [filter=<ldapfilter>] [attrs=<attrlist>]
504 >       <target style> ::= regex | base | one | subtree | children
505 >       <attrlist> ::= <attr> | <attr> , <attrlist>
506 >       <attr> ::= <attrname> | entry | children
507 >       <who> ::= [* | anonymous | users | self |
508 >               dn[.<subject style>]=<regex>]
509 >               [dnattr=<attrname> ]
510 >               [group[/<objectclass>[/<attrname>][.<basic style>]]=<regex> ]
511 >               [peername[.<basic style>]=<regex>]
512 >               [sockname[.<basic style>]=<regex>]
513 >               [domain[.<basic style>]=<regex>]
514 >               [sockurl[.<basic style>]=<regex>]
515 >               [set=<setspec>]
516 >               [aci=<attrname>]
517 >       <subject style> ::= regex | exact | base | one | subtree | children
518 >       <basic style> ::= regex | exact
519 >       <access> ::= [self]{<level>|<priv>}
520 >       <level> ::= none | auth | compare | search | read | write
521 >       <priv> ::= {=|+|-}{w|r|s|c|x}+
522 >       <control> ::= [stop | continue | break]
523
524 where the <what> part selects the entries and/or attributes to
525 which the access applies, the {{EX:<who>}} part specifies which
526 entities are granted access, and the {{EX:<access>}} part specifies
527 the access granted. Multiple {{EX:<who> <access> <control>}} triplets
528 are supported, allowing many entities to be granted different
529 access to the same set of entries and attributes.
530
531
532 H3: What to control access to
533
534 The <what> part of an access specification determines the
535 entries and attributes to which the access control applies.
536 Entries can be selected in two ways: by a regular expression
537 matching the entry's distinguished name:
538
539 >       dn=<regular expression>
540
541 Note: The DN pattern specified should be "normalized",
542 meaning that there should be no extra spaces, and commas
543 should be used to separate components. An example
544 normalized DN is "cn=Babs Jensen,dc=example,dc=com".
545 An example of a non-normalized DN is
546 "cn=Babs Jensen; dc=example, dc=com".
547
548 Or, entries may be selected by a filter matching some
549 attribute(s) in the entry:
550
551 >       filter=<ldap filter>
552
553 where <ldap filter> is a string representation of an LDAP
554 search filter, as described in {{REF:RFC2254}}.
555
556 Attributes within an entry are selected by including a
557 comma-separated list of attribute names in the <what>
558 selector:
559
560 >       attrs=<attribute list>
561
562 Access to the entry itself must be granted or denied using the
563 special attribute name "{{EX:entry}}". Note that giving access to an
564 attribute is not enough; access to the entry itself through the
565 {{EX:entry}} attribute is also required. The complete examples at
566 the end of this section should help clear things up.
567
568 Lastly, there is a special entry selector {{EX:"*"}} is used to
569 select any entry.  It is used when no other {{EX:<what>}}
570 selector has been provided.  It's equivalent to "{{EX:dn=.*}}"
571
572
573 H3: Who to grant access to
574
575 The <who> part identifies the entity or entities being granted
576 access. Note that access is granted to "entities" not "entries."
577 The follow table summaries entity specifiers:
578
579 !block table; align=Center; coltags="EX,N"; \
580         title="Table 5.3: Access Entity Specifiers"
581 Specifier       Entities
582 *               All, including anonymous and authenticated users
583 anonymous       Anonymous (non-authenticated) users
584 users           Authenticated users
585 self            User associated with target entry
586 dn=<regex>      Users matching regular expression
587 !endblock
588
589 The DN specifier takes a regular expression which is used
590 to match against the "normalized" DN of the current entity.
591
592 >       dn=<regular expression>
593
594 By "normalized", we mean that all extra spaces have been
595 removed from the entities DN and commas are used to
596 separate RDN components.
597
598 Other control factors forms are also supported.
599 For example, a {{EX:<what>}} can be restricted by a
600 regular expression matching the client's IP address or domain name:
601
602 >       addr=<regular expression>
603 >       domain=<regular expression>
604
605 or by an entry listed in a DN-valued attribute in the entry to
606 which the access applies:
607
608 >       dnattr=<dn-valued attribute name>
609
610 The dnattr specification is used to give access to an entry
611 whose DN is listed in an attribute of the entry (e.g., give
612 access to a group entry to whoever is listed as the owner of
613 the group entry).
614
615
616 H3: The access to grant
617
618
619 The kind of <access> granted can be one of the following:
620
621
622 !block table; colaligns="LRL"; coltags="EX,EX,N"; align=Center; \
623         title="Table 5.4: Access Levels"
624 Level   Privledges      Description
625 none                    no access
626 auth    =x              needed to bind
627 compare =cx             needed to compare
628 search  =scx            needed to apply search filters
629 read    =rscx           needed to read search results
630 write   =wrscx          needed to modify/rename
631 !endblock
632
633 Each level implies all lower levels of access. So, for
634 example, granting someone write access to an entry also
635 grants them read, search, compare, and auth access.  However,
636 one may use the privledges specify to grant specific permissions.
637
638
639 H3: Access Control Evaluation
640
641 When evaluating whether some requester should be given
642 access to an entry and/or attribute, slapd compares the entry
643 and/or attribute to the {{EX:<what>}} selectors given in the
644 configuration file. Access directives local to the current
645 database are examined first, followed by global access
646 directives. Within this priority, access directives are
647 examined in the order in which they appear in the config file.
648 Slapd stops with the first {{EX:<what>}} selector that matches the
649 entry and/or attribute. The corresponding access directive is
650 the one slapd will use to evaluate access.
651
652 Next, slapd compares the entity requesting access to the
653 {{EX:<who>}} selectors within the access directive selected above,
654 in the order in which they appear. It stops with the first {{EX:<who>}}
655 selector that matches the requester. This determines the
656 access the entity requesting access has to the entry and/or
657 attribute.
658
659 Finally, slapd compares the access granted in the selected
660 {{EX:<access>}} clause to the access requested by the client. If it
661 allows greater or equal access, access is granted. Otherwise,
662 access is denied.
663
664 The order of evaluation of access directives makes their
665 placement in the configuration file important. If one access
666 directive is more specific than another in terms of the entries
667 it selects, it should appear first in the config file. Similarly, if
668 one {{EX:<who>}} selector is more specific than another it should
669 come first in the access directive. The access control
670 examples given below should help make this clear.
671
672
673
674 H3: Access Control Examples
675
676 The access control facility described above is quite powerful.
677 This section shows some examples of its use. First, some
678 simple examples:
679
680 >       access to * by * read
681
682 This access directive grants read access to everyone.
683
684 >       access to *
685 >               by self write
686 >               by anonymous auth
687 >               by * read
688
689 This directive allows users to modify their own entries,
690 allows authenticate, and allows authenticated users to read.
691 Note that only the first {{EX:by <who>}} clause which matches applies.
692 Hence, the anonymous users are granted {{EX:auth}}, not {{EX:read}}.
693 The last clause just as well have been "{{EX:by users read}}".
694
695 The following example shows the use of a regular expression
696 to select the entries by DN in two access directives where
697 ordering is significant.
698
699 >       access to dn=".*,dc=example,dc=com"
700 >               by * search
701 >       access to dn=".*,dc=com"
702 >               by * read
703
704 Read access is granted to entries under the {{EX:dc=com}}.
705 subtree, except for those entries under the {{EX:dc=example,dc=com}}
706 subtree, to which search access is granted.  No access to
707 {{EX:dc=com}} as the neither access directive matches this DN.
708 If the order of these access directives was reversed, the
709 trailing directive would never be reached, since all
710 {{EX:dc=example,dc=com}} entries are also {{EX:dc=com}} entries.
711
712 Also note that if no {{EX:access to}} directive matches or
713 no {{EX:by <who>}} clause, {{B:access is denied}}.  That is, every
714 {{EX:access to}} directive ends with a implicit {{EX:by * none}}
715 clause and access list itself ends with {{EX:access to * by * none}}
716 directive.  Only if no access controls are specified, is the
717 {{EX:defaultaccess}} granted.
718
719 The next example again shows the importance of ordering,
720 both of the access directives and the {{EX:by <who>}} clauses.
721 It also shows the use of an attribute selector to grant access
722 to a specific attribute and various {{EX:<who>}} selectors.
723
724 >       access to dn="(.*,)?dc=example,dc=com" attr=homePhone
725 >               by self write
726 >               by dn="(.*,)?dc=example,dc=com" search
727 >               by domain=.*\.example\.com read
728 >       access to dn="(.*,)?dc=example,dc=com"
729 >               by self write
730 >               by dn=".*,dc=example,dc=com" search
731 >               by anonymous auth
732
733 This example applies to entries in the "{{EX:dc=example, dc=com}}"
734 subtree. To all attributes except {{EX:homePhone}}, the entry itself
735 can write them, other {{EX:example.com}} entries can search by them,
736 anybody else has no access ((implicit {{EX:by * none}}) excepting for
737 authentication/authorization (which is always done anonymously).
738 The {{EX:homePhone}} attribute is writable by the entry, searchable
739 by other {{EX:example.com}} entries, readable by clients connecting
740 from somewhere in the {{EX:example.com}} domain, and otherwise not
741 readable (implicit {{EX:by * none}}).  All other access
742 is denied by the implicit {{EX:access to * by * none}}.
743
744 Sometimes it is useful to permit a particular DN to add or
745 remove itself from an attribute. For example, if you would like to
746 create a group and allow people too add and remove only
747 their own DN from the member attribute, you could accomplish
748 it with an access directive like this:
749
750 >       access to attr=member,entry
751 >               by dnattr=member selfwrite
752
753 The dnattr {{EX:<who>}} selector says that the access applies to
754 entries listed in the {{EX:member}} attribute. The {{EX:selfwrite}} access
755 selector says that such members can only add or delete their
756 own DN from the attribute, not other values. The addition of
757 the entry attribute is required because access to the entry is
758 required to access any of the entry's attributes.
759
760 !if 0
761 For more details on how to use the {{EX:access}} directive,
762 consult the {{Advanced Access Control}} chapter.
763 !endif
764
765
766 H2: Configuration File Example
767
768 The following is an example configuration file, interspersed
769 with explanatory text. It defines two databases to handle
770 different parts of the {{TERM:X.500}} tree; both are {{TERM:LDBM}}
771 database instances. The line numbers shown are provided for
772 reference only and are not included in the actual file. First, the
773 global configuration section:
774
775 E:  1.  # example config file - global configuration section
776 E:  2.  include /usr/local/etc/schema/core.schema
777 E:  3.  referral ldap://root.openldap.org
778 E:  4.  access to * by * read
779  
780 Line 1 is a comment. Lines 2 include another config file
781 which containing {{core}} schema definitions.
782 The {{EX:referral}} directive on line 3
783 means that queries not local to one of the databases defined
784 below will be referred to the LDAP server running on the
785 standard port (389) at the host {{EX:root.openldap.org}}.
786
787 Line 4 is a global access control.  It is used only if
788 no database access controls match or when the target
789 objects are not under the control of any database (such as
790 the Root DSE).
791
792 The next section of the configuration file defines an LDBM
793 backend that will handle queries for things in the
794 "dc=example,dc=com" portion of the tree. The
795 database is to be replicated to two slave slapds, one on
796 truelies, the other on judgmentday. Indexes are to be
797 maintained for several attributes, and the {{EX:userPassword}}
798 attribute is to be protected from unauthorized access.
799
800 E:  5.  # ldbm definition for the example.com
801 E:  6.  database ldbm
802 E:  7.  suffix "dc=example, dc=com"
803 E:  8.  directory /usr/local/var/openldap
804 E:  9.  rootdn "cn=Manager, dc=example, dc=com"
805 E: 10.  rootpw secret
806 E: 11.  # replication directives
807 E: 12.  replogfile /usr/local/var/openldap/slapd.replog
808 E: 13.  replica host=slave1.example.com:389
809 E: 14.          binddn="cn=Replicator, dc=example, dc=com"
810 E: 15.          bindmethod=simple credentials=secret
811 E: 16.  replica host=slave2.example.com
812 E: 17.          binddn="cn=Replicator, dc=example, dc=com"
813 E: 18.          bindmethod=simple credentials=secret
814 E: 19.  # indexed attribute definitions
815 E: 20.  index uid pres,eq
816 E: 21.  index cn,sn,uid pres,eq,approx,sub
817 E: 22.  index objectClass eq
818 E: 23.  # ldbm access control definitions
819 E: 24.  access to attr=userPassword
820 E: 25.          by self write
821 E: 26.          by anonymous auth
822 E: 27.          by dn="cn=Admin,dc=example,dc=com" write
823 E: 28.          by * none
824 E: 29.  access to *
825 E: 30.          by self write
826 E: 31.          by anonymous auth
827 E: 32.          by dn="cn=Admin,dc=example,dc=com" write
828 E: 33.          by * read
829
830 Line 5 is a comment. The start of the database definition is
831 marked by the database keyword on line 6. Line 7 specifies
832 the DN suffix for queries to pass to this database. Line 8
833 specifies the directory in which the database files will live
834
835 Lines 9 and 10 identify the database "super user" entry and
836 associated password. This entry is not subject to access
837 control or size or time limit restrictions.
838
839 Lines 11 through 18 are for replication. Line 11 specifies the
840 replication log file (where changes to the database are logged
841 \- this file is written by slapd and read by slurpd). Lines 12 
842 through 14 specify the hostname and port for a replicated
843 host, the DN to bind as when performing updates, the bind
844 method (simple) and the credentials (password) for the
845 binddn. Lines 15 through 18 specify a second replication site.
846 See the {{SECT:Replication with slurpd}} chapter for more
847 information on these directives.
848
849 Lines 20 through 22 indicate the indexes to maintain for
850 various attributes.
851
852 Lines 24 through 33 specify access control for entries in the
853 database. For all entries, the {{EX:userPassword}} attribute is
854 writable by the entry and the "admin" entry, may be used for
855 authentication/authorization purposes, but is otherwise not
856 readable.  All other attributes by writable by the entry and
857 the "admin" entry, may be used for authentication/authorization
858 purposes, but may be read by authenticated users.
859
860 The next section of the example configuration file defines
861 another LDBM database. This one handles queries involving
862 the {{EX:dc=example,dc=net}} subtree.  Note that without
863 line 38, the read access would be allowed due to the
864 global access rule at line 4.
865
866 E: 33.  # ldbm definition for example.net
867 E: 34.  database ldbm
868 E: 35.  suffix "dc=example, dc=net"
869 E: 36.  directory /usr/local/var/ldbm-example-net
870 E: 37.  rootdn "cn=Manager, dc=example, dc=com"
871 E: 38.  access to * by users read