]> git.sur5r.net Git - openldap/blob - doc/man/man5/slapd.access.5
document 'add' and 'delete' privileges (ITS#5566)
[openldap] / doc / man / man5 / slapd.access.5
1 .TH SLAPD.ACCESS 5 "RELEASEDATE" "OpenLDAP LDVERSION"
2 .\" Copyright 1998-2008 The OpenLDAP Foundation All Rights Reserved.
3 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
4 .SH NAME
5 slapd.access \- access configuration for slapd, the stand-alone LDAP daemon
6 .SH SYNOPSIS
7 ETCDIR/slapd.conf
8 .SH DESCRIPTION
9 The 
10 .BR slapd.conf (5)
11 file contains configuration information for the
12 .BR slapd (8)
13 daemon. This configuration file is also used by the SLAPD tools
14 .BR slapacl (8),
15 .BR slapadd (8),
16 .BR slapauth (8),
17 .BR slapcat (8),
18 .BR slapdn (8),
19 .BR slapindex (8),
20 and
21 .BR slaptest (8).
22 .LP
23 The
24 .B slapd.conf
25 file consists of a series of global configuration options that apply to
26 .B slapd
27 as a whole (including all backends), followed by zero or more database
28 backend definitions that contain information specific to a backend
29 instance.
30 .LP
31 The general format of
32 .B slapd.conf
33 is as follows:
34 .LP
35 .nf
36     # comment - these options apply to every database
37     <global configuration options>
38     # first database definition & configuration options
39     database    <backend 1 type>
40     <configuration options specific to backend 1>
41     # subsequent database definitions & configuration options
42     ...
43 .fi
44 .LP
45 Both the global configuration and each backend-specific section can
46 contain access information.  Backend-specific access control
47 directives are used for those entries that belong to the backend,
48 according to their naming context.  In case no access control
49 directives are defined for a backend or those which are defined are
50 not applicable, the directives from the global configuration section
51 are then used.
52 .LP
53 If no access controls are present, the default policy
54 allows anyone and everyone to read anything but restricts
55 updates to rootdn.  (e.g., "access to * by * read").
56 The rootdn can always read and write EVERYTHING!
57 .LP
58 For entries not held in any backend (such as a root DSE), the
59 directives of the first backend (and any global directives) are
60 used.
61 .LP
62 Arguments that should be replaced by actual text are shown in
63 brackets <>.
64 .SH THE ACCESS DIRECTIVE
65 The structure of the access control directives is
66 .TP
67 .B access to <what> "[ by <who> [ <access> ] [ <control> ] ]+"
68 Grant access (specified by 
69 .BR <access> ) 
70 to a set of entries and/or attributes (specified by 
71 .BR <what> ) 
72 by one or more requestors (specified by 
73 .BR <who> ).
74
75 .LP
76 Lists of access directives are evaluated in the order they appear
77 in \fIslapd.conf\fP.
78 When a
79 .B <what>
80 clause matches the datum whose access is being evaluated, its
81 .B <who>
82 clause list is checked.
83 When a
84 .B <who>
85 clause matches the accessor's properties, its
86 .B <access>
87 and
88 .B <control>
89 clauses are evaluated.
90 Access control checking stops at the first match of the
91 .B <what>
92 and
93 .B <who>
94 clause, unless otherwise dictated by the
95 .B <control>
96 clause.
97 Each
98 .B <who>
99 clause list is implicitly terminated by a
100 .LP
101 .nf
102         by * none stop
103 .fi
104 .LP
105 clause that results in stopping the access control with no access 
106 privileges granted.
107 Each
108 .B <what>
109 clause list is implicitly terminated by a
110 .LP
111 .nf
112         access to *
113                 by * none
114 .fi
115 .LP
116 clause that results in granting no access privileges to an otherwise
117 unspecified datum.
118 .SH THE <WHAT> FIELD
119 The field
120 .BR <what>
121 specifies the entity the access control directive applies to.
122 It can have the forms
123 .LP
124 .nf
125         dn[.<dnstyle>]=<dnpattern>
126         filter=<ldapfilter>
127         attrs=<attrlist>[ val[/matchingRule][.<attrstyle>]=<attrval>]
128 .fi
129 .LP
130 with
131 .LP
132 .nf
133         <dnstyle>={{exact|base(object)}|regex
134                 |one(level)|sub(tree)|children}
135         <attrlist>={<attr>|[{!|@}]<objectClass>}[,<attrlist>]
136         <attrstyle>={{exact|base(object)}|regex
137                 |one(level)|sub(tree)|children}
138 .fi
139 .LP
140 The statement
141 .B dn=<dnpattern>
142 selects the entries based on their naming context.
143 The
144 .B <dnpattern>
145 is a string representation of the entry's DN.
146 The wildcard
147 .B *
148 stands for all the entries, and it is implied if no
149 .B dn
150 form is given.
151 .LP
152 The 
153 .B <dnstyle> 
154 is optional; however, it is recommended to specify it to avoid ambiguities.
155 .B Base 
156 (synonym of
157 .BR baseObject ),
158 the default,
159 or
160 .B exact 
161 (an alias of 
162 .BR base )
163 indicates the entry whose DN is equal to the
164 .BR <dnpattern> ;
165 .B one
166 (synonym of
167 .BR onelevel )
168 indicates all the entries immediately below the
169 .BR <dnpattern> ,
170 .B sub
171 (synonym of
172 .BR subtree )
173 indicates all entries in the subtree at the
174 .BR <dnpattern> ,
175 .B children
176 indicates all the entries below (subordinate to) the 
177 .BR <dnpattern> .
178 .LP
179 If the
180 .B <dnstyle>
181 qualifier is
182 .BR regex ,
183 then 
184 .B <dnpattern>
185 is a POSIX (''extended'') regular expression pattern,
186 as detailed in
187 .BR regex (7)
188 and/or
189 .BR re_format (7),
190 matching a normalized string representation of the entry's DN.
191 The regex form of the pattern does not (yet) support UTF\-8.
192 .LP
193 The statement
194 .B filter=<ldapfilter>
195 selects the entries based on a valid LDAP filter as described in RFC 4515.
196 A filter of
197 .B (objectClass=*)
198 is implied if no
199 .B filter
200 form is given.
201 .LP
202 The statement
203 .B attrs=<attrlist>
204 selects the attributes the access control rule applies to.
205 It is a comma-separated list of attribute types, plus the special names
206 .BR entry ,
207 indicating access to the entry itself, and
208 .BR children ,
209 indicating access to the entry's children. ObjectClass names may also
210 be specified in this list, which will affect all the attributes that
211 are required and/or allowed by that objectClass.
212 Actually, names in 
213 .B <attrlist>
214 that are prefixed by
215 .B @
216 are directly treated as objectClass names.  A name prefixed by
217 .B !
218 is also treated as an objectClass, but in this case the access rule
219 affects the attributes that are not required nor allowed 
220 by that objectClass.
221 If no
222 .B attrs
223 form is given, 
224 .B attrs=@extensibleObject
225 is implied, i.e. all attributes are addressed.
226 .LP
227 Using the form
228 .B attrs=<attr> val[/matchingRule][.<attrstyle>]=<attrval>
229 specifies access to a particular value of a single attribute.
230 In this case, only a single attribute type may be given. The
231 .B <attrstyle>
232 .B exact
233 (the default) uses the attribute's equality matching rule to compare the
234 value, unless a different (and compatible) matching rule is specified. If the
235 .B <attrstyle>
236 is
237 .BR regex ,
238 the provided value is used as a POSIX (''extended'') regular
239 expression pattern.  If the attribute has DN syntax, the 
240 .B <attrstyle>
241 can be any of
242 .BR base ,
243 .BR onelevel ,
244 .B subtree
245 or
246 .BR children ,
247 resulting in base, onelevel, subtree or children match, respectively.
248 .LP
249 The dn, filter, and attrs statements are additive; they can be used in sequence 
250 to select entities the access rule applies to based on naming context,
251 value and attribute type simultaneously.
252 .SH THE <WHO> FIELD
253 The field
254 .B <who>
255 indicates whom the access rules apply to.
256 Multiple 
257 .B <who>
258 statements can appear in an access control statement, indicating the
259 different access privileges to the same resource that apply to different
260 accessee.
261 It can have the forms
262 .LP
263 .nf
264         *
265         anonymous
266         users
267         self[.<selfstyle>]
268
269         dn[.<dnstyle>[,<modifier>]]=<DN>
270         dnattr=<attrname>
271
272         realanonymous
273         realusers
274         realself[.<selfstyle>]
275
276         realdn[.<dnstyle>[,<modifier>]]=<DN>
277         realdnattr=<attrname>
278
279         group[/<objectclass>[/<attrname>]]
280                 [.<groupstyle>]=<group>
281         peername[.<peernamestyle>]=<peername>
282         sockname[.<style>]=<sockname>
283         domain[.<domainstyle>[,<modifier>]]=<domain>
284         sockurl[.<style>]=<sockurl>
285         set[.<setstyle>]=<pattern>
286
287         ssf=<n>
288         transport_ssf=<n>
289         tls_ssf=<n>
290         sasl_ssf=<n>
291
292         dynacl/<name>[/<options>][.<dynstyle>][=<pattern>]
293 .fi
294 .LP
295 with
296 .LP
297 .nf
298         <style>={exact|regex|expand}
299         <selfstyle>={level{<n>}}
300         <dnstyle>={{exact|base(object)}|regex
301                 |one(level)|sub(tree)|children|level{<n>}}
302         <groupstyle>={exact|expand}
303         <peernamestyle>={<style>|ip|ipv6|path}
304         <domainstyle>={exact|regex|sub(tree)}
305         <setstyle>={exact|regex}
306         <modifier>={expand}
307         <name>=aci              <pattern>=<attrname>]
308 .fi
309 .LP
310 They may be specified in combination.
311 .LP
312 .nf
313 .fi
314 .LP
315 The wildcard
316 .B *
317 refers to everybody.
318 .LP
319 The keywords prefixed by
320 .B real
321 act as their counterparts without prefix; the checking respectively occurs
322 with the \fIauthentication\fP DN and the \fIauthorization\fP DN.
323 .LP
324 The keyword
325 .B anonymous
326 means access is granted to unauthenticated clients; it is mostly used 
327 to limit access to authentication resources (e.g. the
328 .B userPassword
329 attribute) to unauthenticated clients for authentication purposes.
330 .LP
331 The keyword
332 .B users
333 means access is granted to authenticated clients.
334 .LP
335 The keyword
336 .B self
337 means access to an entry is allowed to the entry itself (e.g. the entry
338 being accessed and the requesting entry must be the same).
339 It allows the 
340 .B level{<n>}
341 style, where \fI<n>\fP indicates what ancestor of the DN 
342 is to be used in matches.
343 A positive value indicates that the <n>-th ancestor of the user's DN
344 is to be considered; a negative value indicates that the <n>-th ancestor
345 of the target is to be considered.
346 For example, a "\fIby self.level{1} ...\fP" clause would match
347 when the object "\fIdc=example,dc=com\fP" is accessed
348 by "\fIcn=User,dc=example,dc=com\fP".
349 A "\fIby self.level{-1} ...\fP" clause would match when the same user
350 accesses the object "\fIou=Address Book,cn=User,dc=example,dc=com\fP".
351 .LP
352 The statement
353 .B dn=<DN>
354 means that access is granted to the matching DN.
355 The optional style qualifier
356 .B dnstyle
357 allows the same choices of the dn form of the
358 .B <what>
359 field.  In addition, the
360 .B regex
361 style can exploit substring substitution of submatches in the
362 .B <what>
363 dn.regex clause by using the form
364 .BR $<digit> ,
365 with 
366 .B digit
367 ranging from 0 to 9 (where 0 matches the entire string),
368 or the form
369 .BR ${<digit>+} ,
370 for submatches higher than 9.
371 Since the dollar character is used to indicate a substring replacement,
372 the dollar character that is used to indicate match up to the end of
373 the string must be escaped by a second dollar character, e.g.
374 .LP
375 .nf
376     access to dn.regex="^(.+,)?uid=([^,]+),dc=[^,]+,dc=com$"
377         by dn.regex="^uid=$2,dc=[^,]+,dc=com$$" write
378 .fi
379 .LP
380 The style qualifier
381 allows an optional
382 .BR modifier .
383 At present, the only type allowed is 
384 .BR expand ,
385 which causes substring substitution of submatches to take place
386 even if 
387 .B dnstyle
388 is not 
389 .BR regex .
390 Note that the 
391 .B regex 
392 dnstyle in the above example may be of use only if the 
393 .B <by>
394 clause needs to be a regex; otherwise, if the
395 value of the second (from the right)
396 .B dc=
397 portion of the DN in the above example were fixed, the form
398 .LP
399 .nf
400     access to dn.regex="^(.+,)?uid=([^,]+),dc=example,dc=com$"
401         by dn.exact,expand="uid=$2,dc=example,dc=com" write
402 .fi
403 .LP
404 could be used; if it had to match the value in the 
405 .B <what>
406 clause, the form
407 .LP
408 .nf
409     access to dn.regex="^(.+,)?uid=([^,]+),dc=([^,]+),dc=com$"
410         by dn.exact,expand="uid=$2,dc=$3,dc=com" write
411 .fi
412 .LP
413 could be used.
414 .LP
415 Forms of the 
416 .B <what>
417 clause other than regex may provide submatches as well.
418 The 
419 .BR base(object) ,
420 the
421 .BR sub(tree) ,
422 the
423 .BR one(level) ,
424 and the
425 .BR children
426 forms provide
427 .B $0
428 as the match of the entire string.
429 The 
430 .BR sub(tree) ,
431 the
432 .BR one(level) ,
433 and the
434 .BR children
435 forms also provide
436 .B $1
437 as the match of the rightmost part of the DN as defined in the
438 .B <what>
439 clause.
440 This may be useful, for instance, to provide access to all the 
441 ancestors of a user by defining
442 .LP
443 .nf
444     access to dn.subtree="dc=com"
445         by dn.subtree,expand="$1" read
446 .fi
447 .LP
448 which means that only access to entries that appear in the DN of the
449 .B <by>
450 clause is allowed.
451 .LP
452 The 
453 .BR level{<n>}
454 form is an extension and a generalization of the
455 .BR onelevel
456 form, which matches all DNs whose <n>-th ancestor is the pattern.
457 So, \fIlevel{1}\fP is equivalent to \fIonelevel\fP, 
458 and \fIlevel{0}\fP is equivalent to \fIbase\fP.
459 .LP
460 It is perfectly useless to give any access privileges to a DN 
461 that exactly matches the
462 .B rootdn
463 of the database the ACLs apply to, because it implicitly
464 possesses write privileges for the entire tree of that database.
465 Actually, access control is bypassed for the
466 .BR rootdn ,
467 to solve the intrinsic chicken-and-egg problem.
468 .LP
469 The statement
470 .B dnattr=<attrname>
471 means that access is granted to requests whose DN is listed in the
472 entry being accessed under the 
473 .B <attrname>
474 attribute.
475 .LP
476 The statement
477 .B group=<group>
478 means that access is granted to requests whose DN is listed
479 in the group entry whose DN is given by
480 .BR <group> .
481 The optional parameters
482 .B <objectclass>
483 and
484 .B <attrname>
485 define the objectClass and the member attributeType of the group entry.
486 The defaults are
487 .B groupOfNames
488 and
489 .BR member ,
490 respectively.
491 The optional style qualifier
492 .B <style>
493 can be
494 .BR expand ,
495 which means that
496 .B <group>
497 will be expanded as a replacement string (but not as a regular expression)
498 according to
499 .BR regex (7)
500 and/or
501 .BR re_format (7),
502 and
503 .BR exact ,
504 which means that exact match will be used.
505 If the style of the DN portion of the
506 .B <what>
507 clause is regex, the submatches are made available according to
508 .BR regex (7)
509 and/or
510 .BR re_format (7);
511 other styles provide limited submatches as discussed above about 
512 the DN form of the 
513 .B <by>
514 clause.
515 .LP
516 For static groups, the specified attributeType must have
517 .B DistinguishedName
518 or
519 .B NameAndOptionalUID
520 syntax. For dynamic groups the attributeType must
521 be a subtype of the
522 .B labeledURI
523 attributeType. Only LDAP URIs of the form
524 .B ldap:///<base>??<scope>?<filter>
525 will be evaluated in a dynamic group, by searching the local server only.
526 .LP
527 The statements
528 .BR peername=<peername> ,
529 .BR sockname=<sockname> ,
530 .BR domain=<domain> ,
531 and
532 .BR sockurl=<sockurl>
533 mean that the contacting host IP (in the form 
534 .BR "IP=<ip>:<port>"
535 for IPv4, or
536 .BR "IP=[<ipv6>]:<port>"
537 for IPv6)
538 or the contacting host named pipe file name (in the form
539 .B "PATH=<path>"
540 if connecting through a named pipe) for
541 .BR peername ,
542 the named pipe file name for
543 .BR sockname ,
544 the contacting host name for
545 .BR domain ,
546 and the contacting URL for
547 .BR sockurl
548 are compared against
549 .B pattern
550 to determine access.
551 The same
552 .B style
553 rules for pattern match described for the
554 .B group
555 case apply, plus the
556 .B regex
557 style, which implies submatch
558 .B expand
559 and regex match of the corresponding connection parameters.
560 The
561 .B exact
562 style of the
563 .BR <peername>
564 clause (the default) implies a case-exact match on the client's
565 .BR IP , 
566 including the
567 .B "IP="
568 prefix and the trailing
569 .BR ":<port>" , 
570 or the client's 
571 .BR path ,
572 including the
573 .B "PATH="
574 prefix if connecting through a named pipe.
575 The special
576 .B ip
577 style interprets the pattern as 
578 .BR <peername>=<ip>[%<mask>][{<n>}] ,
579 where
580 .B <ip>
581 and 
582 .B <mask>
583 are dotted digit representations of the IP and the mask, while
584 .BR <n> ,
585 delimited by curly brackets, is an optional port.
586 The same applies to IPv6 addresses when the special
587 .B ipv6
588 style is used.
589 When checking access privileges, the IP portion of the
590 .BR peername 
591 is extracted, eliminating the
592 .B "IP="
593 prefix and the
594 .B ":<port>"
595 part, and it is compared against the
596 .B <ip>
597 portion of the pattern after masking with
598 .BR <mask> :
599 \fI((peername & <mask>) == <ip>)\fP.
600 As an example, 
601 .B peername.ip=127.0.0.1
602 and
603 .B peername.ipv6=::1
604 allow connections only from localhost,
605 .B peername.ip=192.168.1.0%255.255.255.0 
606 allows connections from any IP in the 192.168.1 class C domain, and
607 .B peername.ip=192.168.1.16%255.255.255.240{9009}
608 allows connections from any IP in the 192.168.1.[16-31] range 
609 of the same domain, only if port 9009 is used.
610 The special 
611 .B path
612 style eliminates the 
613 .B "PATH="
614 prefix from the 
615 .B peername
616 when connecting through a named pipe, and performs an exact match 
617 on the given pattern.
618 The
619 .BR <domain>
620 clause also allows the
621 .B subtree
622 style, which succeeds when a fully qualified name exactly matches the
623 .BR domain
624 pattern, or its trailing part, after a 
625 .BR dot ,
626 exactly matches the 
627 .BR domain
628 pattern.
629 The 
630 .B expand
631 style is allowed, implying an
632 .B exact 
633 match with submatch expansion; the use of 
634 .B expand 
635 as a style modifier is considered more appropriate.
636 As an example,
637 .B domain.subtree=example.com
638 will match www.example.com, but will not match www.anotherexample.com.
639 The
640 .B domain
641 of the contacting host is determined by performing a DNS reverse lookup.
642 As this lookup can easily be spoofed, use of the
643 .B domain
644 statement is strongly discouraged.  By default, reverse lookups are disabled.
645 The optional
646 .B domainstyle
647 qualifier of the
648 .B <domain>
649 clause allows a
650 .B modifier
651 option; the only value currently supported is
652 .BR expand ,
653 which causes substring substitution of submatches to take place even if
654 the 
655 .B domainstyle
656 is not 
657 .BR regex ,
658 much like the analogous usage in 
659 .B <dn>
660 clause.
661 .LP
662 The statement
663 .B set=<pattern>
664 is undocumented yet.
665 .LP
666 The statement
667 .B dynacl/<name>[/<options>][.<dynstyle>][=<pattern>]
668 means that access checking is delegated to the admin-defined method
669 indicated by
670 .BR <name> ,
671 which can be registered at run-time by means of the
672 .B moduleload
673 statement.
674 The fields
675 .BR <options> ,
676 .B <dynstyle>
677 and
678 .B <pattern>
679 are optional, and are directly passed to the registered parsing routine.
680 Dynacl is experimental; it must be enabled at compile time.
681 .LP
682 The statement
683 .B dynacl/aci[=<attrname>]
684 means that the access control is determined by the values in the
685 .B attrname
686 of the entry itself.
687 The optional
688 .B <attrname>
689 indicates what attributeType holds the ACI information in the entry.
690 By default, the 
691 .B OpenLDAPaci
692 operational attribute is used.
693 ACIs are experimental; they must be enabled at compile time.
694 .LP
695 The statements
696 .BR ssf=<n> ,
697 .BR transport_ssf=<n> ,
698 .BR tls_ssf=<n> ,
699 and
700 .BR sasl_ssf=<n>
701 set the minimum required Security Strength Factor (ssf) needed
702 to grant access.  The value should be positive integer.
703 .SH THE <ACCESS> FIELD
704 The optional field
705 .B <access> ::= [[real]self]{<level>|<priv>}
706 determines the access level or the specific access privileges the
707 .B who 
708 field will have.
709 Its component are defined as
710 .LP
711 .nf
712         <level> ::= none|disclose|auth|compare|search|read|{write|add|delete}|manage
713         <priv> ::= {=|+|-}{0|d|x|c|s|r|{w|a|z}|m}+
714 .fi
715 .LP
716 The modifier
717 .B self
718 allows special operations like having a certain access level or privilege
719 only in case the operation involves the name of the user that's requesting
720 the access.
721 It implies the user that requests access is authorized.
722 The modifier
723 .B realself
724 refers to the authenticated DN as opposed to the authorized DN of the
725 .B self
726 modifier.
727 An example is the
728 .B selfwrite
729 access to the member attribute of a group, which allows one to add/delete
730 its own DN from the member list of a group, without affecting other members.
731 .LP
732 The 
733 .B level 
734 access model relies on an incremental interpretation of the access
735 privileges.
736 The possible levels are
737 .BR none ,
738 .BR disclose ,
739 .BR auth ,
740 .BR compare ,
741 .BR search ,
742 .BR read ,
743 .BR write ,
744 and
745 .BR manage .
746 Each access level implies all the preceding ones, thus 
747 .B manage
748 grants all access including administrative access.
749 The 
750 .BR write
751 access is actually the combination of
752 .BR add
753 and
754 .BR delete ,
755 which respectively restrict the write privilege to add or delete
756 the specified
757 .BR <what> .
758
759 .LP
760 The
761 .B none 
762 access level disallows all access including disclosure on error.
763 .LP
764 The
765 .B disclose
766 access level allows disclosure of information on error.
767 .LP
768 The 
769 .B auth
770 access level means that one is allowed access to an attribute to perform
771 authentication/authorization operations (e.g.
772 .BR bind )
773 with no other access.
774 This is useful to grant unauthenticated clients the least possible 
775 access level to critical resources, like passwords.
776 .LP
777 The
778 .B priv
779 access model relies on the explicit setting of access privileges
780 for each clause.
781 The
782 .B =
783 sign resets previously defined accesses; as a consequence, the final 
784 access privileges will be only those defined by the clause.
785 The 
786 .B +
787 and
788 .B -
789 signs add/remove access privileges to the existing ones.
790 The privileges are
791 .B m
792 for manage,
793 .B w
794 for write,
795 .B a
796 for add,
797 .B z
798 for delete,
799 .B r
800 for read,
801 .B s 
802 for search,
803 .B c 
804 for compare,
805 .B x
806 for authentication, and
807 .B d
808 for disclose.
809 More than one of the above privileges can be added in one statement.
810 .B 0
811 indicates no privileges and is used only by itself (e.g., +0).
812 Note that
813 .B +az
814 is equivalent to
815 .BR +w .
816 .LP
817 If no access is given, it defaults to 
818 .BR +0 .
819 .SH THE <CONTROL> FIELD
820 The optional field
821 .B <control>
822 controls the flow of access rule application.
823 It can have the forms
824 .LP
825 .nf
826         stop
827         continue
828         break
829 .fi
830 .LP
831 where
832 .BR stop ,
833 the default, means access checking stops in case of match.
834 The other two forms are used to keep on processing access clauses.
835 In detail, the
836 .B continue
837 form allows for other 
838 .B <who>
839 clauses in the same 
840 .B <access>
841 clause to be considered, so that they may result in incrementally altering
842 the privileges, while the
843 .B break
844 form allows for other
845 .B <access>
846 clauses that match the same target to be processed.
847 Consider the (silly) example
848 .LP
849 .nf
850         access to dn.subtree="dc=example,dc=com" attrs=cn
851                 by * =cs break
852
853         access to dn.subtree="ou=People,dc=example,dc=com"
854                 by * +r
855 .fi
856 .LP
857 which allows search and compare privileges to everybody under
858 the "dc=example,dc=com" tree, with the second rule allowing
859 also read in the "ou=People" subtree,
860 or the (even more silly) example
861 .LP
862 .nf
863         access to dn.subtree="dc=example,dc=com" attrs=cn
864                 by * =cs continue
865                 by users +r
866 .fi
867 .LP
868 which grants everybody search and compare privileges, and adds read
869 privileges to authenticated clients.
870 .LP
871 One useful application is to easily grant write privileges to an
872 .B updatedn
873 that is different from the
874 .BR rootdn .
875 In this case, since the
876 .B updatedn
877 needs write access to (almost) all data, one can use
878 .LP
879 .nf
880         access to *
881                 by dn.exact="cn=The Update DN,dc=example,dc=com" write
882                 by * break
883 .fi
884 .LP
885 as the first access rule.
886 As a consequence, unless the operation is performed with the 
887 .B updatedn
888 identity, control is passed straight to the subsequent rules.
889
890 .SH OPERATION REQUIREMENTS
891 Operations require different privileges on different portions of entries.
892 The following summary applies to primary database backends such as
893 the BDB and HDB backends.   Requirements for other backends may
894 (and often do) differ.
895
896 .LP
897 The
898 .B add
899 operation requires
900 .B add (=a)
901 privileges on the pseudo-attribute 
902 .B entry
903 of the entry being added, and 
904 .B add (=a)
905 privileges on the pseudo-attribute
906 .B children
907 of the entry's parent.
908 When adding the suffix entry of a database,
909 .B add
910 access to
911 .B children
912 of the empty DN ("") is required.
913
914 .LP
915 The 
916 .B bind
917 operation, when credentials are stored in the directory, requires 
918 .B auth (=x)
919 privileges on the attribute the credentials are stored in (usually
920 .BR userPassword ).
921
922 .LP
923 The
924 .B compare
925 operation requires 
926 .B compare (=c)
927 privileges on the attribute that is being compared.
928
929 .LP
930 The
931 .B delete
932 operation requires
933 .B delete (=z)
934 privileges on the pseudo-attribute
935 .B entry 
936 of the entry being deleted, and
937 .B delete (=d)
938 privileges on the
939 .B children
940 pseudo-attribute of the entry's parent.
941
942 .LP
943 The
944 .B modify
945 operation requires 
946 .B write (=w)
947 privileges on the attributes being modified.
948 In detail, 
949 .B add (=a)
950 is required to add new values,
951 .B delete (=z)
952 is required to delete existing values,
953 and both
954 .B delete
955 and
956 .BR "add (=az)" ,
957 or
958 .BR "write (=w)" ,
959 are required to replace existing values.
960
961 .LP
962 The
963 .B modrdn
964 operation requires
965 .B write (=w)
966 privileges on the pseudo-attribute
967 .B entry
968 of the entry whose relative DN is being modified,
969 .B delete (=z)
970 privileges on the pseudo-attribute
971 .B children
972 of the old entry's parents,
973 .B add (=a)
974 privileges on the pseudo-attribute
975 .B children
976 of the new entry's parents, and
977 .B add (=a)
978 privileges on the attributes that are present in the new relative DN.
979 .B Delete (=z)
980 privileges are also required on the attributes that are present 
981 in the old relative DN if 
982 .B deleteoldrdn
983 is set to 1.
984
985 .LP
986 The
987 .B search
988 operation, requires 
989 .B search (=s)
990 privileges on the 
991 .B entry
992 pseudo-attribute of the searchBase
993 (NOTE: this was introduced with OpenLDAP 2.4).
994 Then, for each entry, it requires
995 .B search (=s)
996 privileges on the attributes that are defined in the filter.
997 The resulting entries are finally tested for 
998 .B read (=r)
999 privileges on the pseudo-attribute
1000 .B entry
1001 (for read access to the entry itself)
1002 and for
1003 .B read (=r)
1004 access on each value of each attribute that is requested.
1005 Also, for each
1006 .B referral
1007 object used in generating continuation references, the operation requires
1008 .B read (=r)
1009 access on the pseudo-attribute
1010 .B entry
1011 (for read access to the referral object itself),
1012 as well as
1013 .B read (=r)
1014 access to the attribute holding the referral information
1015 (generally the
1016 .B ref
1017 attribute).
1018
1019 .LP
1020 Some internal operations and some
1021 .B controls
1022 require specific access privileges.
1023 The
1024 .B authzID
1025 mapping and the 
1026 .B proxyAuthz
1027 control require
1028 .B auth (=x)
1029 privileges on all the attributes that are present in the search filter
1030 of the URI regexp maps (the right-hand side of the
1031 .B authz-regexp
1032 directives).
1033 .B Auth (=x)
1034 privileges are also required on the
1035 .B authzTo
1036 attribute of the authorizing identity and/or on the 
1037 .B authzFrom
1038 attribute of the authorized identity.
1039 In general, when an internal lookup is performed for authentication
1040 or authorization purposes, search-specific privileges (see the access
1041 requirements for the search operation illustrated above) are relaxed to
1042 .BR auth .
1043
1044 .LP
1045 Access control to search entries is checked by the frontend,
1046 so it is fully honored by all backends; for all other operations
1047 and for the discovery phase of the search operation,
1048 full ACL semantics is only supported by the primary backends, i.e.
1049 .BR back-bdb (5),
1050 and
1051 .BR back-hdb (5).
1052
1053 Some other backend, like
1054 .BR back-sql (5),
1055 may fully support them; others may only support a portion of the 
1056 described semantics, or even differ in some aspects.
1057 The relevant details are described in the backend-specific man pages.
1058
1059 .SH CAVEATS
1060 It is strongly recommended to explicitly use the most appropriate
1061 .B <dnstyle>
1062 in
1063 .B <what>
1064 and
1065 .B <who>
1066 clauses, to avoid possible incorrect specifications of the access rules 
1067 as well as for performance (avoid unnecessary regex matching when an exact
1068 match suffices) reasons.
1069 .LP
1070 An administrator might create a rule of the form:
1071 .LP
1072 .nf
1073         access to dn.regex="dc=example,dc=com"
1074                 by ...
1075 .fi
1076 .LP
1077 expecting it to match all entries in the subtree "dc=example,dc=com".
1078 However, this rule actually matches any DN which contains anywhere
1079 the substring "dc=example,dc=com".  That is, the rule matches both
1080 "uid=joe,dc=example,dc=com" and "dc=example,dc=com,uid=joe".
1081 .LP
1082 To match the desired subtree, the rule would be more precisely
1083 written:
1084 .LP
1085 .nf
1086         access to dn.regex="^(.+,)?dc=example,dc=com$"
1087                 by ...
1088 .fi
1089 .LP
1090 For performance reasons, it would be better to use the subtree style.
1091 .LP
1092 .nf
1093         access to dn.subtree="dc=example,dc=com"
1094                 by ...
1095 .fi
1096 .LP
1097 When writing submatch rules, it may be convenient to avoid unnecessary
1098 .B regex
1099 .B <dnstyle>
1100 use; for instance, to allow access to the subtree of the user 
1101 that matches the
1102 .B <what>
1103 clause, one could use
1104 .LP
1105 .nf
1106         access to dn.regex="^(.+,)?uid=([^,]+),dc=example,dc=com$"
1107                 by dn.regex="^uid=$2,dc=example,dc=com$$" write
1108                 by ...
1109 .fi
1110 .LP
1111 However, since all that is required in the 
1112 .B <by>
1113 clause is substring expansion, a more efficient solution is
1114 .LP
1115 .nf
1116         access to dn.regex="^(.+,)?uid=([^,]+),dc=example,dc=com$"
1117                 by dn.exact,expand="uid=$2,dc=example,dc=com" write
1118                 by ...
1119 .fi
1120 .LP
1121 In fact, while a
1122 .B <dnstyle>
1123 of
1124 .B regex
1125 implies substring expansion, 
1126 .BR exact ,
1127 as well as all the other DN specific
1128 .B <dnstyle>
1129 values, does not, so it must be explicitly requested.
1130 .LP
1131 .SH FILES
1132 .TP
1133 ETCDIR/slapd.conf
1134 default slapd configuration file
1135 .SH SEE ALSO
1136 .BR slapd (8),
1137 .BR slapd-* (5),
1138 .BR slapacl (8),
1139 .BR regex (7),
1140 .BR re_format (7)
1141 .LP
1142 "OpenLDAP Administrator's Guide" (http://www.OpenLDAP.org/doc/admin/)
1143 .SH ACKNOWLEDGEMENTS
1144 .so ../Project