Summary: | net-analyzer/fail2ban-0.8.4-r2: action iptables-allports fails to run once out of two runs | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | john <johnny> |
Component: | [OLD] Unspecified | Assignee: | Gentoo Netmon project <netmon> |
Status: | RESOLVED TEST-REQUEST | ||
Severity: | normal | CC: | johnny |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | 392481 | ||
Bug Blocks: | |||
Attachments: |
patch aginst /etc/fail2ban/actions.d/iptables-allports
/etc/fail2ban/actions.d/iptables-allports.conf patch that detects when the chain allready exists iptables action for fail2ban using locking |
Description
john
2011-03-27 15:43:49 UTC
Created attachment 267401 [details, diff]
patch aginst /etc/fail2ban/actions.d/iptables-allports
Adding a sleep to the action startup seems to fix the problem for me
I forgot to add this happens with the latest fail2ban in portage tree: net-analyzer/fail2ban-0.8.4-r2 Created attachment 268173 [details, diff]
/etc/fail2ban/actions.d/iptables-allports.conf patch that detects when the chain allready exists
This patch both fixes the behaviour where if the iptables-allports rule is enabled in multiple jails, one of the jails fails to start sometimes.
Also, makes it so that if the chain has allready been added it doesn't add a second referece to it.
Created attachment 268207 [details, diff]
iptables action for fail2ban using locking
This patch works much better, the real problem is that fail2ban seems to start actions in parallel, so if two jails use the same action it well get run twice. Sometimes i guess this can be good, but not in the case of iptables rules, as it adds two references to the same chain, which means netfilter will have to pass through the chain twice for each packet.
This patch makes use of the flock locking utility for the shell, so the same action isn't executed in parallel, and it also makes sure two references are not added to the same rule. This can probably be used in other rules aswell.
This should be fixed in 0.8.6 |