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.
Solution
- Add the audit rule(s) that monitor changes to /etc/gshadow and /etc/shadow . The procedure adds each rule only for targets that exist, so augenrules --load does not error. Run:
#!/usr/bin/env bash
{
[ -e /etc/gshadow ] && printf '%s\n' "-a always,exit -S all -F path=/etc/gshadow -F perm=wa -F key=identity"
[ -e /etc/shadow ] && printf '%s\n' "-a always,exit -S all -F path=/etc/shadow -F perm=wa -F key=identity"
} >> /etc/audit/rules.d/50-identity.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