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