You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: Implement authentication rate limiting (fail2ban-like)
Add AuthRateLimiter with ban support to protect against brute-force attacks:
- Track failed authentication attempts per IP address
- Automatically ban IPs that exceed max attempts within time window
- Configurable max attempts, time window, and ban duration
- IP whitelist support for trusted addresses
- Automatic cleanup of expired bans and failure records
- Background cleanup task running every 60 seconds
Configuration options added to SecurityConfig:
- auth_window: Time window for counting attempts (default: 300s)
- whitelist_ips: IPs exempt from rate limiting
Integration with SSH handler:
- Check if IP is banned before authentication
- Record failures and trigger bans on threshold
- Record success to reset failure counter
- Logging for ban events
Closes#140
* fix: Address PR review feedback for auth rate limiting
- Use configuration values instead of hardcoded values for auth_window and ban_time
- Integrate whitelist_ips from configuration with validation and logging
- Fix TOCTOU race condition in record_failure by removing entry atomically
- Add capacity limit (max_tracked_ips) to prevent memory exhaustion DoS
- Use HashSet for whitelist O(1) lookups instead of Vec O(n)
- Add auth rate limit config fields to ServerConfig
- Propagate security config from ServerFileConfig to ServerConfig
- Add test for capacity limit enforcement
* chore: finalize auth rate limiter with docs and formatting fixes
- Fix code formatting (cargo fmt)
- Update ARCHITECTURE.md with Server Security Module documentation
- Update server-configuration.md with auth_window and whitelist_ips options
- All 930 tests passing, clippy clean
0 commit comments