1

How to prevent Brute force attacks in Debian systems without fail2ban or CSF-LFD?

The closest and fastest way I know is ConfigServer's CSF-LFD but it's not in the repositories and if I'm going to use a utility I would most prefer something in the repositories (it seems I cannot create a Debian/Ubuntu repository for it because of licensing/legal reasons).

Another solution than CSF-LFD is Fail2ban but it seems to me that the Fail2ban configuration requires firm knowledge in IPS software architecture as well as deep knowledge of Perl compatible regex (PCRE), which both I currently lack (I have some basic PCRE knowledge but not as deep as I think one needs for Fail2ban). It doesn't seem straight forward as CSF-LFD to me.

Thus I wonder if there is a "smoother" way, maybe manually via IP tables, maybe via some utility I could install directly from the Debian/Ubuntu repositories that could prevent BFAs besides the issue of using SSH keys.

  • Do you mean for SSH specifically or more generally for some other server / any server program? – ilkkachu Jan 9 '18 at 14:29
  • Good question dear @ilkkachu ! I think I mean only to SSH because my only unfiltered ports are 22, 80, 443, and 9000 (I would happy to have something that blocks BFAs on 80, 443 as well, but for now I'll stay only with 22 which should be good enough, I think). – Arcticooling Jan 9 '18 at 14:39
1
+50

I also didn't like Fail2ban's complexity much, so I looked into alternatives and found Sshguard, which is designed to work without any configuration fiddling.

Contrary to the name, Sshguard can handle more than just SSH brute force attacks; it comes standard with several filters for popular e-mail and FTP packages.

However, like mc0e said, Fail2ban doesn't really require that much setup, is more powerful and supports more daemons, and I think it comes with some SSH rules by default so you shouldn't really have to configure anything, really.

I, too, am partial to ferm as a much friendlier (and more powerful) pre-processing tool for setting up iptables rules, but that's not really directly related to automatically preventing brute force attacks.

  • Thank you so much for this answer and acquainting me with sshguard. I thumbed up your answer. I strongly suggest editing the answer and cut everything that isn't relevant directly to the question like the last 3th and 4th passages. – Arcticooling Jan 9 '18 at 1:59
3

Fail2ban is a good tool, particularly for ssh logins, and is dead easy to set up for that purpose. I suggest you use it. You won't need to learn a lot of PCRE, as the ssh config you need is there by default.

Don't shy away from learning regex though. Whatever effort you spend there will be richly rewarded for many years to come.

You want a high level tool for specifying firewall rules. I use ferm. There are many others to choose from. Besides port blocking, firewall rules can rate limit connections, which is useful for brute force attack prevention.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.