Information
The pam_faillock module locks an account after a number of consecutive failed authentication attempts. The deny option, set in /etc/security/faillock.conf, defines that threshold: the number of consecutive failed authentication attempts after which the account is locked. A value of 0 disables the lockout.
Locking an account after a defined number of consecutive failed authentication attempts limits the number of password guesses an attacker can make in a short period, mitigating brute force and password-spraying attacks. Setting deny to a low, non-zero value ensures an account is locked before an attacker can attempt a large number of credentials.
Solution
Create or edit the following line in /etc/security/faillock.conf setting the deny option to 5 or less:
deny = 5
Run the following script to remove the deny argument from the pam_faillock.so module in the PAM files:
#!/usr/bin/env bash
{
for l_pam_file in system-auth password-auth; do
l_authselect_file="/etc/authselect/$(head -1 /etc/authselect/authselect.conf | grep 'custom/')/$l_pam_file"
sed -ri 's/(^\s*auth\s+(requisite|required|sufficient)\s+pam_faillock\.so.*)(\s+deny\s*=\s*\S+)(.*$)/\1\4/' "$l_authselect_file"
done
authselect apply-changes
}