Foreman can utilize User Groups and Mappings to automatically assign permissions to users based on their external group membership.
I'll be using the 'External' authentication source as well as FreeIPA as my external provider. In order for this to work, the foreman server will have to have ipa authentication enabled as well as be enrolled in the ipa-domain.
First, create the required groups in FreeIPA:
[archy@ipa02 ~]$ ipa group-add foreman-admins
Add the required users to the group you've just created:
[archy@ipa02 ~]$ ipa group-add-member foreman-admins --users 'archy'
The freeipa side of this setup is done with that. Next, ensure the foreman's /etc/sssd/sssd.conf contains the following sections for the [ifp] section otherwise you might get 'User not in ACL\n' errors in your http error log:
[ifp]
allowed_uids = apache, root
user_attributes=+email, +firstname, +lastname
If you had to change the configuration, make sure to restart sssd, sssd-ifp and the katello services:
[archy@katello ~]$ sudo systemctl restart sssd.service sssd-ifp.service
[archy@katello ~]$ sudo foreman-maintain service restart
Once foreman is back online, you can go ahead and create the user group and the associated external group:
[archy@katello ~]$ hammer user-group create --name 'admins' --admin true
[archy@katello ~]$ hammer user-group external create --auth-source 'External' --user-group 'admins' --name 'foreman-admins'
Log out of foreman and then log in again. Check on the user-groups in the WebUI or use the cli to check which users are included:
[archy@katello ~]$ hammer user-group show --name admins | awk NF
Id: 1
Name: admins
Admin: yes
Users:
archy
User groups:
External user groups:
lnxroot
Roles:
Created at: 2021/09/16 15:35:55
Updated at: 2021/09/16 21:00:10
As you can see, all members of the FreeIPA group 'foreman-admins' have been automatically added to the Foreman group 'admins'.
Feel free to comment and / or suggest a topic.
Comments
Post a Comment