Skip to content

Commit

Permalink
Merge pull request #5584 from mailcow/feat/nftables
Browse files Browse the repository at this point in the history
[Netfilter] do not ignore RETRY_WINDOW
  • Loading branch information
FreddleSpl0it authored Dec 11, 2023
2 parents d11e485 + 86fa863 commit 4387ce8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion data/Dockerfiles/netfilter/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down

0 comments on commit 4387ce8

Please sign in to comment.