Overview
Part 6 of the Identity series shows FreeIPA sudo rules in practice on Fedora 44. The goal is auditable delegation: an operator may inspect the sshd status on a defined client, but cannot restart the service, and users outside the group do not receive that privilege.
Important: HBAC decides whether a user may access a host and service at all. Sudo then decides which privileged commands are allowed on that host. They belong together, but they are not the same control.
FreeIPA Web UI after login in the Fedora 44 sudo lab. Screenshot from the isolated FreeIPA C4 sudo lab on Fedora 44.
Lab Setup
Server: ipa01.example.testClient: client01.example.testDomain: example.testRealm: EXAMPLE.TESTDistribution: Fedora Linux 44Kernel: 6.19.14-300.fc44.x86_64SELinux: Enforcing
Object Model
The lab does not use local sudoers files for the functional permission. The rule is modeled centrally in FreeIPA: user group, host group, sudo command, sudo command group and sudo rule.
ipa group-add ops-sudo-status \--desc='Operators allowed to inspect selected service status'ipa group-add-member ops-sudo-status --users=opsallowedipa hostgroup-add linux-clients \--desc='Linux clients using central sudo policy'ipa hostgroup-add-member linux-clients --hosts=client01.example.testipa sudocmd-add '/usr/bin/systemctl status sshd'ipa sudocmdgroup-add service-status-commands \--desc='Read-only service status commands'ipa sudocmdgroup-add-member service-status-commands \--sudocmds='/usr/bin/systemctl status sshd'ipa sudorule-add allow-service-status \--desc='Allow status inspection of sshd on Linux clients'ipa sudorule-add-user allow-service-status --groups=ops-sudo-statusipa sudorule-add-host allow-service-status --hostgroups=linux-clientsipa sudorule-add-allow-command allow-service-status \--sudocmdgroups=service-status-commandsipa sudorule-add-runasuser allow-service-status --users=rootipa sudorule-add-option allow-service-status --sudooption='!authenticate'
FreeIPA sudo rule allow-service-status with user group, host group, command group and RunAs root. Screenshot from the isolated FreeIPA C4 sudo lab on Fedora 44.
FreeIPA group ops-sudo-status with the allowed operator. Screenshot from the isolated FreeIPA C4 sudo lab on Fedora 44.
FreeIPA host group linux-clients with client01.example.test. Screenshot from the isolated FreeIPA C4 sudo lab on Fedora 44.
FreeIPA sudo command group service-status-commands. Screenshot from the isolated FreeIPA C4 sudo lab on Fedora 44.
Client Integration Through SSSD
For sudo to see centralized rules, the client must query sudo rules through SSSD. In the lab, `sudoers: files sss`, the SSSD sudo responder and a cache refresh were part of the acceptance check.
# /etc/nsswitch.confsudoers: files sss# /etc/sssd/sssd.conf[sssd]services = nss, pam, ssh, sudo[sudo]systemctl restart sssdsss_cache -E
User opsallowed may run the following commands on client01:(root) NOPASSWD: /usr/bin/systemctl status sshdUser opsdenied is not allowed to run sudo on client01.
Positive Test
The opsallowed user is a member of ops-sudo-status. `sudo -l` shows only the allowed command. `SYSTEMD_PAGER=cat` makes the systemd status output non-interactive and scriptable.
uid=289600003(opsallowed) gid=289600003(opsallowed) groups=289600003(opsallowed),289600005(ops-sudo-status)User opsallowed may run the following commands on client01:(root) NOPASSWD: /usr/bin/systemctl status sshdSYSTEMD_PAGER=cat sudo -n /usr/bin/systemctl status sshdActive: active (running)rc=0
Negative Tests
opsallowed may read the service status but may not execute `systemctl restart sshd`. opsdenied resolves as an IPA user, but receives no sudo grant from the FreeIPA rule.
sudo -n /usr/bin/systemctl restart sshdsudo: a password is requiredrestart_rc=1uid=289600004(opsdenied) gid=289600004(opsdenied) groups=289600004(opsdenied)SYSTEMD_PAGER=cat sudo -n /usr/bin/systemctl status sshdsudo: a password is requireddenied_user_rc=1
Result Check
| Area | Check | Result |
|---|---|---|
| Platform | Server and client on Fedora Linux 44 | PASS |
| FreeIPA | sudo rule allow-service-status exists | PASS |
| Scope | user group ops-sudo-status linked | PASS |
| Scope | host group linux-clients linked | PASS |
| Scope | only /usr/bin/systemctl status sshd allowed | PASS |
| SSSD | sudoers: files sss and sudo responder active | PASS |
| Allow | opsallowed may read sshd status as root | PASS |
| Deny | opsallowed may not restart sshd | PASS |
| Deny | opsdenied receives no sudo grant | PASS |
Platform
- Check
- Server and client on Fedora Linux 44
- Result
- PASS
FreeIPA
- Check
- sudo rule allow-service-status exists
- Result
- PASS
Scope
- Check
- user group ops-sudo-status linked
- Result
- PASS
Scope
- Check
- host group linux-clients linked
- Result
- PASS
Scope
- Check
- only /usr/bin/systemctl status sshd allowed
- Result
- PASS
SSSD
- Check
- sudoers: files sss and sudo responder active
- Result
- PASS
Allow
- Check
- opsallowed may read sshd status as root
- Result
- PASS
Deny
- Check
- opsallowed may not restart sshd
- Result
- PASS
Deny
- Check
- opsdenied receives no sudo grant
- Result
- PASS
Practice Notes
`!authenticate` results in NOPASSWD behavior and should only be used where operational benefit and risk are documented.
After rule changes, SSSD cache and sudo refresh timing can become visible. For tests, `sss_cache -E` plus an SSSD restart is useful; in production, cache behavior should be planned deliberately.
For production roles, keep commands narrow and avoid broad root privileges through generic groups.






