Account Lockout

Protect against brute-force attacks with account lockout.

How It Works

After a configured number of failed login attempts, the account is temporarily locked:

spinner

Configuration

Environment Variables

Variable
Default
Description

LOCKOUT_THRESHOLD

5

Failed attempts before lockout

LOCKOUT_DURATION

30

Lockout duration (minutes)

ENABLE_AUTO_UNLOCK

true

Auto-unlock after duration

Example Configuration

# Lock after 5 failed attempts
LOCKOUT_THRESHOLD=5

# Lock for 30 minutes
LOCKOUT_DURATION=30

# Auto-unlock enabled
ENABLE_AUTO_UNLOCK=true

Progressive Lockout

For enhanced security, increase lockout duration with each lockout:

Admin Dashboard

View Locked Accounts

  1. Navigate to Admin DashboardUsers

  2. Filter by Status: Locked

Unlock an Account

  1. Select the locked user

  2. Click Unlock Account

  3. Optionally, send password reset email

Admin Users

Monitoring

Audit Log Events

Lockout events are logged:

Event
Description

user.login_failed

Failed login attempt

user.locked

Account locked

user.unlocked

Account unlocked (auto or manual)

Alerts

Set up alerts for lockout events:

API Integration

Check Lock Status

Response:

Unlock User

IP-Based Lockout

Optionally lock by IP address instead of account:

This helps when attackers try multiple usernames from the same IP.

Whitelist

Exclude certain IPs from lockout:

User Experience

Locked Account Message

Users see a clear message when locked:

Reset Password Option

Offer password reset as an alternative:

Best Practices

circle-info

Recommended settings for most deployments:

  • Threshold: 5 attempts

  • Duration: 30 minutes

  • Auto-unlock: Enabled

  • Progressive lockout: Enabled

circle-exclamation

Troubleshooting

Users getting locked frequently

  • Check for password manager issues

  • Verify caps lock behavior

  • Consider increasing threshold

Lockout not working

  • Verify environment variables are loaded

  • Check ENABLE_LOCKOUT is not set to false

  • Review audit logs for failed attempts

Auto-unlock not happening

  • Verify ENABLE_AUTO_UNLOCK=true

  • Check server time synchronization

  • Review logs for errors

Next Steps

Last updated

Was this helpful?