Published Feb. 17, 2025, 5:18 a.m. by dwest
In the previous parts of this series we covered:
At this point, users can authenticate across the infrastructure. But authentication alone does not determine what users are allowed to do.
This is where access control policies come into play.
FreeIPA provides two major mechanisms for controlling user access:
Together, these systems allow administrators to centrally manage login and privilege access across an entire environment.
HBAC rules define who can log in, where they can log in, and how they can log in.
An HBAC rule consists of three main components:
| Component | Description |
|---|---|
| Users | Individual users or user groups |
| Hosts | Specific hosts or host groups |
| Services | Login services (SSH, login, sudo, etc.) |
Example rule:
Users: developers
Hosts: webservers
Services: ssh
This means:
“Members of the
developersgroup can SSH into hosts in thewebserversgroup.”
HBAC rules are evaluated during the authentication process through SSSD on the client machine.
When FreeIPA is first installed, a default rule exists:
allow_all
This rule allows all users to log into all hosts.
While convenient for testing, this rule should typically be disabled in production environments.
To view current HBAC rules:
ipa hbacrule-find
Host groups simplify policy management by grouping systems together.
Example host groups:
ipa hostgroup-add webservers
ipa hostgroup-add-member webservers --hosts=web01.example.com
ipa hostgroup-show webservers
Access rules should typically reference groups rather than individual users.
Example groups:
ipa group-add developers
ipa group-add-member developers --users=jsmith
Now we can combine these components into an access rule.
ipa hbacrule-add allow_developers_ssh
ipa hbacrule-add-service allow_developers_ssh --hbacsvcs=sshd
ipa hbacrule-add-user allow_developers_ssh --groups=developers
ipa hbacrule-add-host allow_developers_ssh --hostgroups=webservers
ipa hbacrule-enable allow_developers_ssh
Now only developers can SSH into the webservers group.
Testing access is simple. From a client system, attempt to login to it using SSH
ssh jsmith@web01.example.com
If access fails unexpectedly, use the SSSD diagnostic tool to determine why
sssctl user-checks jsmith
This shows how access policies are evaluated.
Once custom rules are in place, disable the default rule
ipa hbacrule-disable allow_all
After this point, only defined HBAC rules will permit access.
| Note: |
|---|
| Be careful. Misconfigured rules can lock administrators out of systems. |
While HBAC controls who can log into systems, it does not control what users can do after login.
That’s where Sudo policies come in.
Sudo rules define:
Example:
Users: sysadmins
Hosts: all servers
Commands: /usr/bin/systemctl
RunAs: root
This allows system administrators to manage services without granting full root access.
ipa sudorule-add sysadmin-sudo
ipa sudorule-add-user sysadmin-sudo --groups=sysadmins
ipa sudorule-add-host sysadmin-sudo --hostgroups=allhosts
ipa sudorule-add-allow-command sysadmin-sudo --sudocmds=ALL
This grants full sudo privileges.
For tighter security, define specific commands.
ipa sudocmd-add /usr/bin/systemctl
ipa sudorule-add-allow-command sysadmin-sudo --sudocmds=/usr/bin/systemctl
Now administrators can only manage services.
After logging in as a user, list their existing privileges
sudo -l
Example output:
User jsmith may run the following commands:
(root) /usr/bin/systemctl
If sudo access fails, verify:
ipa sudorule-find
Also confirm the client updated its policies:
sss_cache -E
A few guidelines make FreeIPA access control much easier to maintain.
Always Use Groups. Avoid referencing individual users in policies. This makes onboarding and offboarding users much simpler.
Use Host Groups for Infrastructure. This allows policies to apply to entire infrastructure tiers.
webservers
dbservers
adminhosts
A typical policy structure might look like this:
| Group | Access |
|---|---|
| developers | SSH access to development systems |
| sysadmins | SSH + sudo access to all servers |
| auditors | Read-only access to selected hosts |
This approach allows centralized control across hundreds or thousands of systems.
So far in the FreeIPA Master Class we have covered:
In the next part of the series we will explore:
FreeIPA Replication and High Availability
We will cover:
Understanding replication is essential for building reliable identity infrastructure.
Next: The FreeIPA Master Class - Part 6
The FreeIPA Master Class - Part 4
The FreeIPA Master Class - Part 6
The FreeIPA Master Class - Part 3
The FreeIPA Master Class - Part 2
There are no comments.