Another good reason not to open port 22 - eviltoast

In the past two weeks I set up a new VPS, and I run a small experiment. I share the results for those who are curious.

Consider that this is a backup server only, meaning that there is no outgoing traffic unless a backup is actually to be recovered, or as we will see, because of sshd.

I initially left the standard “port 22 open to the world” for 4-5 days, I then moved sshd to a different port (still open to the whole world), and finally I closed everything and turned on tailscale. You find a visualization of the resulting egress traffic in the image. Different colors are different areas of the world. Ignore the orange spikes which were my own ssh connections to set up stuff.

Main points:

  • there were about 10 Mb of egress per day due just to sshd answering to scanners. Not to mention the cluttering of access logs.

  • moving to a non standard port is reasonably sufficient to avoid traffic and log cluttering even without IP restrictions

  • Tailscale causes a bit of traffic, negligible of course, but continuous.

  • barsoap@lemm.ee
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    If someone finds a 0day in your SSH server and goes on drive-by attacking the whole internet you’re toast.

    Already moving off port 22 reduces much of the risk, essentially reducing the attack surface for drive-by attacks to zero while still being susceptible to targeted attacks – that is, still susceptible to attackers bothering to scan the whole range. Anything that makes you unscannable (VPN, portknockd, doesn’t matter) mitigates that. Even state-level actors would have to be quite determined to get through that one.

    Yes it’s security through obscurity. Yes it’s a good idea: There’s a difference between hiding your unlocked front door and hiding your military-grade front door lock, one of them is silly the other isn’t.