Lockout
After repeated wrong passwords or codes, the realm locks the account for a while, even against the right answer, without revealing which accounts exist.
AvailableDashboard and API
Lockout protects every sign-in. After repeated wrong passwords or codes, the account is locked for a while, even against the right answer. It’s on in every new realm, and you choose how many failures lock an account, over what window, and for how long.
Before you begin
Section titled “Before you begin”- Who can do it: a realm administrator, in a group that holds
RealmOwnerin this realm or one above it (Delegated administration).RealmViewercan read the settings but not change them. - Where: in the dashboard, Authentication → Settings; or through the API
(Call the API shows how to get
$CVYUH_SESSION). - First: nothing. Lockout is on with the defaults below.
How it works
Section titled “How it works”Lockout counts a realm’s failed sign-ins against a username.
- A wrong password counts, and so do a wrong code from an authenticator app the user has set up and a passkey that doesn’t verify. A mistyped code while setting up a new app doesn’t.
- Names the realm doesn’t hold are counted the same way, so lockout never reveals which accounts exist.
- At
lockoutThresholdfailures withinlockoutWindowMinutes, the account is locked forlockoutDurationMinutes. The lock then lifts on its own. - A locked account is refused even with the right password, code or passkey.
- From the
lockoutWarnUser-th failure, the realm tells the user how many attempts are left. - A successful sign-in clears the count, once the whole chain has succeeded.
Lockout is separate from an authenticator app’s or a passkey’s own failure count, which disables that one factor (see Sign-in methods).
Set it up
Section titled “Set it up”In the dashboard, open Authentication → Settings and change the lockout fields. Or change them through the API:
curl -X PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/authSettings/authSettings \ -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \ -H "Content-Type: application/json" \ -d '{ "lockoutThreshold": 5, "lockoutWindowMinutes": 60, "lockoutDurationMinutes": 30, "lockoutWarnUser": 3 }'What the user sees
Section titled “What the user sees”| When | The sign-in page says |
|---|---|
| A wrong password or code, before the warning point | The usual refusal, and the page asks again |
A wrong answer from the lockoutWarnUser-th failure on | ”Invalid credentials. You have 2 attempts remaining before your account is locked.” |
| The failure that locks the account | ”too many failed attempts” |
| Any sign-in while the account is locked | ”account locked”, whatever was entered |
Each of these answers 401. A name the realm doesn’t hold is warned and locked the same way, so none of these
messages confirms that an account exists. The messages are in English only today.
What a locked user should do: wait for the lock to lift (30 minutes by default), then sign in with the right password. Signing in successfully clears the count.
Limits and defaults
Section titled “Limits and defaults”| Setting or limit | Default | Range |
|---|---|---|
lockoutEnabled | true | true or false |
lockoutThreshold: failures that lock | 5 | 0 turns lockout off |
lockoutWindowMinutes: how far back failures count | 300 | up to a day (1440); 0 turns lockout off |
lockoutDurationMinutes: how long a lock lasts | 30 | up to a day (1440); 0 turns lockout off |
lockoutWarnUser: the failure that first warns | 0 (off) | below lockoutThreshold; at or above it, never warns |
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause | Fix |
|---|---|---|
| A user is locked out and hasn’t typed a wrong password | Someone else typed wrong passwords against their username: lockout counts by name | Wait for the lock to lift; look at the AUTH_FAILURE_RECORDED records for where the attempts came from. For users who are often targeted, see Good to know |
| A save is refused | The window or duration is longer than a day | Choose a day or less |
| Users are never warned | lockoutWarnUser is 0, or at or above lockoutThreshold | Set it below the threshold |
| An authenticator app stopped working, but the account isn’t locked | The app reached its own failure cap and was disabled | See Sign-in methods |
Audit record
Section titled “Audit record”Every step is on the realm’s audit trail, under the name that was typed. In the dashboard, open Audit → Authentication; through the API, read the user’s trail (Read a user’s or agent’s trail).
| Event | When | Context |
|---|---|---|
AUTH_FAILURE_RECORDED | A failure was counted | failCount, threshold, whether the user was warned |
ACCOUNT_LOCKED | The failure that locked the account | failCount, threshold, durationSecs |
LOCKOUT_CLEARED | A successful sign-in cleared the count |
Look into a locked account walks through reading them.
Good to know
Section titled “Good to know”- There’s no administrator unlock. A lock lifts when its duration ends. Keep
lockoutDurationMinutesshort enough that a user locked out by someone else isn’t kept out for long. - Counting by name is a trade-off. Anyone who knows a username can lock that account by guessing. The lock is short and never reveals whether the account exists. For users who are often targeted, such as administrators, passkeys take the password out of reach of guessing (Sign-in methods). On a public customer realm, see Protect customer sign-in.
- A threshold, window or duration of
0turns lockout off. There is no lock that waits for an administrator to clear it. - Lockout has ceilings. A window or lock longer than a day is refused, and a lock in one realm never reaches another.
- Warning is a trade-off too. It helps someone who mistyped, and tells someone guessing how many tries are left.
Related
Section titled “Related”- Sign-in methods: each factor’s own failure count.
- Password rules: what a password must hold.
- Sessions: what a successful sign-in gives the user.
- Look into a locked account: the audit records, step by step.