Product SiteDocumentation Site

Chapter 5. Managing Entries with Roles, Class of Service, and Views

5.1. Using Roles
5.1.1. About Roles
5.1.2. Managing Roles Using the Console
5.1.3. Managing Roles Using the Command-Line
5.1.4. Using Roles Securely
5.2. Assigning Class of Service
5.2.1. About CoS
5.2.2. Managing CoS Using the Console
5.2.3. Managing CoS from the Command-Line
5.2.4. Creating Role-Based Attributes
5.2.5. Access Control and CoS
5.3. Using Views
5.3.1. Creating Views in the Console
5.3.2. Deleting Views from the Directory Server Console
5.3.3. Creating Views from the Command Line
5.3.4. Deleting Views from the Command Line
5.4. Using Groups
5.4.1. Managing Static Groups
5.4.2. Managing Dynamic Groups
Entries contained within the directory can be grouped in different ways to simplify the management of user accounts. Red Hat Directory Server supports a variety of methods for grouping entries and sharing attributes between entries. To take full advantage of the features offered by roles and class of service, determine the directory topology when planning the directory deployment.

5.1. Using Roles

Roles are a new entry grouping mechanism that unify the static and dynamic groups described in the previous sections. Roles are designed to be more efficient and easier to use for applications. For example, an application can get the list of roles of which an entry is a member by querying the entry itself, rather than selecting a group and browsing the members list of several groups.
This section contains the following topics:

5.1.1. About Roles

Roles unify the static and dynamic group concept supported by previous versions of Directory Server.
Roles can be used to organize users in number of different ways:
  • To enumerate the members of a role.
    Having an enumerated list of role members can be useful for resolving queries for role members quickly.
  • To determine whether a given entry possesses a particular role.
    Knowing the roles possessed by an entry can help determine whether the entry possesses the target role.
  • To enumerate all the roles possessed by a given entry.
  • To assign a particular role to a given entry.
  • To remove a particular role from a given entry.
Managed roles can do everything that can normally be done with static groups. The role members can be filtered using filtered roles, similarly to the filtering with dynamic groups. Roles are easier to use than groups, more flexible in their implementation, and reduce client complexity.
However, evaluating roles is more resource-intensive because the server does the work for the client application. With roles, the client application can check role membership by searching the nsRole attribute. The nsRole attribute is a computed attribute, which identifies to which roles an entry belongs; the nsRole attribute is not stored with the entry itself. From the client application point of view, the method for checking membership is uniform and is performed on the server side.

NOTE

The nsRole attribute is an operational attribute. In LDAP, operational attributes must be requested explicitly in the search attributes list; they are not returned by default with the regular attributes in the schema of the entry. For example, this ldapsearch command returns the list of roles of which uid=scarter is a member, in addition to the regular attributes for the entry:
ldapsearch ... args ... “(uid=scarter)” \* nsRole
Be sure to use the nsRole attribute, not the nsRoleDN attribute, to evaluate role membership.
The Console will automatically show the roles.
Each role has members, or entries that possess the role. Members can be specified either explicitly or dynamically. How role membership is specified depends upon the type of role. Directory Server supports three types of roles:
  • Managed roles have an explicit enumerated list of members.
  • Filtered roles are assigned entries to the role depending upon the attribute contained by each entry, specified in an LDAP filter. Entries that match the filter are said to possess the role.
  • Nested roles are roles that contain other roles.
The concept of activating/inactivating roles allows entire groups of entries to be activated or inactivated in just one operation. That is, the members of a role can be temporarily disabled by inactivating the role to which they belong.
When a role is inactivated, it does not mean that the user cannot bind to the server using that role entry. The meaning of an inactivated role is that the user cannot bind to the server using any of the entries that belong to that role; the entries that belong to an inactivated role will have the nsAccountLock attribute set to true.
In the case of the nested role, an inactivated nested role means that a user cannot bind to the server using an entry that belongs to a role that is a member of the nested role. All the entries that belong to a role that directly or indirectly are members of the nested role (one may have several levels of nested roles) will have nsAccountLock set to true.

NOTE

The nsAccountLock attribute is an operational attribute and must be explicitly requested in the search command in the list of search attributes. For example:
ldapsearch ... args ... “(uid=scarter)” \* nsAccountLock
The Console will automatically show the active/inactive status of entries.
When a role is created, determine whether a user can add themselves or remove themselves from the role. See Section 5.1.4, “Using Roles Securely” for more information about roles and access control.
Entries are assigned to a filtered role depending upon a particular attribute contained by each entry. The role definition specifies an LDAP filter for the target attributes. Entries that match the filter possess (are members of) the role.
To create and add members to a filtered role, do the following:
  1. Click Members in the left pane.
    A search dialog box appears briefly.
  2. In the right pane, select Filtered Role.
  3. Enter an LDAP filter in the text field, or click Construct to be guided through the construction of an LDAP filter.
  4. The Construct opens the standard LDAP URL construction dialog. Ignore the fields for LDAP Server Host, Port, Base DN, and Search (since the search scope cannot be set filtered role definitions).
    • Select the types of entries to filter from the For drop-down list.
      The entries can be users, groups, or both.
    • Select an attribute from the Where drop-down list. The two fields following it refine the search by selecting one of the qualifiers from the drop-down list, such as contains, does not contain, is, or is not. Enter an attribute value in the text box. To add additional filters, click More. To remove unnecessary filters, click Fewer.
    • Click OK.
  5. Click Test to try the filter.
    A Filter Test Result dialog box displays the entries matching the filter.
  6. Click OK.
    The new role appears in the right pane.

NOTE

The nsRoleDN attribute is an operational attribute and must be explicitly requested in the search command in the list of search attributes. For example:
ldapsearch ... args ... “(uid=scarter)” \* nsRole nsRoleDN
The Directory Server Console automatically shows the nsRoleDN attribute.

5.1.2.3. Creating a Nested Role

Nested roles are roles that contain other roles. Before it is possible to create a nested role, another role must exist. When a nested role is created, the Console displays a list of the roles available for nesting. The roles nested within the nested role are specified using the nsRoleDN attribute.
To create and add members to a nested role, do the following:
  1. Click Members in the left pane.
    A search dialog box appears briefly.
  2. In the right pane, select Nested Role.
  3. Click Add to add roles to the list. The members of the nested role are members of other existing roles.
    The Role Selector dialog box opens.
  4. Select a role from the Available roles list, and click OK.
  5. Click OK to save the new role.
    The new role appears in the right pane.

NOTE

The nsRoleDN attribute is an operational attribute and must be explicitly requested in the search command in the list of search attributes. For example:
ldapsearch ... args ... “(uid=scarter)” \* nsRole nsRoleDN
The Console will automatically show the nsRoleDN attribute.

5.1.3. Managing Roles Using the Command-Line

Roles inherit from the ldapsubentry object class, which is defined in the ITU X.509 standard. In addition, each type of role has two specific object classes that inherit from the nsRoleDefinition object class. Once a role is created, members are assigned to it as follows:
  • Members of a managed role have the nsRoleDN attribute in their entry.
  • Members of a filtered role are entries that match the filter specified in the nsRoleFilter attribute.
  • Members of a nested role are members of the roles specified in the nsRoleDN attributes of the nested role definition entry.
Table 5.1, “Object Classes and Attributes for Roles” lists the object classes and attributes associated with each type of role.
Role Type Object Classes Attributes
Managed Role
nsSimpleRoleDefinition
nsManagedRoleDefinition
description (optional)
Filtered Role
nsComplexRoleDefinition
nsFilteredRoleDefinition
nsRoleFilter
Description (optional)
Nested Role
nsComplexRoleDefinition
nsNestedRoleDefinition
nsRoleDN
Description (optional)
Table 5.1. Object Classes and Attributes for Roles

The attributes nsRole and nsRoleDN are operational attributes. This means that they are not present in the schema of the entry and may be added to any entry, regardless of schema. This also means that these attributes must be explicitly requested in the search attributes list in search requests. For example, this ldapsearch command lists all of the roles (values of nsRole), all of the managed roles (values of nsRoleDN), and all of the regular attributes in the entry matched by uid=scarter.
ldapsearch ... args ... “(uid=scarter)” \* nsRole nsRoleDN
Similarly for the role definition entries, they are operational entries and are not returned by default with regular searches. This means that if roles are defined under the ou=People,dc=example,dc=com subtree, for example, the following ldapsearch command will not return the role definitions for any entry:
ldapsearch -s sub -b ou=People,dc=example,dc=com “(objectclass=*)”
To see the role definitions entries, use the special search filter "(objectclass=ldapSubEntry)"with ldapsearch. The special filter can be added to any other search filter, using OR (|):
ldapsearch -s sub -b ou=People,dc=example,dc=com “(|(objectclass=*)(objectclass=ldapSubEntry))”
This search shows all regular entries in addition to role definition entries in the ou=People,dc=example,dc=com subtree. The Console automatically shows all of the role entries.
Not every role is suitable for use in a security context. When creating a new role, consider how easily the role can be assigned to and removed from an entry. Sometimes it is appropriate for users to be able to add or remove themselves easily from a role. For example, if there is an interest group role called Mountain Biking, interested users should be able to add themselves or remove themselves easily.
However, in some security contexts, it is inappropriate to have such open roles. Consider account inactivation roles. By default, account inactivation roles contain ACIs defined for their suffix. When creating a role, the server administrator decides whether a user can assign themselves to or remove themselves from the role.
For example, user A possesses the managed role, MR. The MR role has been locked using account inactivation. This means that user A cannot bind to the server because the nsAccountLock attribute is computed as true for that user. However, suppose the user was already bound and noticed that he is now locked through the MR role. If there are no ACIs preventing him, the user can remove the nsRoleDN attribute from his entry and unlock himself.
To prevent users from removing the nsRoleDN attribute, use the following ACIs depending upon the type of role being used.
  • Managed roles. For entries that are members of a managed role, use the following ACI to prevent users from unlocking themselves by removing the appropriate nsRoleDN:
    aci: (targetattr="nsRoleDN") (targattrfilters= add=nsRoleDN:(!(nsRoleDN=cn=AdministratorRole,
         dc=example,dc=com)), del=nsRoleDN:(!(nsRoleDN=cn=nsManagedDisabledRole,dc=example,dc=com))) 
         (version3.0;aci allow mod of nsRoleDN by self but not to critical values; allow(write) 
         userdn=ldap:///self;)
    
  • Filtered roles. The attributes that are part of the filter should be protected so that the user cannot relinquish the filtered role by modifying an attribute. The user should not be allowed to add, delete, or modify the attribute used by the filtered role. If the value of the filter attribute is computed, then all attributes that can modify the value of the filter attribute should be protected in the same way.
  • Nested roles. A nested role is comprised of filtered and managed roles, so the above points should be considered for each of the roles that comprise the nested role.