Avoid unbaning an IP that is still banned by another jail.#2
Avoid unbaning an IP that is still banned by another jail.#2amorsent wants to merge 2 commits intoElevatoDigital:masterfrom
Conversation
Fixes long term recidive bans being reversed after the shorter term ban expires.
|
We have several jails defined. Most have a short ban time in the order of 5-10 min. We noticed that the recidive bans were being quickly undone when the shorter bans expire. With the default iptables based action, this is not an issue because each jail has its own iptables chain and the bans/unbans from each jail are isolated. However, since this action is sharing a single AWS IP set, the actions now conflict. The sequence would look like this:
Technically the unbans from one jail will undo bans from any other jail - but it is most problematic for the recidive ban. The recidive ban is always triggered by another ban that will then expire in a few min, thus completely undermining the recidive jail. My fix for this is to keep track of how many bans per IP and only remove them from the IPSet when the last one is lifted. |
Fixes long term recidive bans being reversed after the shorter term ban expires.