Rule ID
SV-261372r1184420_rule
Version
V1R4
CCIs
The sudoers security policy requires that users authenticate themselves before they can use sudo. When sudoers requires authentication, it validates the invoking user's credentials. If the rootpw, targetpw, or runaspw flags are defined and not disabled, by default the operating system will prompt the invoking user for the "root" user password. For more information on each of the listed configurations, reference the sudoers(5) manual page.
Verify that the sudoers security policy is configured to use the invoking user's password for privilege escalation with the following command:
> sudo egrep -ir '(rootpw|targetpw|runaspw)' /etc/sudoers /etc/sudoers.d* | grep -v '#'
/etc/sudoers.d/hardening_defaults:Defaults !targetpw
/etc/sudoers.d/hardening_defaults:Defaults !rootpw
/etc/sudoers.d/hardening_defaults:Defaults !runaspw
If "Defaults" types are not defined for "!targetpw", "!rootpw", and "!runaspw", there are conflicting results between files, this is a finding.Configure the sudoers security policy to use the invoking user's password for privilege escalation.
Define the defaults in a configuration file in the /etc/sudoers.d/ directory with the following command and entries:
> sudo visudo -f /etc/sudoers.d/hardening_defaults
Defaults !targetpw
Defaults !rootpw
Defaults !runaspw