Skip to content

Account Lockouts Must Be Logged

An XCCDF Rule

Description

PAM faillock locks an account due to excessive password failures, this event must be logged.

Rationale

Without auditing of these events it may be harder or impossible to identify what an attacker did after an attack.

ID
xccdf_org.ssgproject.content_rule_accounts_passwords_pam_faillock_audit
Severity
Medium
References
Updated



Remediation - Ansible

- name: Account Lockouts Must Be Logged - Check if system relies on authselect tool
  ansible.builtin.stat:
    path: /usr/bin/authselect
  register: result_authselect_present
  when: ansible_distribution == 'RedHat' and ansible_distribution_version is version('8.2',
    '>=')

Remediation - Shell Script

# Remediation is applicable only in certain platforms
if grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="8.2"; printf "%s\n%s" "$expected" "$real" | sort -VC; }; then

if [ -f /usr/bin/authselect ]; then
    if ! authselect check; then
echo "