Questo contenuto non è disponibile nella lingua selezionata.
Chapter 12. Deploying Identity Management in a controlled environment: a proof of concept
Explore basic features and concepts of Identity Management in RHEL (IdM) in a safe, isolated sandbox environment.
Gain hands-on experience with the following:
- Installing a minimal IdM cluster consisting of an IdM server, replica, and client by using Ansible automation.
-
Configuring authentication and various access controls through the IdM Web UI, focusing on host-based access control, role-based access control, and
sudorules. The IdM Web UI is intuitive and so provides the best starting point for interacting with IdM. - Performing the same authentication and access control configurations with Ansible, discovering the simplicity, automation, and scalability that Ansible playbooks bring to system management.
Deploying Identity Management in a controlled environment: a proof of concept is designed to help you test and familiarize yourself with various IdM capabilities, preparing you for deployment in a production environment. It is not intended for direct use in production.
12.1. Installing RHEL Identity Management in a controlled environment Copia collegamentoCollegamento copiato negli appunti!
Learn how to perform a basic installation of Identity Management (IdM) in RHEL for testing prior to production deployment. You install the software using an Ansible playbook, which ensures convenience and repeatability.
Prerequisites
- A system running Red Hat Enterprise Linux (RHEL) with 16 GB of RAM or more.
- A RHEL subscription.
Terminology and assumptions
-
rootis the account on the managed nodes that is used to perform the actions defined in the Ansible playbooks. - controller.idm.example.com is the name of the Ansible control node, that is the host on which the Ansible playbooks are stored and run.
- server.idm.example.com, replica.idm.example.com, and client.idm.example.com are the managed nodes on which Identity Management in RHEL is installed and configured.
- The control node and the managed nodes are running on virtual machines. All these virtual machines are installed on one physical system that runs RHEL.
12.1.1. Installing RHEL on virtual machines for IdM as a proof of concept Copia collegamentoCollegamento copiato negli appunti!
Learn how to install RHEL on your virtual machines so that you can later install an IdM cluster on them using the ansible-freeipa RPM collection.
Prerequisites
- You have downloaded the latest ISO image of RHEL 8, 9 or 10 from the Red Hat Customer Portal.
Procedure
Use the ISO image to install a new VM for the controller system. For details, see Interactively installing RHEL from installation media. During the installation, pay attention to the following:
- If you are using the Virtual Machine Manager (VMM) to install your VMs, name the hosts in the controller, server, replica, and client, so that you can match the names in the VMM UI to the names of the hosts on the CLI.
- Reserve at least 4 GB of RAM on the VMs on which you are installing an IdM server and replica. 1 GB is enough for a client system.
- Reserve 20 GB for the storage on the IdM server and IdM replica.
- Select Install, not Test and Install.
-
Create a local
ansibleuser on the controller during the installation. -
Set an easy-to-remember password for the
ansibleuser, for example 12345. - In the Root password section, enter an easy-to-remember password, for example 1234.
-
Check the
Allow root SSH login with passwordcheck box.
After the installation is complete, configure the host name for the controller VM:
-
On the controller VM CLI, enter
nmtui. - Using the Down Arrow key, select Set system hostname.
In the newly opened window, enter controller.idm.example.com.
The host name must be a fully qualified domain name, such as controller.idm.example.com. For more information, see Meeting DNS host name and DNS requirements for IdM in Installing Identity Management.
-
Using the Down and Right Arrow keys, select
OK. -
Confirm the new host name by clicking
OKagain. -
In the higher-level interface, select
OKandQuitby using the Down and Right Arrow keys. [Optional] To verify the host name, use the
hostnameutility on the system:hostname
# hostnameCopy to Clipboard Copied! Toggle word wrap Toggle overflow controller.idm.example.com
controller.idm.example.comCopy to Clipboard Copied! Toggle word wrap Toggle overflow The output of
hostnamemust not belocalhostorlocalhost6.
-
On the controller VM CLI, enter
- Repeat the previous steps for all the other VMs: server, replica, and client.
Configure reciprocal logins to individual systems using host names instead of IP addresses:
On the controller CLI, enter:
ip a
# ip aCopy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note the IP address that starts with 192.168.X.X.
- Do the same on all the other virtual hosts.
On controller, add the host names and IP addresses of all the virtual systems to
/etc/hostsfile. The file can look as follows:Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Update the
/etc/hostsfile on your physical system in the same way.
Ensure that the operating system on controller is up to date:
SSH from your local system to the
rootaccount on controller:your-physical-system]$ ssh root@controller
your-physical-system]$ ssh root@controllerCopy to Clipboard Copied! Toggle word wrap Toggle overflow Register the controller virtual machine with Red Hat’s subscription management service:
subscription-manager register --username <your_user_name> --password <your_password>
# subscription-manager register --username <your_user_name> --password <your_password>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Ensure that you are using the latest packages:
yum update
# yum updateCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Repeat the previous steps for all the other VMs.
Verification
Test connectivity between your physical system and one of the virtual systems by using its fully-qualified domain name (
FQDN) or short name:your-physical-system]$ ping controller
your-physical-system]$ ping controllerCopy to Clipboard Copied! Toggle word wrap Toggle overflow PING controller.idm.example.com (192.168.122.86) 56(84) bytes of data. 64 bytes from controller.idm.example.com (192.168.122.86): icmp_seq=1 ttl=64 time=0.353 ms 64 bytes from controller.idm.example.com (192.168.122.86): icmp_seq=2 ttl=64 time=0.398 ms 64 bytes from controller.idm.example.com (192.168.122.86): icmp_seq=3 ttl=64 time=0.453 ms
PING controller.idm.example.com (192.168.122.86) 56(84) bytes of data. 64 bytes from controller.idm.example.com (192.168.122.86): icmp_seq=1 ttl=64 time=0.353 ms 64 bytes from controller.idm.example.com (192.168.122.86): icmp_seq=2 ttl=64 time=0.398 ms 64 bytes from controller.idm.example.com (192.168.122.86): icmp_seq=3 ttl=64 time=0.453 msCopy to Clipboard Copied! Toggle word wrap Toggle overflow
12.1.2. Preparing the control node for installing IdM using Ansible playbooks Copia collegamentoCollegamento copiato negli appunti!
Learn how to prepare the Ansible control node for installing and configuring IdM on the managed nodes.
Prerequisites
Procedure
On the controller system, create an
SSHpublic and private key:ssh-keygen
[ansible@controller]$ ssh-keygenCopy to Clipboard Copied! Toggle word wrap Toggle overflow Generating public/private rsa key pair. Enter file in which to save the key (/home/ansible/.ssh/id_rsa): Enter passphrase (empty for no passphrase): [Enter] Enter same passphrase again: [Enter] ...
Generating public/private rsa key pair. Enter file in which to save the key (/home/ansible/.ssh/id_rsa): Enter passphrase (empty for no passphrase): [Enter] Enter same passphrase again: [Enter] ...Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the suggested default location for the key file. As this is a PoC environment, leave the passphrase empty.
Create the
~/.ansible.cfgfile with the following content:[defaults] inventory = /home/ansible/inventory remote_user = root
[defaults] inventory = /home/ansible/inventory remote_user = rootCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteSettings in the
~/.ansible.cfgfile have a higher priority and override settings from the global/etc/ansible/ansible.cfgfile.With these settings, Ansible performs the following actions:
- Manages hosts in the specified inventory file.
-
Uses the account set in the
remote_userparameter when it establishesSSHconnections to managed nodes.
Create an
~/inventoryfile in INI or YAML format that lists the host names of managed hosts and the values for the required installation variables:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create an
install-cluster.ymlfile with the following content:Copy to Clipboard Copied! Toggle word wrap Toggle overflow The playbook contains three plays:
- The first one installs the primary IdM server.
- The second one installs an IdM client.
-
The third one installs an IdM replica. The
serial: 1directive instructs Ansible to deploy only one replica at a time against the same IdM server.
Using
rootprivileges, install theansible-freeipacollection:dnf install ansible-freeipa
[root@controller]# dnf install ansible-freeipaCopy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow
12.1.3. Preparing the managed nodes for installing IdM using Ansible playbooks Copia collegamentoCollegamento copiato negli appunti!
Learn how to prepare your virtual machines as Ansible managed nodes so that they can be used for the installation of an IdM deployment.
Prerequisites
Procedure
Install the
rootuser’sSSHpublic key on to therootaccount on the server managed node:Log in to the control node as
root, and copy theSSHpublic key to therootaccount on server:ssh-copy-id root@server.idm.example.com
[root@controller]$ ssh-copy-id root@server.idm.example.comCopy to Clipboard Copied! Toggle word wrap Toggle overflow /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/ansible/.ssh/id_rsa.pub" The authenticity of host 'server.idm.example.com (192.168.122.42)' can't be established. ECDSA key fingerprint is SHA256:9bZ33GJNODK3zbNhybokN/6Mq7hu3vpBXDrCxe7NAvo.
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/ansible/.ssh/id_rsa.pub" The authenticity of host 'server.idm.example.com (192.168.122.42)' can't be established. ECDSA key fingerprint is SHA256:9bZ33GJNODK3zbNhybokN/6Mq7hu3vpBXDrCxe7NAvo.Copy to Clipboard Copied! Toggle word wrap Toggle overflow When prompted, connect by entering yes:
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Are you sure you want to continue connecting (yes/no/[fingerprint])? yesCopy to Clipboard Copied! Toggle word wrap Toggle overflow /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keysCopy to Clipboard Copied! Toggle word wrap Toggle overflow When prompted, enter the password of
rooton server:root@server.idm.example.com's password: 1234
root@server.idm.example.com's password: 1234Copy to Clipboard Copied! Toggle word wrap Toggle overflow Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'root@server.idm.example.com'" and check to make sure that only the key(s) you wanted were added.
Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'root@server.idm.example.com'" and check to make sure that only the key(s) you wanted were added.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the
SSHconnection by remotely executing a command on server:ssh root@server.idm.example.com whoami
[root@controller]$ ssh root@server.idm.example.com whoamiCopy to Clipboard Copied! Toggle word wrap Toggle overflow root
rootCopy to Clipboard Copied! Toggle word wrap Toggle overflow
- Repeat on all the other managed nodes, replica and client.
Verification
Verify that you can execute commands from the control node on an all managed nodes:
ansible all -m ping
[root@controller]$ ansible all -m pingCopy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow The hard-coded all group dynamically contains all hosts listed in the inventory file.
Verify that privilege escalation works correctly. Use the Ansible
commandmodule to run thewhoamiutility on all managed nodes:ansible all -m command -a whoami
[root@controller]$ ansible all -m command -a whoamiCopy to Clipboard Copied! Toggle word wrap Toggle overflow Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the command returns
root, you configuredsudoon the managed nodes correctly.
12.1.4. Installing an IdM cluster in a virtual machine Copia collegamentoCollegamento copiato negli appunti!
Learn how to install the IdM primary server, client and replica on your virtual machines by using a single Ansible command on the control node.
Prerequisites
Procedure
Install the IdM cluster:
ansible-playbook -i inventory -vv install-cluster.yml
[root@controller]$ ansible-playbook -i inventory -vv install-cluster.ymlCopy to Clipboard Copied! Toggle word wrap Toggle overflow ImportantIf you encounter recurring errors when installing the server, client, or replica, it’s best to wipe the host and perform a clean reinstallation rather than attempt to troubleshoot a failed setup.
12.2. Exploring RHEL Identity Management in a controlled environment Copia collegamentoCollegamento copiato negli appunti!
12.2.1. Accessing the IdM Web UI in a PoC setup Copia collegamentoCollegamento copiato negli appunti!
Learn how to log in to the IdM Web UI with a password for the first time.
Procedure
Type the URL of the IdM server or replica into the browser address bar:
https://replica.idm.example.com
https://replica.idm.example.comCopy to Clipboard Copied! Toggle word wrap Toggle overflow This opens the IdM Web UI login screen in your browser.
On the Web UI login screen, enter the
adminin to the Login field. EnterSecret123in to the Password field.
Click .
After the successful login, you can start configuring the IdM server.
12.2.2. Adding an IdM user using the IdM Web UI in the PoC setup Copia collegamentoCollegamento copiato negli appunti!
Learn how to use the IdM Web UI to add an IdM user and set the IdM user password.
Procedure
-
Log in to the IdM Web UI as IdM
admin. For details, see Accessing the IdM Web UI in a PoC setup. -
Go to Users
Active Users tab. - Click the + Add icon.
Optional: In the User login field, add a login name, for example
idmuser01.If you leave it empty, the IdM server creates the login name in the following pattern: The first letter of the first name and the surname. The whole login name can have up to 32 characters.
-
Enter First name and Last name of the new user, for example
AliceandAcme. Optional: In the Password and Verify password fields, enter the user password and confirm it, ensuring they both match.
This is an initial, temporary password. The user will be asked to reset the password at the first login.
Click the Add button.
At this point, you can see the user account in the Active Users table.
If you click on the user name, you can edit advanced settings, such as adding a phone number, address, or occupation.
12.2.3. Adding multiple IdM users by using an Ansible playbook in a PoC setup Copia collegamentoCollegamento copiato negli appunti!
Automating user management with Ansible is more efficient than using the Web UI approach described in Adding an IdM user using an Ansible playbook in a PoC setup.
Learn how to use a single Ansible playbook to add multiple IdM users. Because of Ansible idempotence, if any of the users already exists in IdM, the script skips them.
Prerequisites
- You are logged in to controller.idm.example.com as the ansible user.
Procedure
In your ~/MyPlaybooks directory, create an add-multiple-users.yml Ansible playbook file with the data of the users whose presence you want to ensure in IdM, for example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow You must use the following options to add a user:
- name: the login name
- first: the first name string
- last: the last name string
The rest is optional.
You can see the full list of available user options in the
/usr/share/ansible/collections/ansible_collections/freeipa/ansible_freeipa/README-user.mdMarkdown file.[Optional] Clear the SSSD cache to improve the performance of the
ansible-playbookcommand:sudo sss_cache -E
$ sudo sss_cache -ECopy to Clipboard Copied! Toggle word wrap Toggle overflow [sudo] password for ansible:
[sudo] password for ansible:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run the playbook:
ansible-playbook -i inventory add-multiple-users.yml
$ ansible-playbook -i inventory add-multiple-users.ymlCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Next steps
Log into the IdM Web UI as
idmuser01:- Use "Password123", the temporary password configured by the Ansible script above, as idmuser01 password.
- Set a new password.
-
Repeat for
idmuser03.
Additional resources
12.2.4. Host-based access control rules in IdM Copia collegamentoCollegamento copiato negli appunti!
Host-based access control (HBAC) rules define which users or user groups can access which hosts or host groups by using which services or services in a service group. As a system administrator, you can use HBAC rules to achieve the following goals:
- Limit access to a specified system in your domain to members of a specific user group.
- Allow only a specific service to be used to access systems in your domain.
By default, IdM is configured with a default HBAC rule named allow_all, which means universal access to every host for every user via every relevant service in the entire IdM domain.
You can fine-tune access to different hosts by replacing the default allow_all rule with your own set of HBAC rules. For centralized and simplified access control management, you can apply HBAC rules to user groups, host groups, or service groups instead of individual users, hosts, or services.
12.2.5. Using the IdM Web UI to enable an IdM user to access an IdM client remotely in a PoC setup Copia collegamentoCollegamento copiato negli appunti!
Learn how to use the Identity Management (IdM) Web UI to define a host-based access rule (HBAC) rule to allow a set of RHEL IdM users to access IdM clients using the SSH protocol. The example below describes how to:
-
Enable the IdM user
idmuser01to access an IdM clientclient.idm.example.comremotely by using theSSHprotocol. -
Disable the IdM user
idmuser03from using theSSHprotocol to access the IdM clientclient.idm.example.com.
Prerequisites
- The idmuser01 and idmuser03 users exist in IdM. See Adding an IdM user using the IdM Web UI in the PoC setup for details.
-
You are logged in to the IdM Web UI as IdM
admin.
Procedure
Create and customize the
allow_remote_accessrule:-
Navigate to Policy > Host Based Access Control > HBAC Rules and then click Add. Set
allow_remote_accessas the name of the rule and click Add and Edit. -
In the Who section, verify that Specified Users and Groups is selected, and then click Add. Select the
idmuser01user, and then click>to move the user to the Prospective column. Click Add. -
In the Accessing section, verify that Specified Hosts and Groups is selected, and then click Add. Select the
client.idm.example.commachine and click>to move it to the Prospective column. Click Add. -
In the Via Service section, verify that Specified Services and Groups is selected, and then click Add. Select the
ftp,sshd, andvsftpdservices from the Available column and click>to move them to the Prospective column. Click Add. - Return to the HBAC rules list by clicking HBAC Rules at the top of the window.
-
Navigate to Policy > Host Based Access Control > HBAC Rules and then click Add. Set
For security reasons, modify the
allow_allrule so that only IdMadminshave universal access to every host via every relevant service in the entire IdM domain:- Navigate to Policy > Host Based Access Control > HBAC Rules.
-
Click the
allow_allrule. -
In the Who section, verify that Specified Users and Groups is selected, and then click Add. Select the
adminsgroup, and then click>to move it to the Prospective column. Click Add.
Verification
Navigate to Policy > Host Based Access Control > HBAC Test. Select the parameters of the test according to the following table:
Expand List Select WHO
idmuser03
ACCESSING
client.idm.example.com
VIA SERVICE
sshd
RULES
allow_remote_access
-
On the Run Test tab, click Run Test to run the simulation. On the right side of the Run Test tab, the console shows an ACCESS DENIED message because the
idmuser03user is not a member of the HBAC rule. Now select the test parameters according to the following table:
Expand List Select WHO
idmuser01
ACCESSING
client.idm.example.com
VIA SERVICE
sshd
RULES
allow_remote_access
-
On the Run Test tab, click Run Test to run the simulation. On the right side of the Run Test tab, the console shows an ACCESS GRANTED message because the
idmuser01user is a member of the HBAC rule. Open a terminal and log in to the client machine as the
idmuser03user. The connection fails because the user is not a member of the rule:ssh idmuser03@client Connection closed by 172.25.250.11 port 22
$ ssh idmuser03@client Connection closed by 172.25.250.11 port 22Copy to Clipboard Copied! Toggle word wrap Toggle overflow Try to log in to the client machine as the
idmuser01user. The connection is successful because the user is a member of the rule:ssh idmuser01@client ...output omitted... [idmuser01@client /]$*
$ ssh idmuser01@client ...output omitted... [idmuser01@client /]$*Copy to Clipboard Copied! Toggle word wrap Toggle overflow
12.2.6. Using Ansible to enable an IdM user to access an IdM client remotely in a PoC setup Copia collegamentoCollegamento copiato negli appunti!
Automating host-based access control configuration with Ansible is more efficient than using the Web UI approach described in Adding multiple IdM users by using an Ansible playbook in a PoC setup.
Learn how to ensure the presence of a host-based access control (HBAC) rule in Identity Management (IdM) using an Ansible playbook. The example below describes how to:
-
Enable the IdM user
idmuser01to access an IdM clientclient.idm.example.comremotely by using theSSHprotocol. -
Disable the IdM user
idmuser03from using theSSHprotocol to access the IdM clientclient.idm.example.com.
Prerequisites
- The idmuser01 and idmuser03 users exist in IdM. See Adding an IdM user using the IdM Web UI in the PoC setup for details.
- You are logged in to controller.idm.example.com as the ansible user.
Procedure
In your ~/MyPlaybooks/ directory, create an
ensure-new-hbacrule-present.ymlAnsible playbook file with the content below that defines the desired HBAC policy:Copy to Clipboard Copied! Toggle word wrap Toggle overflow If an HBAC rule already exists and you are only modifying it, you must set the
actionoption tomember. Otherwise the playbook fails. In the example, theEnsure allow_all rule is modified so that only admins are memberstask modifies theallow_allbuilt-in rule, and therefore, requiresaction: member.TipTo avoid writing your HBAC-related playbooks from scratch, you can copy and modify the sample playbooks in the
/usr/share/ansible/collections/ansible_collections/freeipa/ansible_freeipa/playbooks/hbacrule/directory.These samples correspond to the
freeipa_hbacsvc,freeipa_hbacsvcgroup, andfreeipa_hbacrulemodules, for which you can find README files in the/usr/share/ansible/collections/ansible_collections/freeipa/ansible_freeipadirectory.Run the playbook:
ansible-playbook -i inventory ensure-new-hbacrule-present.yml
$ ansible-playbook -i inventory ensure-new-hbacrule-present.ymlCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
-
Log in to the IdM Web UI as IdM
admin. In the Password field, enter Secret123. Navigate to Policy > Host Based Access Control > HBAC Test. Select the parameters of the test according to the following table:
Expand List Select WHO
idmuser03
ACCESSING
client.idm.example.com
VIA SERVICE
sshd
RULES
allow_remote_access
-
On the Run Test tab, click Run Test to run the simulation. On the right side of the Run Test tab, the console shows an ACCESS DENIED message because the
idmuser03user is not a member of the HBAC rule. Now select the test parameters according to the following table:
Expand List Select WHO
idmuser01
ACCESSING
client.idm.example.com
VIA SERVICE
sshd
RULES
allow_remote_access
-
On the Run Test tab, click Run Test to run the simulation. On the right side of the Run Test tab, the console shows an ACCESS GRANTED message because the
idmuser01user is a member of the HBAC rule. Open a terminal and log in to the client machine as the
idmuser03user. The connection fails because the user is not a member of the rule:ssh idmuser03@client (idmuser03@client) Password: RedHat123& Connection closed by 172.25.250.11 port 22
$ ssh idmuser03@client (idmuser03@client) Password: RedHat123& Connection closed by 172.25.250.11 port 22Copy to Clipboard Copied! Toggle word wrap Toggle overflow Try to log in to the client machine as the
idmuser01user. The connection is successful because the user is a member of the rule:ssh idmuser01@client (idmuser01@client) Password: Password123 ...output omitted... [idmuser01@client /]$*
$ ssh idmuser01@client (idmuser01@client) Password: Password123 ...output omitted... [idmuser01@client /]$*Copy to Clipboard Copied! Toggle word wrap Toggle overflow
12.2.7. Role-based access control in RHEL IdM Copia collegamentoCollegamento copiato negli appunti!
Learn more about role-based access control (RBAC) in Identity Management (IdM). RBAC is a security feature that restricts access to authorized users. You can define roles with specific permissions and then assign those roles to users.
Role-based access control is composed of three parts:
- Permissions grant the right to perform a specific task such as adding or deleting users, modifying a group, and enabling read-access.
- Privileges combine permissions, for example all the permissions needed to add a new user.
- Roles grant a set of privileges to users, user groups, hosts or host groups.
12.2.8. Enabling an IdM user to manage IdM groups and group membership using the IdM Web UI in the PoC setup Copia collegamentoCollegamento copiato negli appunti!
The built-in Group Administrators privilege in RHEL Identity Management (IdM) contains the following permissions:
- Add Groups
- Modify External Group Membership
- Modify Group Membership
- Modify Groups
- Remove Groups
Learn how to use the IdM Web UI to assign a role that grants the Group Administrator privilege to the IdM user idmuser01. As a result, idmuser01 can add the idmuser03 to the built-in editors group.
Prerequisites
- The idmuser01 and idmuser03 IdM users exist. See Adding an IdM user using the IdM Web UI in the PoC setup for details.
Procedure
-
Log in as IdM
adminto the IdM Web UI. Create the
groupadminrole:- Navigate to IPA Server > Role-Based Access Control > Roles and then click Add.
- In the Role name field, enter groupadmin. In the Description field, enter Group Administrator. Click Add and Edit.
Add the
idmuser01user to the role:- On the Role: groupadmin page, ensure that you are on the Users tab, and click Add.
-
In the Add users into role 'groupadmin' window, check the box next to
idmuser01and click > to move the user from the Available to the Prospective column. - Click Add.
Add the
Group Administratorsprivilege to the role:- On the Role: groupadmin page, ensure that you are on the Privileges tab, and click Add.
- In the Add role 'groupadmin' into privileges window, check the box next to Group Administrators and click > to move the user from the Available to the Prospective column.
- Click Add.
Verification
Verify that
idmuser01is assigned to thegroupadminrole:-
In the IdM Web UI, navigate as IdM
adminto Identity > Users. -
Click
idmuser01. Click Roles.
You can see that
groupadminis listed among the roles.
-
In the IdM Web UI, navigate as IdM
Verify that
idmuser01can assign group membership toidmuser03:-
Log in to the IdM Web UI as
idmuser01. - Navigate to Identity > Users.
-
Click
idmuser03. - Click User Groups.
- Click Add.
Select the
editorsgroup and then click>to move it to the Prospective column. Click Add.In the user profile, you can now see that
idmuser03is a member of theeditorsgroup.
-
Log in to the IdM Web UI as
Additional resources
12.2.9. Enabling an IdM user to manage IdM groups and group membership using an Ansible playbook in the PoC setup Copia collegamentoCollegamento copiato negli appunti!
Automating role-based access control configuration with Ansible is more efficient than using the Web UI approach described in Enabling an IdM user to manage IdM groups and group membership using the IdM Web UI in the PoC setup.
Learn how to use the role ansible-freeipa module in an Ansible playbook to assign a role that grants the IdM user idmuser01 the same Group Administrator privilege as configured using the Web UI method. As a result, idmuser01 can add the idmuser03 to the built-in editors group.
Prerequisites
- The idmuser01 and idmuser03 IdM users exist. See Adding an IdM user using the IdM Web UI in the PoC setup for details.
- You are logged in to controller.idm.example.com as the ansible user.
Procedure
In your ~/MyPlaybooks/ directory, create an assign-group-administrator-privilege-to-idmuser01.yml Ansible playbook file with the content below that defines the desired RBAC policy:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow You can see the full list of available options in the
/usr/share/ansible/collections/ansible_collections/freeipa/ansible_freeipa/README-role.mdfile.Run the playbook:
ansible-playbook -i inventory assign-group-administrator-privilege-to-idmuser01.yml
$ ansible-playbook -i inventory assign-group-administrator-privilege-to-idmuser01.ymlCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Verify that
idmuser01is assigned to thegroupadminrole:-
In the IdM Web UI, navigate as IdM
adminto Identity > Users. -
Click
idmuser01. Click Roles.
You can see that
groupadminis listed among the roles.
-
In the IdM Web UI, navigate as IdM
Verify that
idmuser01can assign group membership toidmuser03:-
Log in to the IdM Web UI as
idmuser01. - Navigate to Identity > Users.
-
Click
idmuser03. - Click User Groups.
- Click Add.
Select the
editorsgroup and then click>to move it to the Prospective column. Click Add.In the user profile, you can now see that
idmuser03is a member of theeditorsgroup.
-
Log in to the IdM Web UI as
12.2.10. Sudo access on an IdM client Copia collegamentoCollegamento copiato negli appunti!
System administrators can grant sudo access to allow non-root users to execute administrative commands that are normally reserved for the root user. Consequently, when users need to perform an administrative command normally reserved for the root user, they precede that command with sudo. After entering their password, the command is executed as if they were the root user. To execute a sudo command as another user or group, such as a database service account, you can configure a RunAs alias for a sudo rule.
If a Red Hat Enterprise Linux (RHEL) host is enrolled as an Identity Management (IdM) client, you can specify sudo rules defining which IdM users can perform which commands on the host in the following ways:
-
Locally in the
/etc/sudoersfile - Centrally in IdM
You can create a central sudo rule for an IdM client using the command line (CLI) and the IdM Web UI.
You can also configure password-less authentication for sudo using the Generic Security Service Application Programming Interface (GSSAPI), the native way for UNIX-based operating systems to access and authenticate Kerberos services. You can use the pam_sss_gss.so Pluggable Authentication Module (PAM) to invoke GSSAPI authentication via the SSSD service, allowing users to authenticate to the sudo command with a valid Kerberos ticket.
12.2.11. Granting sudo access to an IdM user on an IdM client using the IdM Web UI Copia collegamentoCollegamento copiato negli appunti!
In Identity Management (IdM), you can grant sudo access for a specific command to an IdM user account on a specific IdM host. First, add a sudo command and then create a sudo rule for one or more commands.
Complete this procedure to create the idmuser01_reboot sudo rule to grant the idmuser01 account the permission to run the /usr/sbin/reboot command on the client.idm.example.com machine, or client.
Prerequisites
-
You are logged in to the IdM Web UI as
admin. -
You have created a user account for
idmuser01in IdM and unlocked the account by creating a password for the user. For details on adding a new IdM user using the command line, see Adding users using the command line. -
No local
idmuser01account is present on theclienthost. Theidmuser01user is not listed in the local/etc/passwdfile. - The client.idm.example.com host exists in IdM.
Procedure
Add the
/usr/sbin/rebootcommand to the IdM database ofsudocommands:-
Navigate to Policy
Sudo Sudo Commands. - Click Add in the upper right corner to open the Add sudo command dialog box.
Enter the command you want the user to be able to perform using
sudo:/usr/sbin/reboot.- Click Add.
-
Navigate to Policy
Use the new
sudocommand entry to create a sudo rule to allow idmuser01 to reboot the client machine:-
Navigate to Policy
Sudo Sudo rules. - Click Add in the upper right corner to open the Add sudo rule dialog box.
-
Enter the name of the
sudorule: idmuser01_reboot. - Click Add and Edit.
Specify the user:
- In the Who section, check the Specified Users and Groups radio button.
- In the User category the rule applies to subsection, click Add to open the Add users into sudo rule "idmuser01_reboot" dialog box.
- In the Add users into sudo rule "idmuser01_reboot" dialog box in the Available column, check the idmuser01 checkbox, and move it to the Prospective column.
- Click Add.
Specify the host:
- In the Access this host section, check the Specified Hosts and Groups radio button.
- In the Host category this rule applies to subsection, click Add to open the Add hosts into sudo rule "idmuser01_reboot" dialog box.
- In the Add hosts into sudo rule "idmuser01_reboot" dialog box in the Available column, check the client.idm.example.com checkbox, and move it to the Prospective column.
- Click Add.
Specify the commands:
- In the Command category the rule applies to subsection of the Run Commands section, check the Specified Commands and Groups radio button.
- In the Sudo Allow Commands subsection, click Add to open the Add allow sudo commands into sudo rule "idmuser01_reboot" dialog box.
-
In the Add allow sudo commands into sudo rule "idmuser01_reboot" dialog box in the Available column, check the
/usr/sbin/rebootcheckbox, and move it to the Prospective column. - Click Add to return to the idm_sudo_reboot page.
Figure 12.1. Adding IdM sudo rule
Click Save in the top left corner.
The new rule is enabled by default.
NotePropagating the changes from the server to the client can take a few minutes.
-
Navigate to Policy
Verification
-
Log in to
clientasidmuser01. Reboot the machine using
sudo. Enter the password foridmuser01when prompted:sudo /usr/sbin/reboot [sudo] password for idmuser01:
$ sudo /usr/sbin/reboot [sudo] password for idmuser01:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
If the sudo rule is configured correctly, the machine reboots.
12.2.12. Granting sudo access to an IdM user on an IdM client using an Ansible playbook in a PoC setup Copia collegamentoCollegamento copiato negli appunti!
Learn how to use a single Ansible playbook to grant sudo access for a specific command to an IdM user account on a specific IdM host.First, add a sudo command and then create a sudo rule for one or more commands.
Complete this procedure to create the idmuser01_reboot sudo rule to grant the idmuser01 account the permission to run the /usr/sbin/reboot command on the client.idm.example.com machine, or client.
Prerequisites
- You are logged in to controller.idm.example.com as the ansible user.
Procedure
In your ~/MyPlaybooks directory, create an add-sudo-rule.yml Ansible playbook file with the parameters of the
sudorule, for example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow If a
sudorule already exists and you are only modifying it, you must set theactionoption tomember. Otherwise the playbook fails. In the example, theModify the idmuser01_reboot sudo rule by adding reboot command and idmuser01task modifies the rule that theCreate a sudo rule idmuser01_reboottask created previously, and therefore, requiresaction: member.You can see the full list of available options in the
/usr/share/ansible/collections/ansible_collections/freeipa/ansible_freeipa/README-sudocmd.mdand…/README-sudorule.mdfiles.Run the playbook:
ansible-playbook -i inventory add-sudo-rule.yml
$ ansible-playbook -i inventory add-sudo-rule.ymlCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
-
Log in to
clientasidmuser01. Reboot the machine using
sudo. Enter the password foridmuser01when prompted:sudo /usr/sbin/reboot [sudo] password for idmuser01:
$ sudo /usr/sbin/reboot [sudo] password for idmuser01:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
If the sudo rule is configured correctly, the machine reboots.