by thesuperbigfrog · 4y ago · 0 comments
Tools like these are essential if you have Internet-facing SSH services.
If you do not need Internet-facing SSH, do not enable it. It can be an attack vector and there are hundreds of bots that will try to brute-force access within minutes of opening Internet-facing SSH daemon.
Best practices for Internet-facing SSH:
- run on non-standard port (not port 22)
- disable passwords, use SSH passkeys instead: https://www.techrepublic.com/article/how-to-setup-ssh-key-au...
- disable root SSH login
- run fail2ban, sshguard, or similar "block IP addresses for suspicious activity" services
- setup port knocking: https://www.tecmint.com/port-knocking-to-secure-ssh/
edit:
- run WireGuard VPN (https://en.wikipedia.org/wiki/WireGuard) for defense-in-depth
Using telnet makes me feel a little dirty and a lot alive. Using it over wireguard seems like taking a 60s muscle car and adding brakes that actually work before a track day; probably not a bad idea.
Nice! Wireguard was not around when I was using Internet-facing SSH in a previous job.
Adding it to the recommendations.
It is also fairly easy to DoS SSH by having too many connections in the authentication state leaving no slots open, which SSHGuard is useful to counter.
Apart from that, SSH's intrinsic security is the same, but if you have password authentication enabled, you are only as strong as the weakest password.
A number of configurations also ship with ssh root login enabled by default. For example if you setup a new Linode VPS. You need to add a user, remember to at least turn off root access and probably also password access. I get why they're doing it because it easier, but yeah ... not a huge fan of this configuration.
Wireguard is just a very simple network bridge. Whoever has the key can send anything over the network. There isn't a robust mechanism required to keep the key, to revoke it, to audit its use, to enable it to only provide access to specific applications. It doesn't have 1/20th the features SSH has, and SSH itself lacks a bunch of security features.
Bottom line is that you should only use Wireguard if you need a simple encrypted network bridge. It does not remove the need for other more complex security products.
It's really not. It's a technical question with many technical answers, thankfully they were provided by other commenters before you posted this.
If anything, it's similar to asking if a bike is faster than a car, to which you would reply than a bike might be faster in traffic because of small size but slower over long distances because of propulsion. It is possible to compare apples and oranges over specific axes.
Cars and bikes are both fine for point to point travel. They'll each give you a vastly different experience though. It"s prolly better to stick with what you know how to use, in my opinion. You're likely gonna have a bad day if you crash and die.
Edit: deleted false information about TLS.
SSHGuard however is much lighter and even less to configure manually.
I used fail2ban in the past and it was helpful.
If I was currently running an Internet-facing SSH daemon, I would give SSHGuard a try.
Basically security comes with layers of obscurity. Even key based auth is a random string that no one is meant to guess.
If you have more obscurity, the less chance one reaches to the actual attack surface.
If an attacker gains a key, without fail2ban etc, he may try bunch of user names against the key file consecutively but if a login attempt is limited to 3 times every 5 minutes, see it's better than nothing.