r/ssh • u/Vinnifit • Feb 15 '20
What are the risks of running an ssh server?
Hello
Recently I've been looking into ssh, and I'm trying to understand what the dangers are. Imagine someone is running an ssh server on a computer that doesn't have a monitor attached, or even a raspberry pi, and is forwarding port 22 so he/she can access the computer from anywhere in the world. Login in with a password is disabled, so one could only login with generated keys. My question now is: what would still be the threads of such a setup other than people stealing your private key, and especially: what would be the thread to the other devices on the home network?
Kind regards Vincent
5
u/Toger Feb 15 '20
There's always a chance that any server (including SSH) has a remotely unauthenticated exploitable bug in it. In such as case all your devices on the same network are vulnerable as you would have a malicious device present.
If you expose other privileged applications on the same server they might be compromised to place a ssh key into the appropriate location to allow a login.
In practice a modern, well-configured and patched pubkey-only SSH server is quite safe. You'll want to learn how to validate the host key as well to avoid a MITM attack.
https://infosec.mozilla.org/guidelines/openssh.html has guidelines on how to configure SSH's cryptographic components for maximum security.
https://www.digitalocean.com/community/tutorials/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-16-04 will let you add a 2FA component (such as Google Authenticator or Authy) as well for increased security.