6.2.3.30 Ensure successful and unsuccessful attempts to use the usermod command are collected

Information

The operating system must generate audit records for successful/unsuccessful uses of the usermod command.

The usermod command modifies the system account files to reflect the changes that are specified on the command line. Without generating audit records that are specific to the security and needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one.

Audit records can be generated from various components within the information system (e.g., module or policy filter).

Solution

- Add the audit rule(s) that monitor use of the /usr/sbin/usermod command. The procedure adds the rule only when the command exists, so augenrules --load does not error. Run:

#!/usr/bin/env bash

{
UID_MIN="$(awk '/^[[:space:]]*UID_MIN/{print $2}' /etc/login.defs)"
[ -e /usr/sbin/usermod ] && printf '%s\n' "-a always,exit -S all -F path=/usr/sbin/usermod -F perm=x -F auid>=$UID_MIN -F auid!=unset -k usermod"
} >> /etc/audit/rules.d/50-usermod.rules

- Merge and load the rules into active configuration:

# augenrules --load

- Check if reboot is required:

# if [[ $(auditctl -s | grep "enabled") =~ "2" ]]; then printf "Reboot required to load rules\n"; fi

See Also

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