From 99a5a52fea724c19928bcd23008e62acdc019fd4 Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Sat, 15 Feb 2025 00:01:29 +0000 Subject: [PATCH] fail2ban: Reset the counter upon successful login This is for SASL: when multiple mechanisms available it's kinda expected that some of them can fail, e.g. if client attempted EXTERNAL without providing the cert first. --- modules/fail2ban.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/fail2ban.cpp b/modules/fail2ban.cpp index adb18729..fd3a78ba 100644 --- a/modules/fail2ban.cpp +++ b/modules/fail2ban.cpp @@ -216,6 +216,10 @@ class CFailToBanMod : public CModule { Add(sRemoteIP, 1); } + void OnClientLogin() override { + Remove(GetClient()->GetRemoteIP()); + } + EModRet OnLoginAttempt(std::shared_ptr Auth) override { // e.g. webadmin ends up here const CString& sRemoteIP = Auth->GetRemoteIP();