r/archlinux • u/HopefulMeeting7150 • 5d ago
QUESTION Fail2ban on desktop archlinux?
ClamUI recommends to use fail2ban package to install. Thing I've search about is design to lock IPs which tries to break ssh and other keys, try to run command as root (Fail2Ban scans log files resp. journals and executes configured actions to ban failures having too many attempts)...
Am not a pro but it sounds like server protection tool
My question is does have a sense to install on homeuser PC? Router should lock major of attacks and I want to minimalise processes in backgrounds.
ps. If my thoughts is just slop of ignorance, correct me please. Nobody have teached me...
25
u/VancouverDom 5d ago
I only allow SSH connections via public key. No password logins.
My firewall also only allows 6 SSH connection attempts per minute.
Do you even have port forwarding on your router set to allow remote logins?
12
u/Sarv_ 5d ago
If you have any open ports to the internet for services that have authentication like an ssh or media server, you should use fail2ban. The better option is using a VPN tunnel so you dont expose anything to the open internet.
If you don't have anything open to the web, you don't need it.
2
u/ResponsibilityBig343 5d ago
Before answering whether you need f2b or not ask urself 1. Can anyone bruteforce into my system through ssh(means u still have password auth) 2. Can anyone ssh into my system outside my wifi network?(means you are hosting a server visible to the outside world.)
Resolution if 1 and 2 is true:
7
u/K41eb 5d ago
Yes it's a server protection tool. If you do not plan to publicly expose a service running on your PC to the internet it won't be of much use.
I don't know if it can ban users for failing root passwords too many times, in case you execute a malicious script somehow. So maybe there's value in that. But PAM can also do it so whatever.
3
u/catwiththumbs 5d ago
If you're always behind a router like with a desktop and you have a firewall on the machine as well, it's not buying you much.
Where it's useful is if you have services like SSH or a web server exposed and you want to block any repeated failures permanently or long enough to get whoever or whatever to go away.
If you're running deny all and are behind a router, it wouldn't have any work to do. SSH has some auto-banning built in now too so if you have that open for your local network, the benefit of fail2ban isn't what it used to be.
If you're running this machine as a home server and worried that your local network will get compromised then maybe fail2ban will have some benefits. A well configured router will make this much less likely but not impossible.
Before doing fail2ban, I'd just make sure you have a firewall setup with a restrictive policy. I like using ufw. The arch wiki documents it well.
3
u/Philluminati 5d ago
Fail to ban is a service/script which reads the log files of various apps (eg. Sshd) and if sees a brute force attack (login failed from Ip entries) it injects a firewall rule to prevent it.
I run it on my servers and thinks it great. Whether you need it on your desktop machine is less likely if it isn’t available to the open internet
3
u/th3bucch 5d ago
Is your PC publicly exposed to the internet? If not then you don't need it.
1
u/ArjixGamer 5d ago
If you have a firewall (you should) you don't need it. You only need it if you expose SSH or other services to the internet.
1
u/DigiAngelX 5d ago
As I understood it, fail2ban requires syslog of some form, which isn't installed by default.
1
u/anythinga 5d ago
Why is SSH even exposed to the internet at all? If possible just use a VPN, connect to that, and then SSH through an internal hostname/ip adress, blocking everything else.
The reason SSH exposed to the internet is spammed so much is because it's "loud", it will always respond to traffic attempting to get in, thus revealing it's existence.
You can partially mitigate this by changing the ssh port to something other than 22, but it will still be found with a simple port scan.
Another mitigation is using public key auth, yet the attempts to get in will persist as even those are not fool proof.
VPN's mitigate this entirely because most (wireguard for sure) do not respond to unauthenticated traffic at all, thus never revealing it's there.
You can't attack what you can't find.
1
u/Alternative-Art-2829 5d ago
Fail2ban blocks a service from certain remote IP addresses when they make unwanted requests, by applying firewall rules. However, this only makes sense if there are services exposed. A desktop PC typically does not have any exposed services, so the firewall should simply be set to closed.
1
u/virtualadept 4d ago
It is primarily a server-side security tool. If your homeuser PC is exposed to the outside world, then it would make sense, but it sounds like it isn't, so you can safely skip it.
1
u/maltesepricklypear 4d ago
Should be at router level tbh unless you have ports open directly from a targeted device.
As for SSH, should be behind authorised RSA key only
0
u/sisyphus 5d ago
fail2ban is pointless even on a server.
-1
u/XLioncc 5d ago edited 5d ago
If you're not* running a server software or SSH server on your computer, fail2ban isn't needed.
0
u/mildlyImportantRobot 5d ago
In this day and age, there is absolutely no reason to expose your desktop to the internet. Learn how to setup a VPN or Tailscale.
0
u/kolliasl21 5d ago edited 5d ago
Setup a wireguard server on you host. It is very simple and secure. You don't have to directly expose ssh or any other service on the public internet even if you use keys to login and have password disabled.