Contenues dansTrouver plus de documentationRessources d'assistance comprises | Télécharger cet ouvrage au format PDF (4144 Ko)
How Directory Server Provides Access ControlDirectory Server uses access control instructions (ACIs) to define what rights to grant or deny to requests from LDAP clients. When a directory server receives a request, it uses the ACIs defined in the server, and any authentication information provided by the user to allow or deny access to directory information. The server can allow or deny permissions such as read, write, search, or compare. For information about ACIs in Directory Server, see the following sections: Introduction to ACIsACIs are stored in the aci operational attribute. The aci attribute is available for use on every entry in the directory, regardless of whether the aci attribute is defined for the object class of the entry. The aci attribute is multi-valued, therefore multiple ACIs can be defined for the same portion of a directory. ACIs can be used to control access to the following portions of a directory:
ACIs can be used to define access for the following users:
Scope and Hierarchy in ACIsACIs can be created at any node in a directory tree, including the root DSE. The scope of an ACI can be the target entry, the target entry and its immediate children, or the target entry and all of its children. When no scope is specified, the ACI applies to the target entry and all of its children. When a server evaluates access permissions to an entry, it verifies the ACIs for the entry and the ACIs for the parent entries back up to the base of the entry’s root suffix. ACIs are not evaluated across chained suffixes on other servers. Access to an entry in a server must be explicitly granted by an ACI. By default, ACIs define anonymous read access and allow users to modify their own entries, except for attributes needed for security. If no ACI applies to an entry, access is denied to all users except the Directory Manager. Access granted by an ACI is allowed unless any other ACI in the hierarchy denies it. ACIs that deny access, no matter where they appear in the hierarchy, take precedence over ACIs that allow access to the same resource. The Directory Manager is the only privileged user to whom access control does not apply. When a client is bound to the directory as the Directory Manager, the server does not evaluate any ACIs before performing operations. In previous versions of Directory Server, ACIs could not be added or deleted directly under the root DSE. This limitation has been removed in Directory Server 6.0. ACI LimitationsThe following restrictions apply to ACIs
Default ACIsThe following default ACIs are defined on the root DSE:
ACIs and ReplicationACIs are stored as attributes of entries. Therefore, if an entry that contains ACIs is part of a replicated suffix, the ACIs are replicated like any other attribute. ACIs are always evaluated locally, on the directory server that services the incoming LDAP requests. When a consumer server receives an update request, the consumer server returns a referral to the master server for evaluation of whether the request can be serviced on the master. Effective RightsThe effective rights feature can be used to obtain the following information:
To use the effective rights feature, you must have the access control rights to use the effective rights control and read access to the aclRights attribute. If a proxy control is attached to an effective rights control-based search operation, the effective rights operation is authorized as the proxy user. Therefore the proxy user needs to have the right to use the effective rights control. The entries that the proxy user has the right to search and view are returned. ACI SyntaxThe aci attribute has the following syntax: aci: (target)(version 3.0; acl "name";permission bindRules;) The following values are used in the ACI syntax:
The permission and bind rule portions of the ACI are set as a pair, also called an Access Control Rule (ACR). The specified permission to access the target is granted or denied depending on whether the accompanying bind rule is evaluated to be true or false. Multiple targets and multiple permission-bind rule pairs can be used. This allows you to refine both the entry and attributes being targeted and efficiently set multiple access controls for a given target. The following example shows an ACI with multiple targets and multiple permission-bind rule pairs: aci: (targetdefinition)...(targetdefinition)(version 3.0;acl "name"; permission bindRule; ...; permission bindRule;) In the following example, the ACI states that bjensen has rights to modify all attributes in her own directory entry: aci: (target="ldap:///uid=bjensen,dc=example,dc=com" (targetattr="*")(targetScope="subtree")(version 3.0; acl "example"; allow (write) userdn="ldap:///self";) The following sections describe the syntax of targets, permissions and bind rules. ACI TargetsAn ACI target statement specifies the entry, attributes, or set of entries and attributes for which you want to control access. Target SyntaxAn ACI target statement has this syntax: (keyword = "expression") The following values are used in the target.
Target KeywordsFor a description of target keywords, see the following sections: The following table lists the target keywords and their associated expressions. Table 2–1 Target Keywords and Their Expressions
target KeywordThe target keyword specifies that an ACI is defined for a directory entry. The target keyword uses the following syntax: (target = "distinguished_name") or (target != "distinguished_name") The distinguished name must be in the subtree rooted at the entry where the ACI is defined. For example, the following target may be used in an ACI on ou=People,dc=example,dc=com:
The DN of the entry must be a distinguished name in string representation (RFC 4514). Therefore, characters that are syntactically significant for a DN, such as commas, must be escaped with a single backslash (\). Wild cards, show as asterisk characters can be used in the expression for the target keyword. The asterisk matches an attribute value, a substring of a value, or a DN component. For example, all of the following expressions match uid=bjensen,ou=people,dc=example,dc=com.
The following further examples show permitted uses of wild cards.
Other usage of wild cards to such as target="ldap:///uid=bjensen,o*,dc=com" might be accepted, but are deprecated. targetattr KeywordThe targetattr keyword specifies that an ACI is defined for one or more attributes in the targeted entries. The targetattr keyword uses the following syntax:
or
If no targetattr keyword is present, no attributes are targeted. To target all attributes, the targetattr keyword must be targetattr="*". Targeted attributes do not need to exist on the target entry or its subtree, but the ACI applies whenever they do. Targeted attributes do not need to be defined in the schema. The absence of schema checking makes it possible to implement an access control policy before importing data and its schema. The targetattr keyword can be used for multiple attributes, by using this syntax:
Targeted attributes include all subtypes of the named attribute. For example, (targetattr = "locality") also targets locality;lang-fr. Wild cards can be used in the expression for the targetattr keyword, but the use of wild cards would serve no purpose and may reduce performance. targetfilter KeywordThe targetfilter keyword is used in ACIs to target entries that match an LDAP filter. The ACI applies to all entries that match the LDAP filter and that are in the scope of the ACI. The targetfilter keyword uses the following syntax:
Example 2–1 Using the targetfilter Keyword to Target Specific EntriesThe following example is for employees with a status of salaried or contractor, and an attribute for the number of hours worked as a percentage of a full-time position. The filter targets entries for contractors or part-time employees:
The Netscape extended filter syntax is not supported in ACIs. For example, the following target filter is not valid:
The filter syntax that describes matching rules for internationalized values is supported. For example, the following target filter is valid:
The targetfilter keyword selects whole entries as targets of the ACI. The targetfilter keyword and the targetattr keyword can be used together to create ACIs that apply to a subset of attributes in the targeted entries. targetattrfilters KeywordThe targetattrfilters keyword is used in ACIs to target specific attribute values by using LDAP filters. By using the targetattrfilters keyword, you can grant or deny permissions on an attribute if that attribute's value meets the criteria defined in the ACI. An ACI that grants or denies access based on an attribute's value, is called a value-based ACI. The targetattrfilters keyword uses this syntax:
The targetattrfilters keyword can have the following values:
The following conditions must be met when filters apply to entries, and those entries are created, deleted or modified:
Example 2–2 Using the targetattrfilters Keyword to Allow Users to Add Roles to Their Own EntriesThe following ACI allows users to add any role to their own entry, except the superAdmin role. It also allows users to add a telephone number with a 123 prefix. (targettrfilters="add=nsroleDN:(!(nsRoleDN=cn=superAdmin)) && telephoneNumber:(telephoneNumber=123*)") Example 2–3 Using the targetattrfilters Keyword to Allow Group Members to Modify Specific AttributesThe following example allows members of the Engineering Admins group to modify the departmentNumber and manager attributes of all entries in the Engineering business category. This example filters entries with the businessCategory attributes set to Engineering:
targetScope KeywordThe targetScope keyword is used in ACIs to specify the scope of the ACI. The targetScope keyword uses this syntax: (targetScope="base") The targetScope keyword can have one of these values:
If the targetScope keyword is not specified, the default value is subtree. ACI PermissionsPermissions specify the type of access that is allowed or denied by the ACI. For information about bind rules, see the following sections: Permission SyntaxAn ACI permission statement has this syntax: allow|deny (right1, right2 ...) Rights define the operations you can perform on directory data. In an ACI statement, rights is a list of comma-separated keywords enclosed within parentheses. Rights are granted independently of one another. This means, for example, that a user who is granted add rights but not delete rights can create an entry but cannot delete an entry. When you are planning the access control policy for your directory, ensure that you grant rights in a way that makes sense for users. For example, it might not make sense to grant write permission without granting read and search permissions. Permission RightsThe following rights can be allowed or denied in an ACI permission statement:
Permissions for Typical LDAP OperationsThis section describes the rights required to perform a set of LDAP operations.
Example 2–4 Granting ACI Permissions to Perform a SearchThis example configures permissions to allow bjensen to search her own entry. (target="ldap:///dc=example,dc=com")
ldapsearch -h host -p port -D "uid=bjensen,dc=example,dc=com" \
-w password -b "dc=example,dc=com" \
"(objectclass=*)" mail
The following ACI determines whether bjensen can be granted access for searching her own entry: aci: (targetattr = "mail")(version 3.0; acl "self access to mail"; allow (read, search) userdn = "ldap:///self";) The search result list is empty because this ACI does not allow bjensen the right to search on the objectclass attribute. To perform the search operation described, you must modify the ACI as follows: aci: (targetattr = "mail || objectclass")(version 3.0; acl "self access to mail"; allow (read, search) userdn = "ldap:///self";) ACI Bind RulesBind rules identify the set of users to which an ACI applies. The permission and bind rule portions of the ACI are set as a pair. The specified permission to access the target is granted or denied depending on whether the accompanying bind rule is evaluated to be true or false. For information about bind rules, see the following sections: Introduction to Bind RulesBind rules identify a set of users by using the following methods:
A simple bind rule might require a person accessing the directory to belong to a specific group. A complex bind rule can require a person to belong to a specific group and to log in from a machine with a specific IP address, between 8 am and 5 pm. Additionally, bind rules can be complex constructions that combine these criteria by using Boolean operators. The server evaluates the logical expressions used in ACIs according to a three-valued logic, similar to the one used to evaluate LDAP filters, as described in section 4.5.1.7 of RFC 4511 Lightweight Directory Access Protocol (v3). Therefore, if any component in the expression evaluates to Undefined (for example if the evaluation of the expression aborted due to a resource limitation), then the server handles this case correctly. The server does not erroneously grant access because an Undefined value occurred in a complex Boolean expression. Bind Rule SyntaxAn ACI bind rule has this syntax: keyword = "expression"; or keyword != "expression"; The following values are used in the bind rule:
Bind Rule KeywordsFor information about bind rule keywords, see the following sections: The following table summarizes the keywords for bind rules. Table 2–2 Bind Rule Keywords and Their Expressions
userdn KeywordThe userdn keyword is used to allow or deny access to a specified user. The following sections contain more information about the userdn keyword. Syntax of the userdn KeywordThe userdn keyword uses this syntax: userdn = "ldap:///dn [|| ldap:///dn]..." userdn != "ldap:///dn [|| ldap:///dn]..." The userdn keyword can alternatively be expressed as an LDAP URL filter. For information about expressing the userdn keyword as an LDAP URL, see LDAP URLs in the userdn Keyword. dn can have of the following values:
LDAP URLs in the userdn KeywordThe userdn keyword can also be expressed as an LDAP URL with a filter, by using this syntax: userdn = ldap:///suffix??sub?(filter) LDAP URLs always apply to the local server. Do not specify a hostname or port number within an LDAP URL. The following ACI on the dc=example,dc=com node allows all users in the accounting and engineering branches of the example.com tree to access to the targeted resource dynamically based on the following URL userdn = "ldap:///dc=example,dc=com??sub?(|(ou=eng)(ou=acct))" LDAP URLs can be used with the logical OR operator and the not-equal operator as shown in the following examples. Example 2–5 Using the userdn Keyword With a Logical OR Operator in LDAP URLsThis bind rule is evaluated to be true for users that bind with either of the specified DN patterns. userdn = "ldap:///uid=b*,c=example.com || ldap:///cn=b*,dc=example,dc=com"; Example 2–6 Using the userdn Keyword With a Not-Equal Operator in LDAP URLsThis bind rule is evaluated to be true if the client is not binding as a UID-based DN in the accounting subtree. This bind rule only makes sense if the targeted entry is not under the accounting branch of the directory tree. userdn != "ldap:///uid=*,ou=Accounting,dc=example,dc=com"; groupdn KeywordThe groupdn keyword specifies that access to a targeted entry is granted or denied if the user binds by using a DN that belongs to a specific group. The groupdn keyword uses this syntax: groupdn="ldap:///groupDN [|| ldap:///groupDN]..." The bind rule is evaluated to be true if the bind DN belongs to a group that is specified by any of the values for groupDN. In the following example, the bind rule is true if the bind DN belongs to the Administrators group : aci: (version 3.0; acl "Administrators-write"; allow (write) groupdn="ldap:///cn=Administrators,dc=example,dc=com";) Characters that are syntactically significant for a DN, such as commas, must be escaped with a single backslash (\). roledn KeywordThe roledn keyword specifies that access to a targeted entry is granted or denied if the user binds using a DN that belongs to a specific role. The roledn keyword requires one or more valid distinguished names, in this format: roledn = "ldap:///dn [|| ldap:///dn]... [|| ldap:///dn]" The bind rule is evaluated to be true if the bind DN belongs to the specified role. Characters that are syntactically significant for a DN, such as commas, must be escaped with a single backslash (\). The roledn keyword has the same syntax and is used in the same way as the groupdn keyword. userattr KeywordThe userattr keyword specifies which attribute values in the entry that was used to bind must match those in the targeted entry. The userattr keyword can be used for the following attributes:
An attribute generated by a Class of Service (CoS) definition cannot be used with the userattr keyword. ACIs that contain bind rules that depend on attribute values generated by CoS will not work. The userattr keyword uses this syntax: userattr = "attrName#bindType" Alternatively, if you are using an attribute type that requires a value other than a user DN, group DN, role DN, or an LDAP filter, the userattr keyword uses this syntax: userattr = "attrName#attrValue" The userattr keyword can have one of the following values:
Examples of userattr Keyword With Various Bind TypesExample 2–7 Using the userattr Keyword With the USERDN Bind TypeThe following is an example of the userattr keyword associated with a bind based on the user DN: userattr = "manager#USERDN" The bind rule is evaluated to be true if the bind DN matches the value of the manager attribute in the targeted entry. You can use this to allow a user’s manager to modify employees’ attributes. This mechanism only works if the manager attribute in the targeted entry is expressed as a full DN. The following example grants a manager full access to his or her employees’ entries: aci: (target="ldap:///dc=example,dc=com")(targetattr="*") (version 3.0;acl "manager-write"; allow (all) userattr = "manager#USERDN";) Example 2–8 Using the userattr Keyword With the GROUPDN Bind TypeThe following is an example of the userattr keyword associated with a bind based on a group DN: userattr = "owner#GROUPDN" The bind rule is evaluated to be true if the bind DN is a member of the group specified in the owner attribute of the targeted entry. For example, you can use this mechanism to allow a group to manage employees’ status information. You can use an attribute other than owner, as long as the attribute you use contains the DN of a group entry. The group you point to can be a dynamic group, and the DN of the group can be under any suffix in the directory. However, the evaluation of this type of ACI by the server is very resource intensive. If you are using static groups that are under the same suffix as the targeted entry, you can use the following expression: userattr = "ldap:///dc=example,dc=com?owner#GROUPDN" In this example, the group entry is under the dc=example,dc=com suffix. The server can process this type of syntax more quickly than the previous example. Example 2–9 Using the userattr Keyword With the ROLEDN Bind TypeThe following is an example of the userattr keyword associated with a bind based on a role DN: userattr = "exampleEmployeeReportsTo#ROLEDN" The bind rule is evaluated to be true if the bind DN belongs to the role specified in the exampleEmployeeReportsTo attribute of the targeted entry. For example, if you create a nested role for all managers in your company, you can use this mechanism to grant managers at all levels access to information about employees that are at a lower grade than themselves. The DN of the role can be under any suffix in the directory. If, in addition, you are using filtered roles, the evaluation of this type of ACI uses a lot of resources on the server. Example 2–10 Using the userattr Keyword With the LDAPURL Bind TypeThe following is an example of the userattr keyword associated with a bind based on an LDAP filter: userattr = "myfilter#LDAPURL" The bind rule is evaluated to be true if the bind DN matches the filter specified in the myfilter attribute of the targeted entry. The myfilter attribute can be replaced by any attribute that contains an LDAP filter. Example 2–11 Using the userattr Keyword With Any Attribute ValueThe following is an example of the userattr keyword associated with a bind based on any attribute value: userattr = "favoriteDrink#Milk" The bind rule is evaluated to be true if the bind DN and the target DN include the favoriteDrink attribute with a value of Milk. Use of the userattr Keyword With the parent Keyword for InheritanceThe userattr keyword can be used with the parent keyword to specify the number of levels below the target that should inherit the ACI. The userattr keyword and parent keyword use this syntax: userattr = "parent[inheritance_level].attribute#bindType" The userattr keyword and parent keyword can have the following values:
The following example shows how the userattr keyword is used with the parent keyword for inheritance: userattr = "parent[0,1].manager#USERDN" This bind rule is evaluated to be true if the bindDN matches the manager attribute of the targeted entry. The permissions granted when the bind rule is evaluated to be true apply to the target entry and to all entries immediately below it. Use of the userattr Keyword to Grant Add PermissionsIf you use the userattr keyword in conjunction with all or add permissions, you might find that the behavior of the server is not what you expect. Typically, when a new entry is created in the directory, Directory Server evaluates access rights on the entry being created, and not on the parent entry. However, for ACIs that use the userattr keyword, this behavior could create a security hole, and the server’s normal behavior is modified to avoid it. Consider the following example: aci: (target="ldap:///dc=example,dc=com")(targetattr="*") (version 3.0; acl "manager-write"; allow (all) userattr = "manager#USERDN";) This ACI grants managers all rights on the entries of employees that report to them. However, because access rights are evaluated on the entry being created, this type of ACI would also allow any employee to create an entry in which the manager attribute is set to their own DN. For example, disgruntled employee Joe (cn=Joe,ou=eng,dc=example,dc=com), might want to create an entry in the Human Resources branch of the tree, to use (or misuse) the privileges granted to Human Resources employees. He could do this by creating the following entry: dn: cn= Trojan Horse,ou=Human Resources,dc=example,dc=com objectclass: top ... cn: Trojan Horse manager: cn=Joe,ou=eng,dc=example,dc=com To avoid this type of security threat, the ACI evaluation process does not grant add permission at level 0, that is, to the entry itself. You can, however, use the parent keyword to grant add rights below existing entries. You must specify the number of levels below the parent for add rights. For example, the following ACI allows child entries to be added to any entry in the dc=example,dc=com that has a manager attribute that matches the bind DN: aci: (target="ldap:///dc=example,dc=com")(targetattr="*") (version 3.0; acl "parent-access"; allow (add) userattr = "parent[0,1].manager#USERDN";) This ACI ensures that add permission is granted only to users whose bind DN matches the manager attribute of the parent entry. ip KeywordThe ip keyword is used to specify that a bind operation must originate from a specific IP address. The ip keyword uses this syntax: ip = "IPaddressList" or ip != "IPaddressList" The IPaddressList value is a list of one or more comma-separated elements from the following elements:
The bind rule is evaluated to be true if the client accessing the directory is located at the named IP address. The ip keyword can be used to force all directory updates to occur from a given machine or network domain. However, the IP address from which a user authenticates can be spoofed, and can therefore not be trusted. Do not base ACIs on this information alone. The wild card * can be used to specify a set of IP addresses. dns KeywordNote – The dns keyword requires that the naming service used on your machine is DNS. If the name service is not DNS, you should use the ip keyword instead. The dns keyword is used to specify that a bind operation must originate from a specific domain or host machine. The dns keyword uses this syntax: dns = "DNS_Hostname" or dns != "DNS_Hostname" The dns keyword requires a fully qualified DNS domain name. Granting access to a host without specifying the domain creates a potential security threat. For example, the following expression is allowed but not recommended: dns = "legend.eng"; You should use a fully qualified name such as: dns = "legend.eng.example.com"; The dns keyword allows wild cards. dns = "*.example.com"; The bind rule is evaluated to be true if the client accessing the directory is located in the named domain. This can be useful for allowing access only from a specific domain. Note that wild cards do not work if your system uses a naming service other than DNS. timeofday KeywordThe timeofday keyword is used to specify that access can occur at a certain time of day. The time and date on the server are used for the evaluation of the timeofday and dayofweek bind rules, and not the time on the client. The timeofday keyword uses this syntax: timeofday operator "time" The timeofday keyword can have the following values:
dayofweek KeywordThe dayofweek keyword is used to specify that access can occur on a certain day or on certain days of the week. The time and date on the server are used for the evaluation of the timeofday and dayofweek bind rules, and not the time on the client. The dayofweek keyword uses this syntax: dayofweek = "day1, day2 ..." The bind rule is true if the directory is being accessed on one of the days listed. The dayofweek keyword can have one or more of the following values: sun, mon, tue, wed, thu, fri, sat. authmethod KeywordThe authmethod keyword is used to specify that a client must bind to the directory by using a specific authentication method. The authmethod keyword uses this syntax: authmethod = "authentication_method" The authmethod keyword can have the following values:
Boolean Bind RulesBind rules can be complex expressions that use the Boolean expressions AND, OR, and NOT to set precise access rules. Boolean bind rules use this syntax: (bindRuleA and (bindRuleB or (bindRuleC and bindRuleD));) Parentheses defines the order in which rules are evaluated, and a trailing semicolon must appear after the final rule. Example 2–12 Boolean Bind RuleThe bind rule is true if both of the following conditions are met:
(dns = "*.example.com" and (groupdn = "ldap:///cn=administrators, dc=example,dc=com" or (groupdn = "ldap:///cn=mail administrators, dc=example,dc=com" and groupdn = "ldap:///cn=calendar administrators, dc=example,dc=com"));) Tuning and Access ControlDirectory Server offers performance and scalability improvements for Access Control Instructions. The improvements include better memory management. The improvements also include support for macro ACIs. Improvements notwithstanding, Directory Server uses significant system resources to evaluate complex ACIs. Extensive use of complex ACIs can therefore negatively impact performance. Macro ACIs help you limit the number of ACIs used. By limiting the number of ACIs, you render access control easier to manage and reduce the load on the system. Macros are placeholders that represent a DN, or a portion of a DN, in an ACI. A macro can be used in an ACI target, in an ACI bind rule, or in both. When Directory Server receives a request, it checks which ACI macros match against the resource targeted for the resulting operation. If a macro matches, Directory Server replaces it with the value of the actual DN. Directory Server then evaluates the ACI normally. Testing has demonstrated that a Directory Server instance can support more than 50,000 ACIs. Nevertheless, keep the number of ACIs as small as possible. Keeping the number of ACIs small limits negative impact on performance. Keeping the number small also reduces the complexity of managing access controls. For deployments involving complex ACI environments, consider using Directory Proxy Server to provide some access control features. |
||||||||||||||||||||||||||||