]> git.sur5r.net Git - openldap/blobdiff - doc/man/man5/slapd.access.5
clarify the use of regex and expand in by dn clauses
[openldap] / doc / man / man5 / slapd.access.5
index 168780aa03cc584eb6a958d53382c374a9388393..763e449edf8e296800d99915b4d62b616403e40f 100644 (file)
@@ -13,10 +13,14 @@ file contains configuration information for the
 daemon. This configuration file is also used by the
 .BR slurpd (8)
 replication daemon and by the SLAPD tools
+.BR slapacl (8),
 .BR slapadd (8),
+.BR slapauth (8),
 .BR slapcat (8),
+.BR slapdn (8),
+.BR slapindex (8),
 and
-.BR slapindex (8).
+.BR slaptest (8).
 .LP
 The
 .B slapd.conf
@@ -184,12 +188,12 @@ It can have the forms
        dn[.<dnstyle>[,<modifier>]]=<DN>
        dnattr=<attrname>
        group[/<objectclass>[/<attrname>]]
-               [.<style>]=<group>
+               [.<groupstyle>]=<group>
        peername[.<peernamestyle>]=<peername>
        sockname[.<style>]=<sockname>
        domain[.<domainstyle>[,<modifier>]]=<domain>
        sockurl[.<style>]=<sockurl>
-       set[.<style>]=<pattern>
+       set[.<setstyle>]=<pattern>
 
        ssf=<n>
        transport_ssf=<n>
@@ -203,9 +207,11 @@ with
 .LP
 .nf
        <dnstyle>={{exact|base}|regex|sub(tree)|one(level)|children}
-       <style>={exact|regex}
-       <peernamestyle>={exact|regex|ip|path}
+       <groupstyle>={exact|expand}
+       <style>={exact|regex|expand}
+       <peernamestyle>={<style>|ip|path}
        <domainstyle>={exact|regex|sub(tree)}
+       <setstyle>={exact|regex}
        <modifier>={expand}
 .fi
 .LP
@@ -250,6 +256,15 @@ dn.regex clause by using the form
 with 
 .B digit
 ranging from 1 to 9.
+Since the dollar character is used to indicate a substring replacement,
+the dollar character that is used to indicate match up to the end of
+the string must be escaped by a second dollar character, e.g.
+.LP
+.nf
+    access to dn.regex="^(.+,)?uid=([^,]+),dc=[^,]+,dc=com$"
+        by dn.regex="^uid=$2,dc=[^,]+,dc=com$$" write
+.fi
+.LP
 The style qualifier
 allows an optional
 .BR modifier .
@@ -260,11 +275,39 @@ even if
 .B dnstyle
 is not 
 .BR regex .
+Note that the 
+.I regex 
+dnstyle in the above example may be of use only if the 
+.B by
+clause needs to be a regex; otherwise, if the
+value of the second (from the right)
+.I dc=
+portion of the DN in the above example were fixed, the form
+.LP
+.nf
+    access to dn.regex="^(.+,)?uid=([^,]+),dc=example,dc=com$"
+        by dn.exact,expand="uid=$2,dc=example,dc=com" write
+.fi
+.LP
+could be used; if it had to match the value in the 
+.B what
+clause, the form
+.LP
+.nf
+    access to dn.regex="^(.+,)?uid=([^,]+),dc=([^,]+),dc=com$"
+        by dn.exact,expand="uid=$2,dc=$3,dc=com" write
+.fi
+.LP
+could be used.
+.LP
 It is perfectly useless to give any access privileges to a DN 
 that exactly matches the
 .B rootdn
 of the database the ACLs apply to, because it implicitly
 possesses write privileges for the entire tree of that database.
+Actually, access control is bypassed for the
+.BR rootdn ,
+to solve the intrinsic chicken-and-egg problem.
 .LP
 The statement
 .B dnattr=<attrname>
@@ -286,16 +329,12 @@ define the objectClass and the member attributeType of the group entry.
 The optional style qualifier
 .B <style>
 can be
-.BR regex ,
+.BR expand ,
 which means that
 .B <group>
 will be expanded as a replacement string (but not as a regular expression)
 according to regex (7), and
-.B base
-or
-.B exact
-(an alias of
-.BR base ),
+.BR exact ,
 which means that exact match will be used.
 .LP
 For static groups, the specified attributeType must have
@@ -307,7 +346,7 @@ be a subtype of the
 .B labeledURI
 attributeType. Only LDAP URIs of the form
 .B ldap:///<base>??<scope>?<filter>
-will be evaluated in a dynamic group.
+will be evaluated in a dynamic group, by searching the local server only.
 .LP
 The statements
 .BR peername=<peername> ,
@@ -334,7 +373,13 @@ The same
 .B style
 rules for pattern match described for the
 .B group
-case apply. 
+case apply, plus the
+.B regex
+style, which implies submatch
+.B expand
+and
+.BR regex (7)
+match of the corresponding connection parameters.
 The
 .B exact
 style of the
@@ -398,6 +443,13 @@ pattern, or its trailing part, after a
 exactly matches the 
 .BR domain
 pattern.
+The 
+.B expand
+style is allowed, implying an
+.B exact 
+match with submatch expansion; the use of 
+.B expand 
+as a style modifier is considered more appropriate.
 As an example,
 .B domain.subtree=example.com
 will match www.example.com, but will not match www.anotherexample.com.
@@ -665,29 +717,34 @@ access to the attribute holding the referral information
 .B ref
 attribute).
 .LP
-Some
+Some internal operations and some
 .B controls
 require specific access privileges.
 The
+.B authzID
+mapping and the 
 .B proxyAuthz
-control requires
+control require
 .B auth (=x)
 privileges on all the attributes that are present in the search filter
 of the URI regexp maps (the right-hand side of the
-.B sasl-regexp
+.B authz-regexp
 directives).
-It also requires
-.B auth (=x)
-privileges on the
-.B saslAuthzTo
+.B Auth (=x)
+privileges are also required on the
+.B authzTo
 attribute of the authorizing identity and/or on the 
-.B saslAuthzFrom
+.B authzFrom
 attribute of the authorized identity.
 .SH CAVEATS
 It is strongly recommended to explicitly use the most appropriate
-.BR <dnstyle> ,
-to avoid possible incorrect specifications of the access rules as well
-as for performance (avoid unrequired regex matching when an exact
+.B <dnstyle>
+in
+.B <what>
+and
+.B <who>
+clauses, to avoid possible incorrect specifications of the access rules 
+as well as for performance (avoid unrequired regex matching when an exact
 match suffices) reasons.
 .LP
 An administrator might create a rule of the form:
@@ -706,7 +763,7 @@ To match the desired subtree, the rule would be more precisely
 written:
 .LP
 .nf
-       access to dn.regex="^(.+,)?dc=example,dc=com$$"
+       access to dn.regex="^(.+,)?dc=example,dc=com$"
                by ...
 .fi
 .LP
@@ -726,17 +783,17 @@ that matches the
 clause, one could use
 .LP
 .nf
-       access to dn.regex="^(.+,)?uid=([^,]+),dc=example,dc=com$$"
+       access to dn.regex="^(.+,)?uid=([^,]+),dc=example,dc=com$"
                by dn.regex="^uid=$1,dc=example,dc=com$$" write
                by ...
 .fi
 .LP
 However, since all that is required in the 
-.B to
+.B by
 clause is substring expansion, a more efficient solution is
 .LP
 .nf
-       access to dn.regex="^(.+,)?uid=([^,]+),dc=example,dc=com$$"
+       access to dn.regex="^(.+,)?uid=([^,]+),dc=example,dc=com$"
                by dn.exact,expand="uid=$1,dc=example,dc=com" write
                by ...
 .fi
@@ -757,6 +814,7 @@ ETCDIR/slapd.conf
 default slapd configuration file
 .SH SEE ALSO
 .BR slapd (8),
+.BR slapacl (8),
 .LP
 "OpenLDAP Administrator's Guide" (http://www.OpenLDAP.org/doc/admin/)
 .SH ACKNOWLEDGEMENTS