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