powerontech
Guru
- Joined
- Feb 18, 2008
- Messages
- 98
- Reaction score
- 0
Recently got up to speed on fail2ban and iptables. Seems like a simple and effective solution to the script kiddies.
If you have the asterisk-iptables or even just the ssh-iptables enabled (for example) it writes those rules (user defined chain) to iptables in memory on boot up. So far so good. Now if you save your iptables in the default way "service iptables save" or "iptables-save > /etc/sysconfig/iptables" it writes the current config to the default file including the fail2ban added rules.
Now if you reboot you get the same rules written to iptables in memory twice. Doing an 'iptables -L' confirms this.
Is that how it is supposed to work or do I not understand something?
Seems to me this is a bug. Shouldn't there be a check in /etc/fail2ban/action.d/iptables.conf to check for duplicate fail2ban entries before adding the fail2ban entries into iptables again? I see that it does remove the entries if you do a stop action on fail2ban but you would need to do that before you save iptables to a file which is just one more thing to be aware of.
If we are expected to understand this that is fine. Just seems a bit crude IMHO and an easy mistake to make. Especially at 4am on 10cups of coffee
.
If you have the asterisk-iptables or even just the ssh-iptables enabled (for example) it writes those rules (user defined chain) to iptables in memory on boot up. So far so good. Now if you save your iptables in the default way "service iptables save" or "iptables-save > /etc/sysconfig/iptables" it writes the current config to the default file including the fail2ban added rules.
Now if you reboot you get the same rules written to iptables in memory twice. Doing an 'iptables -L' confirms this.
Is that how it is supposed to work or do I not understand something?
Seems to me this is a bug. Shouldn't there be a check in /etc/fail2ban/action.d/iptables.conf to check for duplicate fail2ban entries before adding the fail2ban entries into iptables again? I see that it does remove the entries if you do a stop action on fail2ban but you would need to do that before you save iptables to a file which is just one more thing to be aware of.
If we are expected to understand this that is fine. Just seems a bit crude IMHO and an easy mistake to make. Especially at 4am on 10cups of coffee
.
myself.