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