6.3.3.14 Ensure events that modify /etc/shadow and /etc/gshadow are collected

Information

Record events affecting the modification of user or group information, including that of passwords and old passwords if in use.

- /etc/gshadow - encrypted password for each group
- /etc/shadow - system user passwords

Unexpected changes to these files could be an indication that the system has been compromised and that an unauthorized user is attempting to hide their activities or compromise additional accounts.

Satisfies: SRG-OS-000062-GPOS-00031, SRG-OS-000004-GPOS-00004, SRG-OS-000037-GPOS-00015, SRG-OS-000042-GPOS-00020, SRG-OS-000062-GPOS-00031, SRG-OS-000304-GPOS-00121, SRG-OS-000392-GPOS-00172, SRG-OS-000462-GPOS-00206, SRG-OS-000470-GPOS-00214, SRG-OS-000471-GPOS-00215, SRG-OS-000239-GPOS-00089, SRG-OS-000240-GPOS-00090, SRG-OS-000241-GPOS-00091, SRG-OS-000303-GPOS-00120, SRG-OS-000304-GPOS-00121, SRG-OS-000476-GPOS-00221

Solution

Note:

- The -w option is deprecated and the rule should be updated in accordance with the Remediation Procedure.
- For best performance, the arch field should be supplied in the rule. The individual permissions will cause the selection of specific system calls that use that kind of access. Not supplying the arch will cause the selection of all system calls which will affect performance as all system calls will be evaluated.

- Edit or create a file in the /etc/audit/rules.d/ directory, ending inrules extension, with the relevant rules to monitor events that modify user/group information.

Example:

# printf "
-a always,exit -F arch=b64 -S all -F path=/etc/gshadow -F perm=wa -F key=identity
-a always,exit -F arch=b64 -S all -F path=/etc/shadow -F perm=wa -F key=identity
" >> /etc/audit/rules.d/50-identity.rules <xhtml:ol start="2"> - Merge and load the rules into active configuration:

# augenrules --load <xhtml:ol start="3"> - 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/23593