Skip to main content
User guide

Sudo

Central sudo rules covering who, on which host, as whom and which commands; commands and command groups, deny lists, options, and what sudo order does.

This page covers the Sudo pages under Policy. Sudo rules move every host's /etc/sudoers into the directory. The client's sssd sudo provider fetches them, and sudo -l shows what is defined here. The local /etc/sudoers still applies; the two are a union. Not gated by a licence module.

Sudo rules

Parts of a rule

Rule

Blocksudoers equivalentNotes
WhoUsers, user groupsAnyone is ALL
Access this hostHosts, host groupsAny host is ALL
Run commandsAllowed sudo commands and command groups; denied commands and groupsAny command is ALL. The deny list is subtracted after the allow list
As whomRunAs users, groupsEmpty means root. Anyone is ALL, that is sudo -u any user
OptionsDefaults entries!authenticate (no password), env_keep, log_output and so on, written exactly as sudoers option names
Sudo ordersudoOrderPriority when several rules match; the higher number wins. Empty counts as 0

The shipped rule all is empty and disabled: a blank template.

Commands must be absolute paths and may carry arguments (/usr/bin/systemctl restart httpd); /usr/bin/systemctl alone allows any argument. Wildcards in arguments follow sudoers rules.

Commands and command groups

Sudo commands

A command is registered on the Sudo commands page first, then referenced by rules; one command can serve several rules. Command groups bundle a family (service-control: restart httpd, restart nginx, journalctl). Rules reference the group, and a new command only changes the group.

Sudo command groups

Relation to HBAC

Both gates must open: HBAC allows the sudo service for that user on that host (allow_all or a dedicated rule), and a sudo rule carries the command. With only the sudo rule in place and HBAC not allowing sudo, the client reports a wrong password or refuses outright.

Client

# /etc/sssd/sssd.conf
[sssd]
services = nss, pam, sudo
# /etc/nsswitch.conf
sudoers: files sss

ipa-client-install configures this. Propagation delay: sssd does a full refresh every 6 hours and a smart refresh every 15 minutes (ldap_sudo_full_refresh_interval, ldap_sudo_smart_refresh_interval). sss_cache -E forces it.

Boundaries

TopicNotes
Password-less!authenticate is a rule option and applies to the whole rule, not per command
RunAs targetsMust be IPA or AD users and groups. A local user such as postgres goes in the External field by name
Matching hosts by networkCLI only: ipa sudorule-add-host --hostmask=192.168.57.0/24. The UI offers hosts and host groups

On this page