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