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