2 # Copyright 1999-2003, The OpenLDAP Foundation, All Rights Reserved.
3 # COPYING RESTRICTIONS APPLY, see COPYRIGHT.
5 H1: The slapd Configuration File
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 {{slapd.conf}}(5) file, normally installed in the
11 {{EX:/usr/local/etc/openldap}} directory.
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.
19 H2: Configuration File Format
21 The {{slapd.conf}}(5) file consists of three types of configuration
22 information: global, backend specific, and 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 backend and/or database directives, and backend directives
27 can be overridden by database directives.
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
34 > # global configuration directives
35 > <global config directives>
37 > # backend definition
39 > <backend-specific directives>
41 > # first database definition & config directives
43 > <database-specific directives>
45 > # second database definition & config directives
47 > <database-specific directives>
49 > # second database definition & config directives
51 > <database-specific directives>
53 > # subsequent backend & database definitions & config directives
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:\}}'.
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 definitions (attribute types
65 and object classes) are also provided in the
66 {{F: /usr/local/etc/openldap/schema}} directory.
69 H2: Configuration File Directives
71 This section details commonly used configuration directives. For
72 a complete list, see the {{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
82 Directives described in this section apply to all backends
83 and databases unless specifically overridden in a backend or
84 database definition. Arguments that should be replaced
85 by actual text are shown in brackets {{EX:<>}}.
88 H4: access to <what> [ by <who> <accesslevel> <control> ]+
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.
97 More details discussion of this directive can be found in the
98 {{SECT:Advanced Access Control}} chapter.
101 Note: If no {{EX:access}} directives are specified, the default
102 access control policy, {{EX:access to * by * read}}, allows all
103 both authenticated and anonymous users read access.
106 H4: attributetype <{{REF:RFC2252}} Attribute Type Description>
108 This directive defines an attribute type.
109 Please see the {{SECT:Schema Specification}} chapter
110 for information regarding how to use this directive.
112 H4: idletimeout <integer>
114 Specify the number of seconds to wait before forcibly closing
115 an idle client connection. An idletimeout of 0, the default,
116 disables this feature.
119 H4: include <filename>
121 This directive specifies that slapd should read additional
122 configuration information from the given file before continuing
123 with the next line of the current file. The included file should
124 follow the normal slapd config file format. The file is commonly
125 used to include files containing schema specifications.
127 Note: You should be careful when using this directive - there is
128 no small limit on the number of nested include directives, and no
129 loop detection is done.
131 H4: loglevel <integer>
133 This directive specifies the level at which debugging statements
134 and operation statistics should be syslogged (currently logged to
135 the {{syslogd}}(8) {{EX:LOG_LOCAL4}} facility). You must have
136 configured OpenLDAP {{EX:--enable-debug}} (the default) for this
137 to work (except for the two statistics levels, which are always
138 enabled). Log levels are additive. To display what numbers
139 correspond to what kind of debugging, invoke slapd with {{EX:-?}}
140 or consult the table below. The possible values for <integer> are:
142 !block table; colaligns="RL"; align=Center; \
143 title="Table 5.1: Debugging Levels"
145 -1 enable all debugging
147 1 trace function calls
148 2 debug packet handling
149 4 heavy trace debugging
150 8 connection management
151 16 print out packets sent and received
152 32 search filter processing
153 64 configuration file processing
154 128 access control list processing
155 256 stats log connections/operations/results
156 512 stats log entries sent
157 1024 print communication with shell backends
158 2048 print entry parsing debugging
165 This will cause lots and lots of debugging information to be
173 H4: objectclass <{{REF:RFC2252}} Object Class Description>
175 This directive defines an object class.
176 Please see the {{SECT:Schema Specification}} chapter for
177 information regarding how to use this directive.
182 This directive specifies the referral to pass back when slapd
183 cannot find a local database to handle a request.
187 > referral ldap://root.openldap.org
189 This will refer non-local queries to the global root LDAP server
190 at the OpenLDAP Project. Smart LDAP clients can re-ask their
191 query at that server, but note that most of these clients are
192 only going to know how to handle simple LDAP URLs that
193 contain a host part and optionally a distinguished name part.
196 H4: sizelimit <integer>
198 This directive specifies the maximum number of entries to return
199 from a search operation.
206 H4: timelimit <integer>
208 This directive specifies the maximum number of seconds (in real
209 time) slapd will spend answering a search request. If a
210 request is not finished in this time, a result indicating an
211 exceeded timelimit will be returned.
218 H3: General Backend Directives
220 Directives in this section apply only to the backend in which
221 they are defined. They are supported by every type of backend.
222 Backend directives apply to all databases instances of the
223 same type and, depending on the directive, may be overridden
224 by database directives.
228 This directive marks the beginning of a backend declaration.
229 {{EX:<type>}} should be one of the
230 supported backend types listed in Table 5.2.
232 !block table; align=Center; coltags="EX,N"; \
233 title="Table 5.2: Database Backends"
235 bdb Berkeley DB transactional backend
236 dnssrv DNS SRV backend
237 ldap Lightweight Directory Access Protocol (Proxy) backend
238 ldbm Lightweight DBM backend
239 meta Meta Directory backend
240 monitor Monitor backend
241 passwd Provides read-only access to {{passwd}}(5)
242 perl Perl Programmable backend
243 shell Shell (extern program) backend
244 sql SQL Programmable backend
251 This marks the beginning of a new {{TERM:BDB}} backend
255 H3: General Database Directives
257 Directives in this section apply only to the database in which
258 they are defined. They are supported by every type of database.
262 This directive marks the beginning of a database instance
264 {{EX:<type>}} should be one of the
265 supported backend types listed in Table 5.2.
271 This marks the beginning of a new {{TERM:BDB}} database instance
275 H4: readonly { on | off }
277 This directive puts the database into "read-only" mode. Any
278 attempts to modify the database will return an "unwilling to
287 > replica host=<hostname>[:<port>]
288 > [bindmethod={ simple | kerberos | sasl }]
291 > [authcid=<identity>]
292 > [authzid=<identity>]
293 > [credentials=<password>]
294 > [srvtab=<filename>]
296 This directive specifies a replication site for this database. The
297 {{EX:host=}} parameter specifies a host and optionally a port where
298 the slave slapd instance can be found. Either a domain name
299 or IP address may be used for <hostname>. If <port> is not
300 given, the standard LDAP port number (389) is used.
302 The {{EX:binddn=}} parameter gives the DN to bind as for updates to
303 the slave slapd. It should be a DN which has read/write
304 access to the slave slapd's database, typically given as a
305 {{EX:rootdn}} in the slave's config file. It must also match the
306 {{EX:updatedn}} directive in the slave slapd's config file. Since DNs are
307 likely to contain embedded spaces, the entire {{EX:"binddn=<DN>"}}
308 string should be enclosed in double quotes.
310 The {{EX:bindmethod}} is {{EX:simple}} or {{EX:kerberos}} or {{EX:sasl}},
311 depending on whether simple password-based authentication or Kerberos
312 authentication or {{TERM:SASL}} authentication is to be used when connecting
315 Simple authentication should not be used unless adequate integrity
316 and privacy protections are in place (e.g. TLS or IPSEC). Simple
317 authentication requires specification of {{EX:binddn}} and
318 {{EX:credentials}} parameters.
320 Kerberos authentication is deprecated in favor of SASL authentication
321 mechanisms, in particular the {{EX:KERBEROS_V4}} and {{EX:GSSAPI}}
322 mechanisms. Kerberos authentication requires {{EX:binddn}} and
323 {{EX:srvtab}} parameters.
325 SASL authentication is generally recommended. SASL authentication
326 requires specification of a mechanism using the {{EX:mech}} parameter.
327 Depending on the mechanism, an authentication identity and/or
328 credentials can be specified using {{EX:authcid}} and {{EX:credentials}}
329 respectively. The {{EX:authzid}} parameter may be used to specify
330 an authorization identity.
332 See the chapter entitled {{SECT:Replication with slurpd}} for more
333 information on how to use this directive.
336 H4: replogfile <filename>
338 This directive specifies the name of the replication log file to
339 which slapd will log changes. The replication log is typically
340 written by slapd and read by slurpd. Normally, this directive is
341 only used if slurpd is being used to replicate the database.
342 However, you can also use it to generate a transaction log, if
343 slurpd is not running. In this case, you will need to periodically
344 truncate the file, since it will grow indefinitely otherwise.
346 See the chapter entitled {{SECT:Replication with slurpd}} for more
347 information on how to use this directive.
352 This directive specifies the DN that is not subject to
353 access control or administrative limit restrictions for
354 operations on this database. The DN need not refer to
355 an entry in this database or even in the directory. The
356 DN may refer to a SASL identity.
360 > rootdn "cn=Manager,dc=example,dc=com"
364 > rootdn "uid=root,cn=example.com,cn=digest-md5,cn=auth"
366 See the {{SECT:SASL Authentication}} section for information on
367 SASL authentication identities.
370 H4: rootpw <password>
372 This directive can be used to specifies a password for the DN for
373 the rootdn (when the rootdn is set to a DN within the database).
379 It is also permissible to provide hash of the password in RFC 2307
380 form. {{slappasswd}}(8) may be used to generate the password hash.
384 > rootpw {SSHA}ZKKuqbEKJfKSXhUbHG3fG8MDn9j1v4QN
386 The hash was generated using the command {{EX:slappasswd -s secret}}.
389 H4: suffix <dn suffix>
391 This directive specifies the DN suffix of queries that will be
392 passed to this backend database. Multiple suffix lines can be
393 given, and at least one is required for each database
398 > suffix "dc=example,dc=com"
400 Queries with a DN ending in "dc=example,dc=com"
401 will be passed to this backend.
403 Note: When the backend to pass a query to is selected, slapd
404 looks at the suffix line(s) in each database definition in the
405 order they appear in the file. Thus, if one database suffix is a
406 prefix of another, it must appear after it in the config file.
410 This directive is only applicable in a slave slapd. It specifies
411 the DN allowed to make changes to the replica. This may be the DN
412 {{slurpd}}(8) binds as when making changes to the replica or the DN
413 associated with a SASL identity.
417 > updatedn "cn=Update Daemon,dc=example,dc=com"
421 > updatedn "uid=slurpd,cn=example.com,cn=digest-md5,cn=auth"
423 See the {{SECT:Replication with slurpd}} chapter for more information
424 on how to use this directive.
428 This directive is only applicable in a slave slapd. It
429 specifies the URL to return to clients which submit update
430 requests upon the replica.
431 If specified multiple times, each {{TERM:URL}} is provided.
435 > updateref ldap://master.example.net
438 H3: BDB Database Directives
440 Directives in this category only apply to a {{TERM:BDB}} database.
441 That is, they must follow a "database bdb" line and come before any
442 subsequent "backend" or "database" line. For a complete reference
443 of BDB configuration directives, see {{slapd-bdb}}(5).
445 H4: directory <directory>
447 This directive specifies the directory where the BDB files
448 containing the database and associated indices live.
452 > directory /usr/local/var/openldap-data
455 H3: LDBM Database Directives
457 Directives in this category only apply to a {{TERM:LDBM}} database.
458 That is, they must follow a "database ldbm" line and come before
459 any subsequent "backend" or "database" line. For a complete reference
460 of LDBM configuration directives, see {{slapd-ldbm}}(5).
462 H4: cachesize <integer>
464 This directive specifies the size in entries of the in-memory
465 cache maintained by the LDBM backend database instance.
472 H4: dbcachesize <integer>
474 This directive specifies the size in bytes of the in-memory cache
475 associated with each open index file. If not supported by the
476 underlying database method, this directive is ignored without
477 comment. Increasing this number uses more memory but can
478 cause a dramatic performance increase, especially during
479 modifies or when building indices.
488 This option, if present, disables database locking.
489 Enabling this option may improve performance at the expense
495 This option causes on-disk database contents to not be immediately
496 synchronized with in memory changes upon change. Enabling this option
497 may improve performance at the expense of data integrity.
500 H4: directory <directory>
502 This directive specifies the directory where the LDBM files
503 containing the database and associated indices live.
507 > directory /usr/local/var/openldap-data
510 H4: index {<attrlist> | default} [pres,eq,approx,sub,none]
512 This directive specifies the indices to maintain for the given
513 attribute. If only an {{EX:<attrlist>}} is given, the default
514 indices are maintained.
518 > index default pres,eq
520 > index cn,sn pres,eq,sub
521 > index objectClass eq
523 The first line sets the default set of indices to maintain to
524 present and equality. The second line causes the default (pres,eq)
525 set of indices to be maintained for the {{EX:uid}} attribute type.
526 The third line causes present, equality, and substring indices to
527 be maintained for {{EX:cn}} and {{EX:sn}} attribute types. The
528 fourth line causes an equality index for the {{EX:objectClass}}
531 By default, no indices are maintained. It is generally advised
532 that minimally an equality index upon objectClass be maintained.
534 > index objectClass eq
540 This directive specifies the file protection mode that newly
541 created database index files should have.
550 Access to slapd entries and attributes is controlled by the
551 access configuration file directive. The general form of an
554 > <access directive> ::= access to <what>
555 > [by <who> <access> <control>]+
557 > [dn[.<basic-style>]=<regex> | dn.<scope-style>=<DN>]
558 > [filter=<ldapfilter>] [attrs=<attrlist>]
559 > <basic-style> ::= regex | exact
560 > <scope-style> ::= base | one | subtree | children
561 > <attrlist> ::= <attr> | <attr> , <attrlist>
562 > <attr> ::= <attrname> | entry | children
563 > <who> ::= * | [anonymous | users | self
564 > | dn[.<basic-style>]=<regex> | dn.<scope-style>=<DN>]
565 > [dnattr=<attrname>]
566 > [group[/<objectclass>[/<attrname>][.<basic-style>]]=<regex>]
567 > [peername[.<basic-style>]=<regex>]
568 > [sockname[.<basic-style>]=<regex>]
569 > [domain[.<basic-style>]=<regex>]
570 > [sockurl[.<basic-style>]=<regex>]
573 > <access> ::= [self]{<level>|<priv>}
574 > <level> ::= none | auth | compare | search | read | write
575 > <priv> ::= {=|+|-}{w|r|s|c|x}+
576 > <control> ::= [stop | continue | break]
578 where the <what> part selects the entries and/or attributes to which
579 the access applies, the {{EX:<who>}} part specifies which entities
580 are granted access, and the {{EX:<access>}} part specifies the
581 access granted. Multiple {{EX:<who> <access> <control>}} triplets
582 are supported, allowing many entities to be granted different access
583 to the same set of entries and attributes. Not all of these access
584 control options are described here; for more details see the
585 {{slapd.access}}(5) man page.
588 H3: What to control access to
590 The <what> part of an access specification determines the entries
591 and attributes to which the access control applies. Entries are
592 commonly selected in two ways: by DN and by filter. The following
593 qualifiers select entries by DN:
596 > by dn[.<basic-style>]=<regex>
597 > by dn.<scope-style>=<DN>
599 The first form is used to select all entries. The second form may
600 be used to select entries by matching a regular expression against
601 the target entry's {{normalized DN}}. (The second form is not
602 discussed further in this document.) The third form is used to
603 select entries which are within the requested scope of DN. The
604 <DN> is a string representation of the Distinguished Name, as
605 described in {{REF:RFC2253}}.
607 The scope can be either {{EX:base}}, {{EX:one}}, {{EX:subtree}},
608 or {{EX:children}}. Where {{EX:base}} matches only the entry with
609 provided DN, {{EX:one}} matches the entries whose parent is the
610 provided DN, {{EX:subtree}} matches all entries in the subtree whose
611 root is the provided DN, and {{EX:children}} matches all entries
612 under the DN (but not the entry named by the DN).
614 For example, if the directory contained entries named:
617 > 1: cn=Manager,o=suffix
618 > 2: ou=people,o=suffix
619 > 3: uid=kdz,ou=people,o=suffix
620 > 4: cn=addresses,uid=kdz,ou=people,o=suffix
621 > 5: uid=hyc,ou=people,o=suffix
624 . {{EX:dn.base="ou=people,o=suffix"}} match 2;
625 . {{EX:dn.one="ou=people,o=suffix"}} match 3, and 5;
626 . {{EX:dn.subtree="ou=people,o=suffix"}} match 2, 3, 4, and 5; and
627 . {{EX:dn.children="ou=people,o=suffix"}} match 3, 4, and 5.
630 Entries may also be selected using a filter:
632 > by filter=<ldap filter>
634 where <ldap filter> is a string representation of an LDAP
635 search filter, as described in {{REF:RFC2254}}. For example:
637 > by filter=(objectClass=person)
639 Note that entries may be selected by both DN and filter by
640 including both qualifiers in the <what> clause.
642 > by dn.one="ou=people,o=suffix" filter=(objectClass=person)
644 Attributes within an entry are selected by including a comma-separated
645 list of attribute names in the <what> selector:
647 > attrs=<attribute list>
649 There are two special {{pseudo}} attributes {{EX:entry}} and
650 {{EX:children}}. To read (and hence return) an target entry, the
651 subject must have {{EX:read}} access to the target's {{entry}}
652 attribute. To add or delete an entry, the subject must have
653 {{EX:write}} access to the entry's {{EX:entry}} attribute AND must
654 have {{EX:write}} access to the entry's parent's {{EX:children}}
655 attribute. To rename an entry, the subject must have {{EX:write}}
656 access to entry's {{EX:entry}} attribute AND have {{EX:write}}
657 access to both the old parent's and new parent's {{EX:children}}
658 attributes. The complete examples at the end of this section should
659 help clear things up.
661 Lastly, there is a special entry selector {{EX:"*"}} that is used to
662 select any entry. It is used when no other {{EX:<what>}}
663 selector has been provided. It's equivalent to "{{EX:dn=.*}}"
666 H3: Who to grant access to
668 The <who> part identifies the entity or entities being granted
669 access. Note that access is granted to "entities" not "entries."
670 The following table summarizes entity specifiers:
672 !block table; align=Center; coltags="EX,N"; \
673 title="Table 5.3: Access Entity Specifiers"
675 *|All, including anonymous and authenticated users
676 anonymous|Anonymous (non-authenticated) users
677 users|Authenticated users
678 self|User associated with target entry
679 dn[.<basic-style>]=<regex>|Users matching a regular expression
680 dn.<scope-style>=<DN>|Users within scope of a DN
683 The DN specifier behaves much like <what> clause DN specifiers.
685 Other control factors are also supported. For example, a {{EX:<who>}}
686 can be restricted by an entry listed in a DN-valued attribute in
687 the entry to which the access applies:
689 > dnattr=<dn-valued attribute name>
691 The dnattr specification is used to give access to an entry
692 whose DN is listed in an attribute of the entry (e.g., give
693 access to a group entry to whoever is listed as the owner of
696 Some factors may not be appropriate in all environments (or any).
697 For example, the domain factor relies on IP to domain name lookups.
698 As these can easily spoofed, the domain factor should not be avoided.
701 H3: The access to grant
704 The kind of <access> granted can be one of the following:
707 !block table; colaligns="LRL"; coltags="EX,EX,N"; align=Center; \
708 title="Table 5.4: Access Levels"
709 Level Privileges Description
711 auth =x needed to bind
712 compare =cx needed to compare
713 search =scx needed to apply search filters
714 read =rscx needed to read search results
715 write =wrscx needed to modify/rename
718 Each level implies all lower levels of access. So, for
719 example, granting someone {{EX:write}} access to an entry also
720 grants them {{EX:read}}, {{EX:search}}, {{EX:compare}}, and
721 {{EX:auth}} access. However, one may use the privileges specifier
722 to grant specific permissions.
725 H3: Access Control Evaluation
727 When evaluating whether some requester should be given access to
728 an entry and/or attribute, slapd compares the entry and/or attribute
729 to the {{EX:<what>}} selectors given in the configuration file.
730 For each entry, access controls provided in the database which holds
731 the entry (or the first database if not held in any database) apply
732 first, followed by the global access directives. Within this
733 priority, access directives are examined in the order in which they
734 appear in the config file. Slapd stops with the first {{EX:<what>}}
735 selector that matches the entry and/or attribute. The corresponding
736 access directive is the one slapd will use to evaluate access.
738 Next, slapd compares the entity requesting access to the {{EX:<who>}}
739 selectors within the access directive selected above in the order
740 in which they appear. It stops with the first {{EX:<who>}} selector
741 that matches the requester. This determines the access the entity
742 requesting access has to the entry and/or attribute.
744 Finally, slapd compares the access granted in the selected
745 {{EX:<access>}} clause to the access requested by the client. If
746 it allows greater or equal access, access is granted. Otherwise,
749 The order of evaluation of access directives makes their placement
750 in the configuration file important. If one access directive is
751 more specific than another in terms of the entries it selects, it
752 should appear first in the config file. Similarly, if one {{EX:<who>}}
753 selector is more specific than another it should come first in the
754 access directive. The access control examples given below should
755 help make this clear.
759 H3: Access Control Examples
761 The access control facility described above is quite powerful.
762 This section shows some examples of its use. First, some
765 > access to * by * read
767 This access directive grants read access to everyone.
774 This directive allows the user to modify their entry, allows anonymous
775 to authentication against these entries, and allows all others to
776 read these entries. Note that only the first {{EX:by <who>}} clause
777 which matches applies. Hence, the anonymous users are granted
778 {{EX:auth}}, not {{EX:read}}. The last clause could just as well
779 have been "{{EX:by users read}}".
781 It is often desirable to restrict operations based upon the level
782 of protection in place. The following shows how security strength
783 factors (SSF) can be used.
786 > by ssf=128 self write
787 > by ssf=64 anonymous auth
788 > by ssf=64 users read
790 This directive allows users to modify their own entries if security
791 protections have of strength 128 or better have been established,
792 allows authentication access to anonymous users, and read access
793 when 64 or better security protections have been established. If
794 client has not establish sufficient security protections, the
795 implicit {{EX:by * none}} clause would be applied.
797 The following example shows the use of a style specifiers
798 to select the entries by DN in two access directives where
799 ordering is significant.
801 > access to dn.children="dc=example,dc=com"
803 > access to dn.children="dc=com"
806 Read access is granted to entries under the {{EX:dc=com}} subtree,
807 except for those entries under the {{EX:dc=example,dc=com}} subtree,
808 to which search access is granted. No access is granted to
809 {{EX:dc=com}} as neither access directive matches this DN. If the
810 order of these access directives was reversed, the trailing directive
811 would never be reached, since all entries under {{EX:dc=example,dc=com}}
812 are also under {{EX:dc=com}} entries.
814 Also note that if no {{EX:access to}} directive matches or no {{EX:by
815 <who>}} clause, {{B:access is denied}}. That is, every {{EX:access
816 to}} directive ends with an implicit {{EX:by * none}} clause and
817 every access list ends with an implicit {{EX:access to * by * none}}
820 The next example again shows the importance of ordering, both of
821 the access directives and the {{EX:by <who>}} clauses. It also
822 shows the use of an attribute selector to grant access to a specific
823 attribute and various {{EX:<who>}} selectors.
825 > access to dn.subtree="dc=example,dc=com" attr=homePhone
827 > by dn.children=dc=example,dc=com" search
828 > by peername=IP:10\..+ read
829 > access to dn.subtree="dc=example,dc=com"
831 > by dn.children="dc=example,dc=com" search
834 This example applies to entries in the "{{EX:dc=example,dc=com}}"
835 subtree. To all attributes except {{EX:homePhone}}, an entry can
836 write to itself, entries under {{EX:example.com}} entries can search
837 by them, anybody else has no access (implicit {{EX:by * none}})
838 excepting for authentication/authorization (which is always done
839 anonymously). The {{EX:homePhone}} attribute is writable by the
840 entry, searchable by entries under {{EX:example.com}}, readable by
841 clients connecting from network 10, and otherwise not readable
842 (implicit {{EX:by * none}}). All other access is denied by the
843 implicit {{EX:access to * by * none}}.
845 Sometimes it is useful to permit a particular DN to add or
846 remove itself from an attribute. For example, if you would like to
847 create a group and allow people to add and remove only
848 their own DN from the member attribute, you could accomplish
849 it with an access directive like this:
851 > access to attr=member,entry
852 > by dnattr=member selfwrite
854 The dnattr {{EX:<who>}} selector says that the access applies to
855 entries listed in the {{EX:member}} attribute. The {{EX:selfwrite}} access
856 selector says that such members can only add or delete their
857 own DN from the attribute, not other values. The addition of
858 the entry attribute is required because access to the entry is
859 required to access any of the entry's attributes.
862 For more details on how to use the {{EX:access}} directive,
863 consult the {{Advanced Access Control}} chapter.
867 H2: Configuration File Example
869 The following is an example configuration file, interspersed
870 with explanatory text. It defines two databases to handle
871 different parts of the {{TERM:X.500}} tree; both are {{TERM:BDB}}
872 database instances. The line numbers shown are provided for
873 reference only and are not included in the actual file. First, the
874 global configuration section:
876 E: 1. # example config file - global configuration section
877 E: 2. include /usr/local/etc/schema/core.schema
878 E: 3. referral ldap://root.openldap.org
879 E: 4. access to * by * read
881 Line 1 is a comment. Line 2 includes another config file
882 which contains {{core}} schema definitions.
883 The {{EX:referral}} directive on line 3
884 means that queries not local to one of the databases defined
885 below will be referred to the LDAP server running on the
886 standard port (389) at the host {{EX:root.openldap.org}}.
888 Line 4 is a global access control. It applies to all
889 entries (after any applicable database-specific access
892 The next section of the configuration file defines a BDB
893 backend that will handle queries for things in the
894 "dc=example,dc=com" portion of the tree. The
895 database is to be replicated to two slave slapds, one on
896 truelies, the other on judgmentday. Indices are to be
897 maintained for several attributes, and the {{EX:userPassword}}
898 attribute is to be protected from unauthorized access.
900 E: 5. # BDB definition for the example.com
902 E: 7. suffix "dc=example,dc=com"
903 E: 8. directory /usr/local/var/openldap-data
904 E: 9. rootdn "cn=Manager,dc=example,dc=com"
906 E: 11. # replication directives
907 E: 12. replogfile /usr/local/var/openldap/slapd.replog
908 E: 13. replica host=slave1.example.com:389
909 E: 14. binddn="cn=Replicator,dc=example,dc=com"
910 E: 15. bindmethod=simple credentials=secret
911 E: 16. replica host=slave2.example.com
912 E: 17. binddn="cn=Replicator,dc=example,dc=com"
913 E: 18. bindmethod=simple credentials=secret
914 E: 19. # indexed attribute definitions
915 E: 20. index uid pres,eq
916 E: 21. index cn,sn,uid pres,eq,approx,sub
917 E: 22. index objectClass eq
918 E: 23. # database access control definitions
919 E: 24. access to attr=userPassword
921 E: 26. by anonymous auth
922 E: 27. by dn.base="cn=Admin,dc=example,dc=com" write
926 E: 31. by dn.base="cn=Admin,dc=example,dc=com" write
929 Line 5 is a comment. The start of the database definition is marked
930 by the database keyword on line 6. Line 7 specifies the DN suffix
931 for queries to pass to this database. Line 8 specifies the directory
932 in which the database files will live.
934 Lines 9 and 10 identify the database {{super-user}} entry and associated
935 password. This entry is not subject to access control or size or
936 time limit restrictions.
938 Lines 11 through 18 are for replication. Line 12 specifies the
939 replication log file (where changes to the database are logged -
940 this file is written by slapd and read by slurpd). Lines 13 through
941 15 specify the hostname and port for a replicated host, the DN to
942 bind as when performing updates, the bind method (simple) and the
943 credentials (password) for the binddn. Lines 16 through 18 specify
944 a second replication site. See the {{SECT:Replication with slurpd}}
945 chapter for more information on these directives.
947 Lines 20 through 22 indicate the indices to maintain for various
950 Lines 24 through 32 specify access control for entries in this
951 database. As this is the first database, the controls also apply
952 to entries not held in any database (such as the Root DSE). For
953 all applicable entries, the {{EX:userPassword}} attribute is writable
954 by the entry itself and by the "admin" entry. It may be used for
955 authentication/authorization purposes, but is otherwise not readable.
956 All other attributes are writable by the entry and the "admin"
957 entry, but may be read by all users (authenticated or not).
959 The next section of the example configuration file defines another
960 BDB database. This one handles queries involving the
961 {{EX:dc=example,dc=net}} subtree but is managed by the same entity
962 as the first database. Note that without line 39, the read access
963 would be allowed due to the global access rule at line 4.
965 E: 33. # BDB definition for example.net
967 E: 35. suffix "dc=example,dc=net"
968 E: 36. directory /usr/local/var/openldap-data-net
969 E: 37. rootdn "cn=Manager,dc=example,dc=com"
970 E: 38. index objectClass eq
971 E: 39. access to * by users read