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