fix(fail2ban): improve handling of fail2ban#7120
Draft
denis-ev wants to merge 1 commit intomailcow:stagingfrom
Draft
fix(fail2ban): improve handling of fail2ban#7120denis-ev wants to merge 1 commit intomailcow:stagingfrom
denis-ev wants to merge 1 commit intomailcow:stagingfrom
Conversation
Collaborator
5 tasks
896e1d1 to
dc53358
Compare
…cks for network validity and enhanced logging for unban operations. Ensured proper deletion from Redis and updated attempts and ban counters accordingly.
dc53358 to
09e2f84
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Contribution Guidelines
What does this PR include?
Fixes #5879
Short Description
Fixes fail2ban/netfilter so that bans are actually removed when they expire or when the user clicks unban. Previously,
unban()returned early when the banned network was not in the in-memorybansdict: it only clearedF2B_QUEUE_UNBANand did not remove the entry fromF2B_ACTIVE_BANSor remove the firewall rule. That left IPs stuck in Redis and in the firewall, the UI timer went negative, and the unban button had no effect until the netfilter container was restarted.This change makes unban always perform Redis cleanup and firewall unban when called (by autopurge on expiry or by the unban queue). The in-memory
bansdict is only used for bookkeeping (attempts, ban_counter). Invalid or unparseable network strings are handled by still removing the entry from Redis and only skipping the firewall unban, so stale entries do not remain in the UI.Affected Containers
Did you run tests?
What did you tested?
What were the final results? (Awaited, got)
So far IPs are getting unbanned as expected, needs a bit of a longer runtime to properly check, as the previous PR only failed after a while and not instantly