Harden authentication by validating faillock’s active system policy and enforcing consistent lockout behavior after repeated failures. Inspect per-user failure records and reset counters only after you confirm the event is benign and documented.
Security reports repeated failed logins against the
appuser
account. You need to verify the active lockout policy, apply
a clear baseline in
/etc/security/faillock.conf
, and validate per-user failure records before safely
resetting the counter.
Lockout policy is a balance between slowing brute-force attempts and preventing self-inflicted outages. Your job is to apply a predictable policy, validate it from the CLI, and capture the state before you reset counters.
/etc/security/faillock.conf
.
appuser
and capture evidence.
deny
,
fail_interval
,
unlock_time
.
faillock --system
before changing defaults.
faillock --user
to distinguish typos from suspicious activity.
sudo faillock --system
This displays the active values that control lockout behavior: how many failures trigger lockout, the time window used to count failures, and how long the lock remains in place.
# Example output (varies by distro/config):
deny = 0
fail_interval = 900
unlock_time = 600
/etc/security/faillock.conf
.
sudo nano /etc/security/faillock.conf
# OR
sudo vim /etc/security/faillock.conf
Define a clear deny threshold and unlock time so behavior is consistent during credential stuffing or brute-force. Keep the policy strict enough to slow attacks, but short enough to avoid prolonged user lockouts during normal mistakes.
# Example policy values:
deny = 5
fail_interval = 900
unlock_time = 900
appuser.
sudo faillock --user appuser
Use this view to confirm the failures are real and to gather evidence (timestamps and source address where available). Capture this state before you reset anything.
# Example output (varies by system):
appuser:
When Type Source Valid
2025-01-01 10:15:32 R 192.168.10.50 V
2025-01-01 10:16:05 R 192.168.10.50 V
2025-01-01 10:16:40 R 192.168.10.50 V
appuser.
Resetting counters removes evidence. Do this only after you confirm the source is benign, or after incident response has collected what it needs.
sudo faillock --user appuser --reset
This clears the recorded failures for the user so they can authenticate normally again. In production, pair this with documentation: who requested it, why it was safe, and what evidence was captured first.
# Expected outcome:
# The user’s faillock record is cleared.
sudo faillock --user appuser
If failures immediately reappear, something is still attempting to authenticate with bad credentials (a service, script, or an attacker). That is a containment problem, not a reset problem.
# Example output:
appuser:
No login failures.
Confirm you edited the correct file at
/etc/security/faillock.conf
and that your system is actually using faillock for PAM.
Some environments manage auth policy centrally or via a
baseline tool.
Something is still failing authentication. Identify the source address and correlate it with known services. Do not keep resetting counters while an active source continues to generate failures.
Validate policy in a controlled window and document the numbers you applied. If the environment is sensitive, start with a short unlock time while you confirm behavior and adjust once you have confidence.
Availability of source metadata depends on the auth path and logging configuration. Treat the faillock record as one data point and correlate with system logs in a real incident.
If you changed policy values for this lab, revert them to your baseline once testing is complete. If you reset a user’s counter, confirm the failures are not reappearing and that the lockout policy is still enforcing as intended.
sudo faillock --system
sudo faillock --user appuser
System policy reflects your intended deny, interval, and
unlock values, and the
appuser
record remains clear unless new failures occur.
faillock --system
: Displays current system-wide lockout policy values.
deny
,
fail_interval
, and
unlock_time
.
nano /etc/security/faillock.conf
: Edit the primary configuration file for faillock defaults.
/etc/security/faillock.conf
: Defines baseline policy values.
vim /etc/security/faillock.conf
: Edit the primary configuration file for faillock defaults.
/etc/security/faillock.conf
: Defines baseline policy values.
faillock --user <user>
: Shows recorded failures for a specific user.
faillock --user <user> --reset
: Resets failure records for a user after validation.