1
0
mirror of https://github.com/mailcow/mailcow-dockerized.git synced 2025-12-27 00:31:32 +00:00

[Netfilter] do not ignore RETRY_WINDOW

This commit is contained in:
FreddleSpl0it
2023-12-11 11:38:48 +01:00
parent 340980bdd0
commit 86fa8634ee

View File

@@ -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()))