Keyline implements comprehensive password validation policies to ensure user passwords meet security requirements. These policies are configurable per virtual server and help protect against common password attacks.
Password policies in Keyline are enforced whenever a user creates or changes their password. The system validates passwords against both configurable rules and a built-in common password check.
Requires passwords to be at least a specified number of characters long.
Limits passwords to a maximum number of characters.
Requires passwords to contain at least a specified number of numeric characters (0-9).
Requires passwords to contain at least a specified number of lowercase letters (a-z).
Requires passwords to contain at least a specified number of uppercase letters (A-Z).
Requires passwords to contain at least a specified number of special characters.
Supported Special Characters:
The following special characters are supported (based on ASCII ranges):
- Punctuation:
! " # $ % & ' ( ) * + , - . /(ASCII 33-47) - Symbols:
: ; < = > ? @(ASCII 58-64) - Brackets and others:
[ \ ] ^ _and backtick`(ASCII 91-96)
Always Enabled: This policy is automatically applied to all passwords and cannot be disabled.
Keyline includes a comprehensive list of approximately 100,000 of the most commonly used passwords. This list helps prevent users from choosing passwords that are frequently targeted in password attacks.
Implementation:
- Passwords are checked against an embedded list of common passwords
- The check is case-sensitive
- If a password matches any entry in the list, it is rejected
- This policy is applied in addition to any other configured policies
Source: The common password list is sourced from the SecLists project by Daniel Miessler, specifically the 100k-most-used-passwords-NCSC.txt file.
-
Per Virtual Server: Password policies are configured at the virtual server level, allowing different requirements for different tenants.
-
Validation Process: When a password is submitted:
- All configured policies for the virtual server are retrieved from the database
- Each policy is evaluated against the password
- The common password check is always applied
- If any policy fails, validation fails and an appropriate error message is returned
- All validation errors are collected and returned to the user
-
Error Messages: Each policy provides specific error messages when validation fails:
- "password must be at least X characters long"
- "password must be at most X characters long"
- "password must contain at least X numeric characters"
- "password must contain at least X lowercase characters"
- "password must contain at least X uppercase characters"
- "password must contain at least X special characters"
- "password is a common password"
Beyond validation policies, Keyline uses industry-standard password hashing:
- Algorithm: Argon2id
- Resistance: Protected against GPU cracking attacks, side-channel attacks, and time-memory trade-off attacks
- Configuration: Uses secure default parameters appropriate for modern systems
See the main README.md for more information about password hashing and other security features.
For developers working with Keyline's password policies:
- Validator Interface:
internal/password/password.godefines theValidatorinterface - Policy Interface:
internal/password/password.godefines thePolicyinterface - Policy Implementations: Individual policy files in
internal/password/:minlength.go- Minimum length policymaxlength.go- Maximum length policyminimumnumbers.go- Minimum digits policyminimumlowercase.go- Minimum lowercase policyminimumuppercase.go- Minimum uppercase policyminimumspecial.go- Minimum special characters policycommon.go- Common password check (always enabled)
- Password Repository:
internal/repositories/passwordrules.gomanages password rule persistence - Common Password List:
internal/password/password-list.txt(embedded in the binary)
When integrating with Keyline's API:
- Registration/Password Change Endpoints: These endpoints automatically validate passwords against configured policies
- Error Handling: Validation failures return HTTP 400 with error details
- Multiple Errors: If multiple policies fail, all error messages are returned together to help users fix all issues at once
- Main README - Overview of Keyline and its features
- Security Section - Password hashing and other security features
- Configuration Guide - See
internal/config/README.mdin the repository for detailed configuration options