top | item 37796588

(no title)

pandog | 2 years ago

fail2ban is a real pet peeve of mine because anyone security conscious enough to deploy this will have likely already mitigated any actual security risks this could help with either by using a strong password or public key authentication.

That leaves noise in the logs - which sure, it's nice to reduce, but using an alternative port can help here.

I may sound like a spoilsport - but the fact that there have been a number of security vulnerabilities (https://www.cvedetails.com/vulnerability-list/vendor_id-5567...) in this project, make it worse than security theatre, it actually increases risk whilst not at all reducing it.

discuss

order

tptacek|2 years ago

Yes. At this point, fail2ban has become almost a shibboleth for people following security checklists as opposed to reasoning about a coherent threat model. This is a perennial topic on HN, and almost always devolves to some appeal to grooming logs, because of all the authentication errors fail2ban is presumably preventing.

Don't use fail2ban. (Don't use passwords, either!)

https://hn.algolia.com/?dateRange=all&page=0&prefix=false&qu...

callwhendone|2 years ago

I am one of the people to whom you refer. I read about fail2ban in a "Linux Server Bible" e-book around 2010 and have used it on all of my servers since, even though I am careful with my keys and use password-less login.

ivlad|2 years ago

While I agree fail2ban is a wrong tool to prevent password brute force - better authentication mechanisms should be used instead - it has its uses. For example, it can be used to automatically ban (or alert about) dumb http scanners like gobuster. I am not saying, a determined attacker cannot bypass it, but if it saves me some hassle and raises the bar for them, why should not I do it?

More general, some attacker actions, especially during recon, rely on making many attempts to connect, fetch an URL, resolve FQDN, etc., these could be detected and automatically responded to, making attacker’s job harder and providing extra visibility to defenders.

meepmorp|2 years ago

I use fail2ban because I take break in attempts personally, especially when it's some script trying default logins one after another. It's insulting.

ozim|2 years ago

Grooming logs from attempts seems like shibboleth on its own that is indicating junior level or “security enthusiast”.

Anyone who manages servers professionally does not read logs anymore and does not care about obvious things like people brute-forcing.

Reading ssh logs on your single VPS is security LARPING. Discussing faill2ban as well :)

throw0101c|2 years ago

> That leaves noise in the logs - which sure, it's nice to reduce, but using an alternative port can help here.

No, it cannot. As a sysadmin I do not want to get into user training about telling people about alternative ports and tweaking their CLI habits and any scripts that they have.

If you want to further cut down on the log noise get an IPv6 address (and drop IPv4)—good luck to anyone trying to scan a /64 for open ports.

soupbowl|2 years ago

I can cofirm this, I swapped one of my cloud VMs to ipv6 only ssh and after 11 months I never seen a single ip besides mine attempt to login. This was using the default port 22.

costco|2 years ago

I read that Shodan was running NTP servers to figure out active IPv6 addresses :)

yubiox|2 years ago

My lame provider (comcast business) wants $20/mo for ipv6.

devwastaken|2 years ago

You can scan ipv6 because the addresses aren't arbitrary. Blocks have to be purchased and then ranges within routed.

BeefWellington|2 years ago

> That leaves noise in the logs - which sure, it's nice to reduce, but using an alternative port can help here.

Shifting services to alternate port numbers will stop very stupid scanners but it does not stop the worst offenders IME. Basically it just means you'll only get the really obnoxious sources that try everything ignoring responses.

> I may sound like a spoilsport - but the fact that there have been a number of security vulnerabilities (https://www.cvedetails.com/vulnerability-list/vendor_id-5567...) in this project, make it worse than security theatre, it actually increases risk whilst not at all reducing it.

Given the age of the project and that there's been a whopping NINE vulnerabilities found in its lifetime, this is a great take. By this same logic you better disable OpenSSH everywhere. In the same timeframe as Fail2Ban has has reported vulnerabilities, OpenSSH has had at least 60: https://www.cvedetails.com/vulnerability-list/vendor_id-97/p...

"Worse than security theatre" is quite the statement given they reported and fixed those issues in timely fashions.

If you apply the principles of defense in depth, using the network layer to deny access to misbehaving remote hosts is an obvious win on a lot of fronts and hardly qualifies as security theatre anymore than using a network firewall is security theatre.

rendaw|2 years ago

It's not 9 vs 60, it's 9 vs 0 if you don't use it, with no loss in functionality. And GPs point is that it's not defense in depth, the vulnerabilities in Fail2Ban can compromise the security of other layers.

dizhn|2 years ago

If we limit the use case to a single service, fail2ban is just a log cleaner. What it's detecting is merely the service that you're protecting doing its job properly. Now if you analyze the collected data and do something smarter with it, that's another story.

jtriangle|2 years ago

"Don't use fail2ban because you don't need it if you do XYZ"

I'm not so sure that's a good reason to be honest. And if you're worried about CVE's, well, you'll be using handwritten, hand delivered notes before long. Keep your systems patched, keep them tidy, none of this is likely to affect you, fail2ban or not.

pandog|2 years ago

To put it another way - there is no security risk that fail2ban helps with that can't be resolved in another, better, more robust and less risky way.

omginternets|2 years ago

I'm rather convinced that people reaching for fail2band actually want rate-limiting.

ivlad|2 years ago

Often, they do, however configuring it for different applications may be a bigger effort than doing so via fail2ban with minimal log parser tweaking.

koito17|2 years ago

Yup. I see many resources for self-hosting recommend fail2ban for e.g. SSH. But I always disable password-based SSH logins on all of my computers. The one niche use case I can see for fail2ban is possibly reducing the amount of hits to /wp-login.php and /cgi-bin in your web server (or reverse proxy's) access logs.

callalex|2 years ago

Doesn’t it help to mitigate DoS type attacks by reducing the amount of CPU that a bad actor can burn?

pandog|2 years ago

If someone is performing a denial of service attack from one I.P. address then this will help.

To tptacek's point, you've got to ask yourself is a denial of service attack in your threat model?

The reality is most folk set up fail2ban after seeing auth failures in their logs, not service degradation.

If you're considering a denial of service attack in your threat model, then I'd probably also consider a DDoS attack and there are likely more effective solutions here (a firewall or CDN).

And don't forget you're using some of those precious CPU cycles to parse the auth logs, with python no less :-)

discreditable|2 years ago

You can do it with ufw limit too

BrandoElFollito|2 years ago

Absolutely agree. Fail2ban, sooner or later, bans you from your services becasue something in the configuration went wrong.

It does not protect against anything serious: you must have proper credentials/MFA or certificates and therefore bots can check as much as they want.

There is no protection against DoS either.

And I agree about moving the port - I only see a tiny activity in my logs coming from bots when my ssh port moved away. Obviously 443 is there to stay (this is a public service) so I will get whatever comes.

autoexec|2 years ago

One nice thing I'll say about fail2ban is that it can fire off reports with decent logs to the networks responsible alerting them to compromised systems and bad actors.

dizhn|2 years ago

I agree that almost all use cases of fail2ban are little more than feel-good exercises.

Failed login attempts (the noise) are not where bad things happen. What we should be concerned with is if the attempt succeeds but is not from a legitimate user. fail2ban is no help there.

Having said that it might be a decent way to collect IPs. At one point I was distributing the collected IPs from VMs and blocking them for the whole network. fail2ban does provide mechanisms to do this.

w0z_|2 years ago

[deleted]

stjohnswarts|2 years ago

You can point out you think someone is wrong without personal attacks. That's being an adult.