5.11 Ensure Logging Is Enabled for Sudo

Information

In order to properly monitor the use of the sudo command, logs events for any use of sudo should be captured in the unified log.

Apple added sudo logging as part of the unified log in macOS 14.0 Sonoma. In macOS 15.0 Sequoia, it is now disabled by default but it should be enabled.

Solution

Terminal Method:

Run the following command to edit the sudo settings:

% /usr/bin/sudo /usr/sbin/visudo -f /etc/sudoers.d/<configuration file name>

example: % /usr/bin/sudo /usr/sbin/visudo -f /etc/sudoers.d/10_cissudoconfiguration

Note: Unlike other Unix and/or Linux distros, macOS will ignore configuration files in the sudoers.d folder that contain a so do not add a file extension to the configuration file.

Add the line Defaults log_allowed to the configuration file.

Note: The Defaults log_allowed line can be added to an existing configuration file or a new one. That will depend on your organization's preference and works either way.

Impact:

Sensitive date (ex proprietary data, PII, etc) could be sent to the unified log with sudo logging enabled.

See Also

https://workbench.cisecurity.org/benchmarks/19972