5 ms·
I never understood why people would use fail2ban or similar approaches. Just set proper password and move on. SSH traffic is tiny, it's not a problem. You'll ne
by vbezhenar 9y ago
I never understood why people would use fail2ban or similar approaches. Just set proper password and move on. SSH traffic is tiny, it's not a problem. You'll never be hacked with a proper password. Let them waste their time.
- deleted 9y ago[deleted]
- vxl 9y agoThe failed attempts make it harder to monitor for other attacks because of the noise in log files, network traffic, etc. and if an attacker IP is blocked early they can't try more effective attacks.
- Krasnol 9y agoI've set up a second obstacle by allowing access to the device from a certain range of IPs on the router. Cleaned up the log pretty good.
- seldomcomment 9y agologins can be delayed [0] and TOTP can be used in conjunction with SSH (without google authenticator) [0] https://unix.stackexchange.com/questions/105553/how-to-provide-login-delay-in-ssh#105559 https://unix.stackexchange.com/questions/105553/how-to-provi... edit: quick and dirty notes of my setup [1] [1] https://pastebin.com/yYzSrM61 https://pastebin.com/yYzSrM61
- zAy0LfpBZLC8mAC 9y agoExcept actual attacks don't show up in logs anyway, so it's still pointless? The SSH daemon logs when it successfully rejects an access. A successfully rejected access is inconsequential to your security. If you are using secure passwords or pubkey authentication, it will never log a successful login by an attacker. What remains then is exploitation of the SSH server ... but the SSH server doesn't have a code path that logs "I have been exploited".
- A2017U1 9y ago/etc/sshrc executes before a successful ssh login, you can use that to be notified before an attacker has any access to log files
- zAy0LfpBZLC8mAC 9y ago... so? How does that contradict what I wrote?
- nhooyr 9y agoAnother more secure option is just to only allow key auth.
- daenz 9y agoI think you mean just use key-based authentication only ;)
- vuln 9y agoPort knocking + key-based auth... What more do you need?
- lkurusa 9y agoWhat benefit does port knocking add to having a key auth only setup?
- asmithmd1 9y agoWhat benefit does locking the glass doors into a bank add to having time-locked vault? Defense in depth.
- s3m4j 9y agoA port knock is just a clear password :/ I much prefer restricting port 22 to a few ip and disable passwords
- lakechfoma 9y agoNot with single packet authentication from fwknop http://www.cipherdyne.org/fwknop/docs/fwknop-tutorial.html#what-is-SPA http://www.cipherdyne.org/fwknop/docs/fwknop-tutorial.html#w...
- Operyl 9y agofwknop has a cache to prevent replay attacks, that plus the fact the packets are only valid for a certain length of time pretty much thwarts this. Remember, fwknop is _in addition_ to your existing security practices, it is not the only "password."
- rsync 9y ago"A port knock is just a clear password" It is only clear to the routers in your traceroute ... third party attackers cannot snoop on this traffic.
- 9y ago
- pm215 9y agoI originally set up fail2ban because I got fed up with the noise of the hard disk going tick...tick...tick every 15 seconds or so, as another password guessing bot login attempt got logged and the disk heads had to seek as the logfile was written out to disk...
- kuschku 9y agoI have SSH with key auth everywhere, so I have no security worries. But when sshd ends up pegging an entire core, and I can't login myself anymore, then fail2ban (or even whitelisting IP ranges for ssh) becomes necessary.
- hh3k0 9y agoIt would most probably never end up pegging an entire core if you use key auth and have conventional logins deactivated, no? I mean, why would people even try.
- sophacles 9y agoKeys, like passwords, can be leaked, so it's possible there are databases of leaked keys out in the world, because unlike PGP or SSL certs, ssh keys don't have a revocation mechanism built in. So they could just try all the known leaked keys - like they try known leaked or default passwords. Then there was this: https://jblevins.org/log/ssh-vulnkey https://jblevins.org/log/ssh-vulnkey (tl;dr - there was a bug in debian that caused ssh-keygen to only produce a very small number of keys rather than keys distributed across the whole keyspace). After that became public the bots were all about trying those keys for a few years after. To this day it's recommended to not used keys from that set. Point being - the bots will try because it the tiny marginal cost is not high enough to stop the attempt.
- kuschku 9y agoThey simply try password auth, and fail with a message that password auth is off. Constantly. All the time.
- purple-again 9y agoSet up a non standard port. This will stop over night.
- kuschku 9y agoIt has stopped now (I simply removed port 22 from the whitelist except for connections originating with my home ISP, which is a local ISP where abuse reports actually work)
- beagle3 9y agoDo you ever examine logs? Fail2ban (or even better, using a nonstandard port or both) keep the noise out of lots to the point that you can still examine them manually. Without it, 99.99% of the average ssh log is failed back attempts.
- nerdponx 9y agoChanging the port away from 22 also had that effect in my experience.
- purple-again 9y agoThis was like night and day. Non stop constant barrages on the default port, all quiet on the ssh k@ip -p XXX.
- yjftsjthsd-h 9y agoI found that setting the port and user in ~/.ssh/config made everything way easier. Also fill in the IP as HostName if you're not using DNS names.
- larkeith 9y agoYou aren't infallible. While it's easy enough to secure a minimal server with only SSH access, every time you add another service, provide access to a new user, or change a configuration, there's a chance you'll miss something or make a dumb mistake. Running Fail2Ban is a very cheap and easy method to ensure that, even if you do fuck up somewhere, there's another layer of security that should prevent malicious access in most cases (nothing will save you if you set the pass to admin/admin, e.g.).
- ryanlol 9y agoBecause fail2bans approach to log parsing is totally sane and confidence inspiring, right?
- cup-of-tea 9y agoI did just to keep the logs cleaner.
- pbhjpbhj 9y agoLargely, I think, moving to an alternate port cut SSH crack attempts to near zero; but I use fail2ban too.