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