{"id":3,"date":"2005-02-18T20:16:37","date_gmt":"2005-02-18T19:16:37","guid":{"rendered":"http:\/\/blog.blackdown.de\/?p=3"},"modified":"2016-10-29T03:51:03","modified_gmt":"2016-10-29T01:51:03","slug":"mitigating-ssh-brute-force-attacks-with-ipt_recent","status":"publish","type":"post","link":"https:\/\/blackdown.de\/articles\/mitigating-ssh-brute-force-attacks-with-ipt_recent\/","title":{"rendered":"Mitigating SSH Brute Force Attacks with ipt_recent"},"content":{"rendered":"
As my SSH<\/a> server only accepts public key based authentication, I’m not really worried about brute force password attacks. But these scans tend to clobber my The The Here’s how you can integrate those two actions:<\/p>\n Note: You must<\/strong> use the <action>:<log>:<tag> format for the rules. If you’re running OpenSSH<\/a> 3.9 or later, you additionally might want to set May 9th, 2005:<\/strong> I have found a bug in the ipt_recent module, see this article<\/a> for more information and a fix.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":" As my SSH server only accepts public key based authentication, I’m not really worried about brute force password attacks. But these scans tend to clobber my auth.log. So after some discussion with Andrew Pollock, I’ve written a few custom actions for my shorewall setup. They use the ipt_recent module which allows to track seen IPauth.log<\/code>. So after some discussion with Andrew Pollock<\/a>, I’ve written a few custom actions for my shorewall<\/a> setup. They use the ipt_recent<\/a> module which allows to track seen IP addresses and match against them using some criteria.<\/p>\n
Limit<\/a><\/code> action can be used to limit accepted connections per IP and timeframe. The hardcoded limit currently is 6 connections per 60 seconds. If an IP tries to connect more often, the attempts will be DROPed.<\/p>\n
Whitelist<\/a><\/code> action provides some simple port-knocking whitelist. If you know the
WHITELIST_PORT<\/code> and can lift the limits imposed by the
Limit<\/a><\/code> action for your IP and 60 seconds by connecting to that port.<\/p>\n
\n
\n
shorewall\/action.Limit<\/code>\n<\/li>\n
shorewall\/action.Whitelist<\/code><\/li>\n<\/ul>\n<\/li>\n
Limit<\/a><\/code> and
Whitelist<\/a><\/code> to the
shorewall<\/code> directory<\/li>\n
Limit<\/code> and
Whitelist<\/code> to
shorewall\/actions<\/code><\/li>\n
WHITELIST_PORT<\/code> in
shorewall\/params<\/code>\n<\/li>\n
Limit<\/code> in
shorewall\/rules<\/code>, for instance:\n
\r\nLimit:ULOG:SSH net fw tcp ssh\r\nLimit:ULOG:IMAP net fw tcp imap,imaps\r\n<\/pre>\n
Limit<\/a><\/code> uses the <tag> for the ipt_recent table name.<\/p>\n<\/li>\n
Whitelist<\/code> rule:\n
\r\nWhitelist:ULOG net fw\r\n<\/pre>\n<\/li>\n<\/ul>\n
MaxAuthTries<\/code> to 1 (see
sshd_config(5)<\/code>).<\/p>\n
[→ Read the rest of this entry<\/a>]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[2,7,8],"tags":[],"yoast_head":"\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n