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