raman wrote:
The following line in /etc/shorewall/rules works great for me, and sets up iptables on each restart:
Code:
ACCEPT net fw tcp 22 - - 3/min:3
This thread is long dead, but for future searchers and posterity, do not do the above. It generally does work fine, but brute force attacks will cause a DOS on your ssh server because the rule is not specific to the source IP -- it blocks all conections, including valid ones.
However, if you are using Shorewall 3.0.4 or later, you can just put something like this in rules instead:
Code:
Limit:info:SSH,3,60 net fw tcp ssh
The Limit action is builtin (> 3.0.4), and the params define how it is logged, and how many connections are allowed over what interval for individual IPs. See this page:
http://www.shorewall.net/PortKnocking.html#id2460417 (the URL is a bit misleading, it talks about port knocking as well).
Cheers,
Raman