13.4. Bind Rules
- Users, groups, and roles that are granted access.
- Locations from which an entity must bind.
- Times or days on which binding must occur.
- Types of authentication that must be in use during binding.
13.4.1. Bind Rule Syntax
keyword = "expression"; or keyword != "expression";
=) indicates that keyword and expression must match in order for the bind rule to be true, and not equal (!=) indicates that keyword and expression must not match in order for the bind rule to be true.
Note
timeofday keyword also supports the inequality expressions (<, <=, >,>=). This is the only keyword that supports these expressions.
"") around expression and the delimiting semicolon (;) are required. The expressions you can use depend on the associated keyword.
Table 13.3. LDIF Bind Rule Keywords
| Keyword | Valid Expressions | Wildcard Allowed | ||||||
|---|---|---|---|---|---|---|---|---|
| userdn |
| Yes, in DN only | ||||||
| groupdn |
| No | ||||||
| roledn | ldap:///DN|| DN | No | ||||||
| userattr | attribute#bindType orattribute#value | No | ||||||
| ip | IP_address | Yes | ||||||
| dns | DNS_host_name | Yes | ||||||
| dayofweek | sun mon tue wed thu fri sat | No | ||||||
| timeofday | 0 - 2359 | No | ||||||
| authmethod |
| No |
13.4.2. Defining User Access - userdn Keyword
userdn keyword. The userdn keyword requires one or more valid distinguished names in the following format:
userdn = "ldap:///dn [|| ldap:///dn]...[||ldap:///dn]"
anyone, all, self, or parent:
userdn = "ldap:///anyone" Defines anonymous access userdn = "ldap:///all" Defines general access userdn =ldap:///self" Defines self access userdn =ldap:///parent" Defines access for the parent entry
userdn keyword can also be expressed as an LDAP filter:
ldap:///suffix??scope?(filter)
Note
\) escape character.
13.4.2.1. Anonymous Access (anyone Keyword)
13.4.2.2. General Access (all Keyword)
13.4.2.3. Self Access (self Keyword)
13.4.2.4. Parent Access (parent Keyword)
13.4.2.5. LDAP URLs
userdn = "ldap:///suffix??scope?(filter)"
example tree would be granted or denied access to the targeted resource dynamically based on the following URL:
userdn = "ldap:///dc=example,dc=com??sub?(|(ou=engineering)(ou=accounting))"
Note
userdn keyword definitions. For example:
userdn="ldap:///dc=example,dc=com??sub?(ou=engineering)" and userdn="ldap:///dc=example,dc=com??sub?(manager="uid=bjensen,ou=managers,dc=example,dc=com")"
&& is not allowed. For example, this is not an acceptable bind rule:
groupdn="ldap:///dc=example,dc=com??sub?(ou=engineering) && ldap:///dc=example,dc=com??sub?(manager="uid=bjensen,ou=managers,dc=example,dc=com")"
13.4.2.6. Wildcards
uid=u*,dc=example,dc=com indicates that only users with a bind DN beginning with the letter u are allowed or denied access based on the permissions you set.
13.4.2.7. Examples
Table 13.4. userdn Keyword Examples
13.4.3. Defining Group Access - groupdn Keyword
groupdn keyword to specify that access to a targeted entry is granted or denied if the user binds using a DN that belongs to a specific group.
groupdn keyword requires one or more valid distinguished names in the following format:
groupdn="ldap:///dn [|| ldap:///dn]...[|| ldap:///dn]"
Note
\).
groupdn keyword can also be expressed with an LDAP filter:
groupdn="ldap:///suffix??scope?(filter)
groupdn syntax, the value of the groupdn expression is a single LDAP URL. Multiple groupdns can be grouped together within parentheses and use or or and connectors to define additional conditions on the group membership. For example:
(groupdn = "ldap:///ou=Groups,dc=example,dc=com??sub?(cn=*s_0)" or groupdn = "ldap:///ou=Groups,dc=example,dc=com??sub?(cn=*s_1)") and groupdn = "ldap:///ou=Groups,dc=example,dc=com??sub?(cn=*s_2)"
groupdn URLs together, the keyword supports pipes to separate the URLs:
groupdn = "LDAPURI0 || LDAPURL1 || LDAPURL2"
&), like groupdn = "LDAPURI0 && LDAPURL1", or double quotes.
groupdn keywords so that the bind user must belong to both an Administrators group and a Managers group:
groupdn="ldap:///dc=example,dc=com??sub?(cn=*Administrators)" and groupdn="ldap:///dc=example,dc=com??sub?(cn=*Managers)"
Table 13.5. groupdn Examples
| Scenario | Example | Description | |
|---|---|---|---|
| Groupdn keyword containing an LDAP URL | groupdn = "ldap:///cn=Administrators,dc=example,dc=com"; | The bind rule is evaluated to be true if the bind DN belongs to the Administrators group. If you wanted to grant the Administrators group permission to write to the entire directory tree, you would create the following ACI on the dc=example,dc=com node:
| |
| Groupdn keyword containing an LDAP URL with a filter | groupdn = "ldap:///dc=example,dc=com??sub?(cn=*Administrators)"; | The bind rule is evaluated to be true if the bind DN belongs to any of the groups which are returned, meaning they match the filter. | |
| Groupdn keyword containing logical OR of LDAP URLs | groupdn = "ldap:///cn=Administrators,dc=example,dc=com" || "ldap:///cn=Mail Administrators,dc=example,dc=com"; | The bind rule is evaluated to be true if the bind DN belongs to either the Administrators or the Mail Administrators group. |
13.4.4. Defining Role Access - roledn Keyword
roledn keyword to specify that access to a targeted entry is granted or denied if the user binds using a DN that belongs to a specific role.
roledn keyword requires one or more valid distinguished names in the following format:
roledn = "ldap:///dn [|| ldap:///dn]... [|| ldap:///dn]"
Note
\).
roledn keyword has the same syntax and is used in the same way as the groupdn keyword, with the exception of the LDAP filter, which is not implemented for role membership.
13.4.5. Defining Access Based on Value Matching
manager attribute of a user entry in order for the ACI to apply. In this case, only the user's manager would have access to the entry.
favoriteDrink attribute is beer to read all the entries of other users that have the same value for favoriteDrink.
13.4.5.1. Using the userattr Keyword
userattr keyword can be used to specify which attribute values must match between the entry used to bind and the targeted entry. You can specify any of the following:
- A user DN
- A group DN
- A role DN
- An LDAP filter, in an LDAP URL
- Any attribute type
userattr keyword is as follows:
userattr = "attrName#bindType
userattr = "attrName#attrValue
- attrName is the name of the attribute used for value matching.
- bindType is either
USERDN,GROUPDN, orLDAPURL. - attrValue is any string representing an attribute value.
13.4.5.1.1. Example with USERDN Bind Type
userattr keyword with a bind based on the user DN:
userattr = "manager#USERDN"
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.
aci: (target="ldap:///dc=example,dc=com")(targetattr=*)
(version 3.0; acl "manager-write"; allow (all) userattr = "manager#USERDN";)13.4.5.1.2. Example with GROUPDN Bind Type
userattr keyword with a bind based on a group DN:
userattr = "owner#GROUPDN"
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.
userattr = "ldap:///dc=example,dc=com?owner#GROUPDN"
dc=example,dc=com suffix. The server can process this type of syntax more quickly than the previous example.
owner is not an allowed entry in a user's entry. You would have to extend your schema to allow this attribute in a person object.)
13.4.5.1.3. Example with ROLEDN Bind Type
userattr keyword with a bind based on a role DN:
userattr = "exampleEmployeeReportsTo#ROLEDN"
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.
Note
exampleEmployeeReportsToattribute to the schema and that all employee entries contain this attribute. It also assumes that the value of this attribute is the DN of a role entry. For information on adding attributes to the schema, see Section 8.4.2, “Creating Attributes”.
userattr = "ldap:///dc=example,dc=com?employeeReportsTo#ROLEDN"
dc=example,dc=com suffix. The server can process this type of syntax more quickly than the previous example.
13.4.5.1.4. Example with LDAPURL Bind Type
userattr keyword with a bind based on an LDAP filter:
userattr = "myfilter#LDAPURL
13.4.5.1.5. Example with Any Attribute Value
userattr keyword with a bind based on any attribute value:
userattr = "favoriteDrink#Beer"
favoriteDrink attribute with a value of Beer.
13.4.5.1.6. Using the userattr Keyword with Inheritance
userattr keyword to associate the entry used to bind with the target entry, the ACI applies only to the target specified and not to the entries below it. In some circumstances, you might want to extend the application of the ACI several levels below the targeted entry. This is possible by using the parent keyword and specifying the number of levels below the target that should inherit the ACI.
userattr keyword in association with the parent keyword, the syntax is as follows:
userattr = "parent[inheritance_level].attrName#bindType
userattr = "parent[inheritance_level].attrName#attrValue
- inheritance_level is a comma-separated list that indicates how many levels below the target inherits the ACI. You can include five levels (
0,1,2,3,4) below the targeted entry; zero (0) indicates the targeted entry. - attribute is the attribute targeted by the
userattrorgroupattrkeyword. - bindType can be one of
USERDN,GROUPDN, orLDAPURL.
userattr = "parent[0,1].manager#USERDN"
bjensen is allowed to read and search the cn=Profiles entry as well as the first level of child entries which includes cn=mail and cn=news, thus allowing her to search through her own mail and news IDs.

Figure 13.1. Using Inheritance With the userattr Keyword
- Explicitly set read and search access for user
bjensenon thecn=Profiles,cn=mail, andcn=newsentries in the directory. - Add the owner attribute with a value of
bjensento thecn=mailandcn=newsentries, and then add the following ACI to thecn=mailandcn=newsentries.aci: (targetattr="*") (version 3.0; acl "profiles access"; allow (read,search) userattr="owner#USERDN";)
13.4.5.1.7. Granting Add Permission Using the userattr Keyword
userattr keyword in conjunction with all or add permissions does not behave as one would typically 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, in the case of ACIs using the userattr keyword, this behavior could create a security hole, and the server's normal behavior is modified to avoid it.
aci: (target="ldap:///dc=example,dc=com")(targetattr=*) (version 3.0;
acl "manager-write"; allow (all) userattr = "manager#USERDN";)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.
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
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";)13.4.6. Defining Access from a Specific IP Address
Note
ip = "IP_address" or ip != "IP_address"
ip = "12.123.1.*";
12.3.45.* to specify a specific subnetwork or 123.45.6.*+255.255.255.115 to specify a subnetwork mask.
13.4.7. Defining Access from a Specific Domain
dns = "DNS_Hostname or dns != "DNS_Hostname
Warning
dns keyword requires that the naming service used on your machine is DNS. If the name service is not DNS, use the ip keyword instead.
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";
dns = "legend.eng.example.com";
dns keyword allows wildcards. For example:
dns = "*.example.com";
ip keyword, as described in Section 13.4.6, “Defining Access from a Specific IP Address”.
13.4.8. Requiring a Certain Level of Security in Connections
ssf = "key_strength" ssf >= "key_strength"
ssf keyword accepts any positive whole number. If this is set to 0, than no secure connection is required for an operation.
13.4.9. Defining Access at a Specific Time of Day or Day of Week
timeofday operator time
| equal to (=) |
| not equal to (!=) |
| greater than (>) |
| greater than or equal to (>=) |
| less than (<) |
| less than or equal to (<=) |
timeofday keyword requires a time of day expressed in hours and minutes in the 24 hour clock (0 to 2359).
Note
dayofweek = "day1, day2 ...
dayofweek keyword are the English three-letter abbreviations for the days of the week: sun, mon, tue, wed, thu, fri, sat.
13.4.9.1. Examples
timeofday and dayofweek syntax:
- The bind rule is evaluated to be true if the client is accessing the directory at noon.
timeofday = "1200";
- The bind rule is evaluated to be true if the client is accessing the directory at any time other than 1 a.m.
timeofday != "0100";
- The bind rule is evaluated to be true if the client is accessing the directory at any time after 8 a.m.
timeofday > "0800";
- The bind rule is evaluated to be true if the client is accessing the directory at any time before 6 p.m.
timeofday < "1800";
- The bind rule is evaluated to be true if the client is accessing the directory at 8 a.m. or later.
timeofday >= "0800";
- The bind rule is evaluated to be true if the client is accessing the directory at 6 p.m. or earlier.
timeofday <= "1800";
- The bind rule is evaluated to be true if the client is accessing the directory on Sunday, Monday, or Tuesday.
dayofweek = "Sun, Mon, Tue";
13.4.10. Defining Access Based on Authentication Method
authmethod keyword sets the specific method that a client uses to bind to the directory. There are four available authentication methods:
- None. Authentication is not required. This is the default. It represents anonymous access.
- Simple. The client must provide a user name and password to bind to the directory.
- SSL. The client must bind to the directory using some kind of PKI credentials, meaning a client must present an SSL certificate either in a database or on a smart card, token, or some other device.Certificate-based authentication, as one method, is described in Section 7.10, “Using Client (Certificate-Based) Authentication”.
- SASL. The client must bind to the directory over a Simple Authentication and Security Layer (SASL) connection. Directory Server supports several SASL mechanisms:
PLAIN,EXTERNAL,CRAM-MD5,DIGEST-MD5(for Kerberos systems), andGSS-API(for Kerberos systems). For information on setting up SASL, see Section 7.11, “Setting up SASL Identity Mapping”.
Note
authmethod = "auth_mechanism
none, simple, ssl, or "sasl sasl_mechanism".
13.4.10.1. Examples
authmethod keyword:
- Authentication is not checked during bind rule evaluation.
authmethod = "none";
- The bind rule is evaluated to be true if the client is accessing the directory using a user name and password.
authmethod = "simple";
- The bind rule is evaluated to be true if the client authenticates to the directory using a certificate over LDAPS. This is not evaluated to be true if the client authenticates using simple authentication (bind DN and password) over LDAPS. The
authmethod = "ssl"means that a certificate must be presented to authenticate to the server. This does not configure a required connection type, even though SSL has to be used with certificate-based authentication.authmethod = "ssl";
- The bind rule is evaluated to be true if the client is accessing the directory using the SASL DIGEST-MD5 mechanism.
authmethod = "sasl DIGEST-MD5";
13.4.11. Using Boolean Bind Rules
AND, OR, and NOT to set very precise access rules. You cannot use the Directory Server Console to create Boolean bind rules. You must create an LDIF statement.
bind_rule [boolean][bind_rule][boolean][bind_rule]...;)
Mail Administrator's group and if the client is running from within the example.com domain:
(groupdn = "ldap:///cn=administrators,dc=example,dc=com" or
groupdn = "ldap:///cn=mail administrators,dc=example,dc=com" and
dns = "*.example.com";)- Innermost to outermost parenthetical expressions first.
- All expressions from left to right.
NOTbeforeANDorORoperators.ORandANDoperators have no order of precedence.
(bind_rule_A) OR (bind_rule_B) (bind_rule_B) OR (bind_rule_A)
NOT is evaluated before the Boolean OR and Boolean AND. Thus, in the following example, bind rule B is evaluated before bind rule A despite the left-to-right rule.
(bind_rule_A) AND NOT (bind_rule_B)

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.