]> git.sur5r.net Git - openldap/blob - doc/man/man5/slapd.access.5
Document partially implemented "disclose" level.
[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|disclose|auth|compare|search|read|write
607         <priv> ::= {=|+|-}{w|r|s|c|x|d|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 disclose ,
628 .BR auth ,
629 .BR compare ,
630 .BR search ,
631 .BR read ,
632 and
633 .BR write .
634 Each access level implies all the preceding ones, thus 
635 .B write
636 access will imply all accesses.
637 .LP
638 The
639 .B none 
640 access level disallows all access including disclosure on error.
641 .LP
642 The
643 .B disclose
644 access level allows disclorure of information on error.
645 .LP
646 The 
647 .B auth
648 access level 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,
677 .B x
678 for authentication, and
679 .B d
680 for disclose.
681 More than one of the above privileges can be added in one statement.
682 .B 0
683 indicates no privileges and is used only by itself (e.g., +0).
684 If no access is given, it defaults to 
685 .BR +0 .
686 .SH THE <CONTROL> FIELD
687 The optional field
688 .B <control>
689 controls the flow of access rule application.
690 It can have the forms
691 .LP
692 .nf
693         stop
694         continue
695         break
696 .fi
697 .LP
698 where
699 .BR stop ,
700 the default, means access checking stops in case of match.
701 The other two forms are used to keep on processing access clauses.
702 In detail, the
703 .B continue
704 form allows for other 
705 .B <who>
706 clauses in the same 
707 .B <access>
708 clause to be considered, so that they may result in incrementally altering
709 the privileges, while the
710 .B break
711 form allows for other
712 .B <access>
713 clauses that match the same target to be processed.
714 Consider the (silly) example
715 .LP
716 .nf
717         access to dn.subtree="dc=example,dc=com" attrs=cn
718                 by * =cs break
719
720         access to dn.subtree="ou=People,dc=example,dc=com"
721                 by * +r
722 .fi
723 .LP
724 which allows search and compare privileges to everybody under
725 the "dc=example,dc=com" tree, with the second rule allowing
726 also read in the "ou=People" subtree,
727 or the (even more silly) example
728 .LP
729 .nf
730         access to dn.subtree="dc=example,dc=com" attrs=cn
731                 by * =cs continue
732                 by users +r
733 .fi
734 .LP
735 which grants everybody search and compare privileges, and adds read
736 privileges to authenticated clients.
737 .SH OPERATION REQUIREMENTS
738 Operations require different privileges on different portions of entries.
739 The following summary applies to primary database backends such as
740 the LDBM, BDB, and HDB backends.   Requirements for other backends may
741 (and often do) differ.
742 .LP
743 The
744 .B add
745 operation requires
746 .B write (=w)
747 privileges on the pseudo-attribute 
748 .B entry
749 of the entry being added, and 
750 .B write (=w)
751 privileges on the pseudo-attribute
752 .B children
753 of the entry's parent.
754 .LP
755 The 
756 .B bind
757 operation, when credentials are stored in the directory, requires 
758 .B auth (=x)
759 privileges on the attribute the credentials are stored in (usually
760 .BR userPassword ).
761 .LP
762 The
763 .B compare
764 operation requires 
765 .B compare (=c)
766 privileges on the attribute that is being compared.
767 .LP
768 The
769 .B delete
770 operation requires
771 .B write (=w)
772 privileges on the pseudo-attribute
773 .B entry 
774 of the entry being deleted, and
775 .B write (=w)
776 privileges on the
777 .B children
778 pseudo-attribute of the entry's parent.
779 .LP
780 The
781 .B modify
782 operation requires 
783 .B write (=w)
784 privileges on the attibutes being modified.
785 .LP
786 The
787 .B modrdn
788 operation requires
789 .B write (=w)
790 privileges on the pseudo-attribute
791 .B entry
792 of the entry whose relative DN is being modified,
793 .B write (=w)
794 privileges on the pseudo-attribute
795 .B children
796 of the old and new entry's parents, and
797 .B write (=w)
798 privileges on the attributes that are present in the new relative DN.
799 .B Write (=w)
800 privileges are also required on the attributes that are present 
801 in the old relative DN if 
802 .B deleteoldrdn
803 is set to 1.
804 .LP
805 The
806 .B search
807 operation, for each entry, requires
808 .B search (=s)
809 privileges on the attributes that are defined in the filter.
810 Then, the resulting entries are tested for 
811 .B read (=r)
812 privileges on the pseudo-attribute
813 .B entry
814 (for read access to the entry itself)
815 and for
816 .B read (=r)
817 access on each value of each attribute that is requested.
818 Also, for each
819 .B referral
820 object used in generating continuation references, the operation requires
821 .B read (=r)
822 access on the pseudo-attribute
823 .B entry
824 (for read access to the referral object itself),
825 as well as
826 .B read (=r)
827 access to the attribute holding the referral information
828 (generally the
829 .B ref
830 attribute).
831 .LP
832 Some internal operations and some
833 .B controls
834 require specific access privileges.
835 The
836 .B authzID
837 mapping and the 
838 .B proxyAuthz
839 control require
840 .B auth (=x)
841 privileges on all the attributes that are present in the search filter
842 of the URI regexp maps (the right-hand side of the
843 .B authz-regexp
844 directives).
845 .B Auth (=x)
846 privileges are also required on the
847 .B authzTo
848 attribute of the authorizing identity and/or on the 
849 .B authzFrom
850 attribute of the authorized identity.
851 .SH CAVEATS
852 It is strongly recommended to explicitly use the most appropriate
853 .B <dnstyle>
854 in
855 .B <what>
856 and
857 .B <who>
858 clauses, to avoid possible incorrect specifications of the access rules 
859 as well as for performance (avoid unrequired regex matching when an exact
860 match suffices) reasons.
861 .LP
862 An administrator might create a rule of the form:
863 .LP
864 .nf
865         access to dn.regex="dc=example,dc=com"
866                 by ...
867 .fi
868 .LP
869 expecting it to match all entries in the subtree "dc=example,dc=com".
870 However, this rule actually matches any DN which contains anywhere
871 the substring "dc=example,dc=com".  That is, the rule matches both
872 "uid=joe,dc=example,dc=com" and "dc=example,dc=com,uid=joe".
873 .LP
874 To match the desired subtree, the rule would be more precisely
875 written:
876 .LP
877 .nf
878         access to dn.regex="^(.+,)?dc=example,dc=com$"
879                 by ...
880 .fi
881 .LP
882 For performance reasons, it would be better to use the subtree style.
883 .LP
884 .nf
885         access to dn.subtree="dc=example,dc=com"
886                 by ...
887 .fi
888 .LP
889 When writing submatch rules, it may be convenient to avoid unnecessary
890 .B regex
891 .B <dnstyle>
892 use; for instance, to allow access to the subtree of the user 
893 that matches the
894 .B <what>
895 clause, one could use
896 .LP
897 .nf
898         access to dn.regex="^(.+,)?uid=([^,]+),dc=example,dc=com$"
899                 by dn.regex="^uid=$2,dc=example,dc=com$$" write
900                 by ...
901 .fi
902 .LP
903 However, since all that is required in the 
904 .B <by>
905 clause is substring expansion, a more efficient solution is
906 .LP
907 .nf
908         access to dn.regex="^(.+,)?uid=([^,]+),dc=example,dc=com$"
909                 by dn.exact,expand="uid=$2,dc=example,dc=com" write
910                 by ...
911 .fi
912 .LP
913 In fact, while a
914 .B <dnstyle>
915 of
916 .B regex
917 implies substring expansion, 
918 .BR exact ,
919 as well as all the other DN specific
920 .B <dnstyle>
921 values, does not, so it must be explicitly requested.
922 .LP
923 .SH FILES
924 .TP
925 ETCDIR/slapd.conf
926 default slapd configuration file
927 .SH SEE ALSO
928 .BR slapd (8),
929 .BR slapacl (8),
930 .BR regex (7),
931 .BR re_format (7)
932 .LP
933 "OpenLDAP Administrator's Guide" (http://www.OpenLDAP.org/doc/admin/)
934 .SH ACKNOWLEDGEMENTS
935 .B OpenLDAP
936 is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
937 .B OpenLDAP
938 is derived from University of Michigan LDAP 3.3 Release.