13.6. Defining Automatic Group Membership for Users and Hosts
13.6.1. How Automatic Group Membership Works in IdM Copy linkLink copied to clipboard!
13.6.1.1. What Automatic Group Membership Is Copy linkLink copied to clipboard!
- Divide employees' user entries into groups based on the employees' manager, location, or any other attribute.
- Divide hosts based on their class, location, or any other attribute.
- Add all users or all hosts to a single global group.
13.6.1.2. Benefits of Automatic Group Membership Copy linkLink copied to clipboard!
- Reduced overhead of managing group membership manually
- With automatic group membership, the administrator no longer assigns users and hosts to groups manually.
- Improved consistency in user and host management
- With automatic group membership, users and hosts are assigned to groups based on strictly defined and automatically evaluated criteria.
- Easier management of group-based settings
- Various settings are defined for groups and then applied to individual group members, for example
sudorules,automount, or access control. When using automatic group membership, users and hosts are automatically added to specified groups, which makes managing group-based settings easier.
13.6.1.3. Automember Rules Copy linkLink copied to clipboard!
- Inclusive conditions
- When a user or host entry meets an inclusive condition, it will be included in the group.
- Exclusive conditions
- When a user or host entry meets an exclusive condition, it will not be included in the group.
13.6.2. Adding an Automember Rule Copy linkLink copied to clipboard!
- The IdM web UI, see the section called “Web UI: Add an Automember Rule”
- The command line, see the section called “Command Line: Add an Automember Rule”
- All entries created in the future will become members of the specified group. If an entry meets conditions specified in multiple automember rules, it will be added to all the corresponding groups.
- Existing entries will not become members of the specified group. See Section 13.6.3, “Applying Automember Rules to Existing Users and Hosts” for more information.
Web UI: Add an Automember Rule
- Select
or . - Click .
- In the Automember rule field, select the group to which the rule will apply. Click .
- Define one or more inclusive and exclusive conditions. See Section 13.6.1.3, “Automember Rules” for details.
- In the Inclusive or Exclusive sections, click .
- In the Attribute field, select the required attribute.
- In the Expression field, define the regular expression.
- Click .
For example, the following condition targets all users with any value (.*) in their user login attribute (uid).Figure 13.5. Adding Automember Rule Conditions
Command Line: Add an Automember Rule
- Use the ipa automember-add command to add an automember rule. When prompted, specify:
Automember rule, which matches the target group name.Grouping Type, which specifies whether the rule targets a user group or a host group. To target a user group, entergroup. To target a host group, enterhostgroup.
For example, to add an automember rule for a user group nameduser_group:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Define one or more inclusive and exclusive conditions. See Section 13.6.1.3, “Automember Rules” for details.
- To add a condition, use the ipa automember-add-condition command. When prompted, specify:
Automember rule, which matches the target group name.Attribute Key, which specifies the entry attribute to which the filter will apply. For example,managerfor users.Grouping Type, which specifies whether the rule targets a user group or a host group. To target a user group, entergroup. To target a host group, enterhostgroup.Inclusive regexandExclusive regex, which specify one or more conditions as regular expressions. If you only want to specify one condition, press Enter when prompted for the other.
For example, the following condition targets all users with any value (.*) in their user login attribute (uid).Copy to Clipboard Copied! Toggle word wrap Toggle overflow - To remove a condition, use the ipa automember-remove-condition command.
Example 13.5. Command Line: Creating an Automember Rule to Add All Entries to a Single Group
cn or fqdn, you can ensure that all users or hosts created in the future will be added to a single group.
- Create the group, such as a host group named
all_hosts. See Section 13.2, “Adding and Removing User or Host Groups”. - Add an automember rule for the new host group. For example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Add an inclusive condition that targets all hosts. In the following example, the inclusive condition targets hosts that have any value (
.*) in thefqdnattribute:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
all_hosts group.
Example 13.6. Command Line: Creating an Automember Rule for Synchronized AD Users
ntUser object class. By creating an automember condition that targets all users with ntUser in their objectclass attribute, you can ensure that all synchronized AD users created in the future will be included in a common group for AD users.
- Create a user group for the AD users, such as
ad_users. See Section 13.2, “Adding and Removing User or Host Groups”. - Add an automember rule for the new user group. For example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Add an inclusive condition to filter the AD users. In the following example, the inclusive condition targets all users that have the
ntUservalue in theobjectclassattribute:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
ad_users user group.
13.6.3. Applying Automember Rules to Existing Users and Hosts Copy linkLink copied to clipboard!
Web UI: Rebuild Automatic Membership for Existing Entries
- Select
or . - Click
. Figure 13.6. Rebuilding Automatic Membership for All Users or Hosts
- Select
or , and click on the required user login or host name. - Click
. Figure 13.7. Rebuilding Automatic Membership for a Single User or Host
Command Line: Rebuild Automatic Memberhips for Existing Entries
ipa automember-rebuild --type=group
$ ipa automember-rebuild --type=group
--------------------------------------------------------
Automember rebuild task finished. Processed (9) entries.
--------------------------------------------------------
ipa automember-rebuild --users=user1 --users=user2
$ ipa automember-rebuild --users=user1 --users=user2
--------------------------------------------------------
Automember rebuild task finished. Processed (2) entries.
--------------------------------------------------------
13.6.4. Configuring a Default Automember Group Copy linkLink copied to clipboard!
- Use the ipa automember-default-group-set command to configure a default automember group. When prompted, specify:
Default (fallback) Group, which specifies the target group name.Grouping Type, which specifies whether the target is a user group or a host group. To target a user group, entergroup. To target a host group, enterhostgroup.
For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - To verify that the group is set correctly, use the ipa automember-default-group-show command. The command displays the current default automember group. For example:
ipa automember-default-group-show
$ ipa automember-default-group-show Grouping Type: group Default (fallback) Group: cn=default_user_group,cn=groups,cn=accounts,dc=example,dc=comCopy to Clipboard Copied! Toggle word wrap Toggle overflow