]> git.sur5r.net Git - openldap/blobdiff - doc/guide/admin/access-control.sdf
Happy New Year!
[openldap] / doc / guide / admin / access-control.sdf
index 0dededeecb67eccf14f4617e212c6dab22baa9a7..e661aa1e0962ae528676b291aa94ae3be1a7243c 100644 (file)
@@ -1,5 +1,5 @@
 # $OpenLDAP$
-# Copyright 1999-2009 The OpenLDAP Foundation, All Rights Reserved.
+# Copyright 1999-2012 The OpenLDAP Foundation, All Rights Reserved.
 # COPYING RESTRICTIONS APPLY, see COPYRIGHT.
 
 H1: Access Control
@@ -25,8 +25,9 @@ rights (i.e. auth, search, compare, read and write) on everything and anything.
 As a consequence, it's useless (and results in a performance penalty) to explicitly 
 list the {{rootdn}} among the {{<by>}} clauses.
 
-The following sections will describe Access Control Lists in more details and 
-follow with some examples and recommendations. 
+The following sections will describe Access Control Lists in greater depth and 
+follow with some examples and recommendations. See {{slapd.access}}(5) for
+complete details.
 
 H2: Access Control via Static Configuration
 
@@ -218,8 +219,15 @@ When evaluating whether some requester should be given access to
 an entry and/or attribute, slapd compares the entry and/or attribute
 to the {{EX:<what>}} selectors given in the configuration file.
 For each entry, access controls provided in the database which holds
-the entry (or the first database if not held in any database) apply
-first, followed by the global access directives.  Within this
+the entry (or the global access directives if not held in any database) apply
+first, followed by the global access directives. However, when dealing with 
+an access list, because the global access list is effectively appended 
+to each per-database list, if the resulting list is non-empty then the 
+access list will end with an implicit {{EX:access to * by * none}} directive. 
+If there are no access directives applicable to a backend, then a default 
+read is used.
+
+Within this
 priority, access directives are examined in the order in which they
 appear in the config file.  Slapd stops with the first {{EX:<what>}}
 selector that matches the entry and/or attribute. The corresponding
@@ -304,9 +312,12 @@ are also under {{EX:dc=com}} entries.
 
 Also note that if no {{EX:access to}} directive matches or no {{EX:by
 <who>}} clause, {{B:access is denied}}.  That is, every {{EX:access
-to}} directive ends with an implicit {{EX:by * none}} clause and
-every access list ends with an implicit {{EX:access to * by * none}}
-directive.
+to}} directive ends with an implicit {{EX:by * none}} clause. When dealing
+with an access list, because the global access list is effectively appended 
+to each per-database list, if the resulting list is non-empty then the access 
+list will end with an implicit {{EX:access to * by * none}} directive. If
+there are no access directives applicable to a backend, then a default read is
+used.
 
 The next example again shows the importance of ordering, both of
 the access directives and the {{EX:by <who>}} clauses.  It also
@@ -355,95 +366,6 @@ consult the {{Advanced Access Control}} chapter.
 !endif
 
 
-H3: Configuration File Example
-
-The following is an example configuration file, interspersed
-with explanatory text. It defines two databases to handle
-different parts of the {{TERM:X.500}} tree; both are {{TERM:BDB}}
-database instances. The line numbers shown are provided for
-reference only and are not included in the actual file. First, the
-global configuration section:
-
-E:  1.    # example config file - global configuration section
-E:  2.    include /usr/local/etc/schema/core.schema
-E:  3.    referral ldap://root.openldap.org
-E:  4.    access to * by * read
-Line 1 is a comment. Line 2 includes another config file
-which contains {{core}} schema definitions.
-The {{EX:referral}} directive on line 3
-means that queries not local to one of the databases defined
-below will be referred to the LDAP server running on the
-standard port (389) at the host {{EX:root.openldap.org}}.
-
-Line 4 is a global access control.  It applies to all
-entries (after any applicable database-specific access
-controls).
-
-The next section of the configuration file defines a BDB
-backend that will handle queries for things in the
-"dc=example,dc=com" portion of the tree. The
-database is to be replicated to two slave slapds, one on
-truelies, the other on judgmentday. Indices are to be
-maintained for several attributes, and the {{EX:userPassword}}
-attribute is to be protected from unauthorized access.
-
-E:  5.    # BDB definition for the example.com
-E:  6.    database bdb
-E:  7.    suffix "dc=example,dc=com"
-E:  8.    directory /usr/local/var/openldap-data
-E:  9.    rootdn "cn=Manager,dc=example,dc=com"
-E: 10.    rootpw secret
-E: 11.    # indexed attribute definitions
-E: 12.    index uid pres,eq
-E: 13.    index cn,sn,uid pres,eq,approx,sub
-E: 14.    index objectClass eq
-E: 15.    # database access control definitions
-E: 16.    access to attrs=userPassword
-E: 17.        by self write
-E: 18.        by anonymous auth
-E: 19.        by dn.base="cn=Admin,dc=example,dc=com" write
-E: 20.        by * none
-E: 21.    access to *
-E: 22.        by self write
-E: 23.        by dn.base="cn=Admin,dc=example,dc=com" write
-E: 24.        by * read
-
-Line 5 is a comment. The start of the database definition is marked
-by the database keyword on line 6. Line 7 specifies the DN suffix
-for queries to pass to this database. Line 8 specifies the directory
-in which the database files will live.
-
-Lines 9 and 10 identify the database {{super-user}} entry and associated
-password. This entry is not subject to access control or size or
-time limit restrictions.
-
-Lines 12 through 14 indicate the indices to maintain for various
-attributes.
-
-Lines 16 through 24 specify access control for entries in this
-database.  As this is the first database, the controls also apply
-to entries not held in any database (such as the Root DSE).  For
-all applicable entries, the {{EX:userPassword}} attribute is writable
-by the entry itself and by the "admin" entry.  It may be used for
-authentication/authorization purposes, but is otherwise not readable.
-All other attributes are writable by the entry and the "admin"
-entry, but may be read by all users (authenticated or not).
-
-The next section of the example configuration file defines another
-BDB database. This one handles queries involving the
-{{EX:dc=example,dc=net}} subtree but is managed by the same entity
-as the first database.  Note that without line 39, the read access
-would be allowed due to the global access rule at line 4.
-
-E: 33.    # BDB definition for example.net
-E: 34.    database bdb
-E: 35.    suffix "dc=example,dc=net"
-E: 36.    directory /usr/local/var/openldap-data-net
-E: 37.    rootdn "cn=Manager,dc=example,dc=com"
-E: 38.    index objectClass eq
-E: 39.    access to * by users read
-
 H2: Access Control via Dynamic Configuration
 
 Access to slapd entries and attributes is controlled by the
@@ -635,9 +557,16 @@ When evaluating whether some requester should be given access to
 an entry and/or attribute, slapd compares the entry and/or attribute
 to the {{EX:<what>}} selectors given in the configuration.  For
 each entry, access controls provided in the database which holds
-the entry (or the first database if not held in any database) apply
+the entry (or the global access directives if not held in any database) apply
 first, followed by the global access directives (which are held in
-the {{EX:frontend}} database definition).  Within this priority,
+the {{EX:frontend}} database definition). However, when dealing with 
+an access list, because the global access list is effectively appended 
+to each per-database list, if the resulting list is non-empty then the 
+access list will end with an implicit {{EX:access to * by * none}} directive. 
+If there are no access directives applicable to a backend, then a default 
+read is used.
+
+Within this priority,
 access directives are examined in the order in which they appear
 in the configuration attribute.  Slapd stops with the first
 {{EX:<what>}} selector that matches the entry and/or attribute. The
@@ -722,10 +651,11 @@ would never be reached, since all entries under {{EX:dc=example,dc=com}}
 are also under {{EX:dc=com}} entries.
 
 Also note that if no {{EX:olcAccess: to}} directive matches or no {{EX:by
-<who>}} clause, {{B:access is denied}}.  That is, every {{EX:olcAccess:
-to}} directive ends with an implicit {{EX:by * none}} clause and
-every access list ends with an implicit {{EX:olcAccess: to * by * none}}
-directive.
+<who>}} clause, {{B:access is denied}}.  When dealing with an access list, 
+because the global access list is effectively appended to each per-database 
+list, if the resulting list is non-empty then the access list will end with 
+an implicit {{EX:access to * by * none}} directive. If there are no access 
+directives applicable to a backend, then a default read is used.
 
 The next example again shows the importance of ordering, both of
 the access directives and the {{EX:by <who>}} clauses.  It also
@@ -845,138 +775,6 @@ consult the {{Advanced Access Control}} chapter.
 !endif
 
 
-H3: Configuration Example
-
-The following is an example configuration, interspersed
-with explanatory text. It defines two databases to handle
-different parts of the {{TERM:X.500}} tree; both are {{TERM:BDB}}
-database instances. The line numbers shown are provided for
-reference only and are not included in the actual file. First, the
-global configuration section:
-
-E:  1.    # example config file - global configuration entry
-E:  2.    dn: cn=config
-E:  3.    objectClass: olcGlobal
-E:  4.    cn: config
-E:  5.    olcReferral: ldap://root.openldap.org
-E:  6.    
-
-Line 1 is a comment. Lines 2-4 identify this as the global
-configuration entry.
-The {{EX:olcReferral:}} directive on line 5
-means that queries not local to one of the databases defined
-below will be referred to the LDAP server running on the
-standard port (389) at the host {{EX:root.openldap.org}}.
-Line 6 is a blank line, indicating the end of this entry.
-
-E:  7.    # internal schema
-E:  8.    dn: cn=schema,cn=config
-E:  9.    objectClass: olcSchemaConfig
-E: 10.    cn: schema
-E: 11.    
-
-Line 7 is a comment. Lines 8-10 identify this as the root of
-the schema subtree. The actual schema definitions in this entry
-are hardcoded into slapd so no additional attributes are specified here.
-Line 11 is a blank line, indicating the end of this entry.
-
-E: 12.    # include the core schema
-E: 13.    include: file:///usr/local/etc/openldap/schema/core.ldif
-E: 14.    
-
-Line 12 is a comment. Line 13 is an LDIF include directive which
-accesses the {{core}} schema definitions in LDIF format. Line 14
-is a blank line.
-
-Next comes the database definitions. The first database is the
-special {{EX:frontend}} database whose settings are applied globally
-to all the other databases.
-
-E: 15.    # global database parameters
-E: 16.    dn: olcDatabase=frontend,cn=config
-E: 17.    objectClass: olcDatabaseConfig
-E: 18.    olcDatabase: frontend
-E: 19.    olcAccess: to * by * read
-E: 20.    
-
-Line 15 is a comment. Lines 16-18 identify this entry as the global
-database entry. Line 19 is a global access control. It applies to all
-entries (after any applicable database-specific access controls).
-
-The next entry defines a BDB backend that will handle queries for things
-in the "dc=example,dc=com" portion of the tree. Indices are to be maintained
-for several attributes, and the {{EX:userPassword}} attribute is to be
-protected from unauthorized access.
-
-E: 21.    # BDB definition for example.com
-E: 22.    dn: olcDatabase=bdb,cn=config
-E: 23.    objectClass: olcDatabaseConfig
-E: 24.    objectClass: olcBdbConfig
-E: 25.    olcDatabase: bdb
-E: 26.    olcSuffix: "dc=example,dc=com"
-E: 27.    olcDbDirectory: /usr/local/var/openldap-data
-E: 28.    olcRootDN: "cn=Manager,dc=example,dc=com"
-E: 29.    olcRootPW: secret
-E: 30.    olcDbIndex: uid pres,eq
-E: 31.    olcDbIndex: cn,sn,uid pres,eq,approx,sub
-E: 32.    olcDbIndex: objectClass eq
-E: 33.    olcAccess: to attrs=userPassword
-E: 34.      by self write
-E: 35.      by anonymous auth
-E: 36.      by dn.base="cn=Admin,dc=example,dc=com" write
-E: 37.      by * none
-E: 38.    olcAccess: to *
-E: 39.      by self write
-E: 40.      by dn.base="cn=Admin,dc=example,dc=com" write
-E: 41.      by * read
-E: 42.    
-
-Line 21 is a comment. Lines 22-25 identify this entry as a BDB database
-configuration entry.  Line 26 specifies the DN suffix
-for queries to pass to this database. Line 27 specifies the directory
-in which the database files will live.
-
-Lines 28 and 29 identify the database {{super-user}} entry and associated
-password. This entry is not subject to access control or size or
-time limit restrictions.
-
-Lines 30 through 32 indicate the indices to maintain for various
-attributes.
-
-Lines 33 through 41 specify access control for entries in this
-database.  As this is the first database, the controls also apply
-to entries not held in any database (such as the Root DSE).  For
-all applicable entries, the {{EX:userPassword}} attribute is writable
-by the entry itself and by the "admin" entry.  It may be used for
-authentication/authorization purposes, but is otherwise not readable.
-All other attributes are writable by the entry and the "admin"
-entry, but may be read by all users (authenticated or not).
-
-Line 42 is a blank line, indicating the end of this entry.
-
-The next section of the example configuration file defines another
-BDB database. This one handles queries involving the
-{{EX:dc=example,dc=net}} subtree but is managed by the same entity
-as the first database.  Note that without line 52, the read access
-would be allowed due to the global access rule at line 19.
-
-E: 43.    # BDB definition for example.net
-E: 44.    dn: olcDatabase=bdb,cn=config
-E: 45.    objectClass: olcDatabaseConfig
-E: 46.    objectClass: olcBdbConfig
-E: 47.    olcDatabase: bdb
-E: 48.    olcSuffix: "dc=example,dc=net"
-E: 49.    olcDbDirectory: /usr/local/var/openldap-data-net
-E: 50.    olcRootDN: "cn=Manager,dc=example,dc=com"
-E: 51.    olcDbIndex: objectClass eq
-E: 52.    olcAccess: to * by users read
-
-
-H3: Converting from {{slapd.conf}}(5) to a {{B:cn=config}} directory format
-
-Discuss slap* -f slapd.conf -F slapd.d/  (man slapd-config)
-
-
 H2: Access Control Common Examples
 
 H3: Basic ACLs
@@ -1029,7 +827,7 @@ This ACL grants read permissions to authenticated users while denying others
 
 H3: Controlling rootdn access
 
-You could specify the {{rootdn}} in {{slapd.conf}}(5) or {[slapd.d}} without 
+You could specify the {{rootdn}} in {{slapd.conf}}(5) or {{slapd.d}} without 
 specifying a {{rootpw}}. Then you have to add an actual directory entry with 
 the same dn, e.g.:
 
@@ -1079,7 +877,7 @@ One can then grant access to the members of this this group by adding appropriat
 >        by group.exact="cn=Administrators,dc=example,dc=com" write  
 >        by * auth
 
-Like by {[dn}} clauses, one can also use {{expand}} to expand the group name 
+Like by {{dn}} clauses, one can also use {{expand}} to expand the group name 
 based upon the regular expression matching of the target, that is, the to {{dn.regex}}). 
 For instance,
 
@@ -1356,7 +1154,7 @@ To get what we wanted the file has to read:
 
 The general rule is: "special access rules first, generic access rules last"
 
-See also {{slapd.access}}(8), loglevel 128 and {{slapacl}}(8) for debugging
+See also {{slapd.access}}(5), loglevel 128 and {{slapacl}}(8) for debugging
 information.
 
 
@@ -1525,7 +1323,7 @@ The end result is that when Jane accesses John's entry, she will be granted
 write access to the specified attributes. Better yet, this will happen to any
 entry she accesses which has Mary as the manager.
 
-This is all cool and nice, but perhaps gives to much power to secretaries. Maybe we need to further
+This is all cool and nice, but perhaps gives too much power to secretaries. Maybe we need to further
 restrict it. For example, let's only allow executive secretaries to have this power:
 
 > access to dn.exact="uid=john,ou=people,dc=example,dc=com"