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