feat/login-security #1824

Closed
bookenjoyer67 wants to merge 2 commits from bookenjoyer67/continuwuity:feat/login-security into main
First-time contributor

Adds a login_security service providing brute-force protection for Matrix
homeservers. Helps operators defend against credential-stuffing and
password-spraying attacks.

What it does

  • Tracks failed login attempts per user and per IP address
  • Automatically locks accounts and blocks IPs when thresholds are exceeded
  • Supports graduated lock durations (escalating for repeat offenders)
  • Configurable attempt windows, thresholds, and lock TTLs
  • Admin room commands for inspecting and managing blocks/locks
  • Optional audit logging of all login attempts

Configuration

New [global.login_security] section in conduwuit.toml:

  • max_failed_attempts_per_user (default: 5)
  • max_failed_attempts_per_ip (default: 10)
  • lock_duration_seconds (default: 300)
  • attempt_window_seconds (default: 900)
  • enable_ip_rate_limiting / enable_user_rate_limiting (default: true)
  • log_all_attempts (default: true)
  • graduated_lock_durations (default: [300, 900, 3600])
    All defaults are conservative and can be tightened or disabled per
    operator preference.

Testing

  • Deployed and running on a live federated homeserver
  • Verified against repeated login failures from same user / same IP
  • Admin commands tested in management room
Adds a login_security service providing brute-force protection for Matrix homeservers. Helps operators defend against credential-stuffing and password-spraying attacks. ### What it does - Tracks failed login attempts per user and per IP address - Automatically locks accounts and blocks IPs when thresholds are exceeded - Supports graduated lock durations (escalating for repeat offenders) - Configurable attempt windows, thresholds, and lock TTLs - Admin room commands for inspecting and managing blocks/locks - Optional audit logging of all login attempts ### Configuration New `[global.login_security]` section in `conduwuit.toml`: - `max_failed_attempts_per_user` (default: 5) - `max_failed_attempts_per_ip` (default: 10) - `lock_duration_seconds` (default: 300) - `attempt_window_seconds` (default: 900) - `enable_ip_rate_limiting` / `enable_user_rate_limiting` (default: true) - `log_all_attempts` (default: true) - `graduated_lock_durations` (default: [300, 900, 3600]) All defaults are conservative and can be tightened or disabled per operator preference. ### Testing - Deployed and running on a live federated homeserver - Verified against repeated login failures from same user / same IP - Admin commands tested in management room
feat: add login security configuration with graduated lock durations
Some checks failed
Auto Labeler / Apply labels based on changed files (pull_request_target) Successful in 2s
Documentation / Build and Deploy Documentation (pull_request) Has been cancelled
Checks / Prek / Pre-commit & Formatting (pull_request) Has been cancelled
Checks / Prek / Check changed files (pull_request) Has been cancelled
Checks / Prek / Clippy and Cargo Tests (pull_request) Has been cancelled
Checks / Changelog / Check changelog is added (pull_request_target) Failing after 9s
08c17cada6
nex closed this pull request 2026-05-28 19:58:29 +00:00
Owner

Please discuss large changes in the development discussion room, and follow the pull request template.

Please discuss large changes in [the development discussion room](https://matrix.to/#/!ksTlboXVgcyWjv5GrlEeKyQuJ8ZCprnwQx2b6-BQ44Q?via=continuwuity.org&via=matrix.org&via=federated.nexus), and follow the pull request template.
Some checks failed
Auto Labeler / Apply labels based on changed files (pull_request_target) Successful in 2s
Documentation / Build and Deploy Documentation (pull_request) Has been cancelled
Checks / Prek / Pre-commit & Formatting (pull_request) Has been cancelled
Required
Details
Checks / Prek / Check changed files (pull_request) Has been cancelled
Required
Details
Checks / Prek / Clippy and Cargo Tests (pull_request) Has been cancelled
Required
Details
Checks / Changelog / Check changelog is added (pull_request_target) Failing after 9s
Required
Details

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
continuwuation/continuwuity!1824
No description provided.