From 86fa8634eeed0ccbf1ba89f67be6194586c3842b Mon Sep 17 00:00:00 2001 From: FreddleSpl0it Date: Mon, 11 Dec 2023 11:38:48 +0100 Subject: [PATCH] [Netfilter] do not ignore RETRY_WINDOW --- data/Dockerfiles/netfilter/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/data/Dockerfiles/netfilter/main.py b/data/Dockerfiles/netfilter/main.py index a6859c95f..75768009b 100644 --- a/data/Dockerfiles/netfilter/main.py +++ b/data/Dockerfiles/netfilter/main.py @@ -167,8 +167,12 @@ def ban(address): if not net in bans: bans[net] = {'attempts': 0, 'last_attempt': 0, 'ban_counter': 0} + current_attempt = time.time() + if current_attempt - bans[net]['last_attempt'] > RETRY_WINDOW: + bans[net]['attempts'] = 0 + bans[net]['attempts'] += 1 - bans[net]['last_attempt'] = time.time() + bans[net]['last_attempt'] = current_attempt if bans[net]['attempts'] >= MAX_ATTEMPTS: cur_time = int(round(time.time()))