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