1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-08-09 04:22:45 +03:00

Add configuration for rate-limiting of logins, replacing hardcoded limits

This commit is contained in:
Olivier 'reivilibre
2024-08-07 13:03:25 +01:00
parent 9ea77a9562
commit 11abd7a458
10 changed files with 319 additions and 16 deletions

View File

@@ -197,14 +197,18 @@ impl Options {
let activity_tracker = ActivityTracker::new(pool.clone(), Duration::from_secs(60));
let trusted_proxies = config.http.trusted_proxies.clone();
// Build a rate limiter.
// This should not raise an error here as the config should already have been
// validated.
let limiter = Limiter::new(&config.rate_limiting)
.context("rate-limiting configuration is not valid")?;
// Explicitly the config to properly zeroize secret keys
drop(config);
// Listen for SIGHUP
register_sighup(&templates, &activity_tracker)?;
let limiter = Limiter::default();
limiter.start();
let graphql_schema = mas_handlers::graphql_schema(