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