Security hardening.

When I audited my servers, several services were reachable from the internet that didn’t need to be, and some didn’t need to run at all. I removed what I didn’t need and locked down the rest.

Before and after

What the internet could reach, and what it can reach now.

Before

  • Several services reachable from the internet
  • Services running that I didn’t use
  • SSH accepting passwords
  • No firewall
  • Security updates installed by hand

After

  • One game port open to the internet
  • A few narrow routes for client proofs and payments
  • Everything else private over Tailscale
  • Unused services removed
  • SSH keys only, plus Tailscale SSH on the main server
  • Firewall on
  • Security updates install automatically

What I did

  1. 1

    Removed what I didn’t need

    Anything I wasn’t using, I uninstalled.

  2. 2

    Moved the rest behind Tailscale

    Services I use myself are reachable only from my own devices over my private network.

  3. 3

    Locked down SSH

    On the main server, SSH over Tailscale goes through Tailscale SSH, which checks my Tailscale identity again in the browser before letting me in. On the home network, its own SSH accepts keys only. The media server accepts keys only everywhere, over Tailscale or not, and refuses passwords.

  4. 4

    Turned on firewalls

    Each server blocks incoming traffic unless I’ve allowed it on purpose.

  5. 5

    Turned on automatic security updates

    Security fixes install on their own instead of waiting for me to remember.

The setting that wasn’t taking effect

Each server’s key-only rule lives in its own SSH config. On the main server it covers connections from the home network; on the media server it covers all of them. SSH reads its config files in order and keeps the first value it finds for each setting. I’d turned password login off in my file, but a default file that ships with the OS loaded first and turned it back on. I renamed my file so it loads first, then checked that password login was actually off.

# SSH reads these files in name order. The first value it finds wins.
00-hardening.conf    mine, renamed so it loads first
50-cloud-init.conf   ships with the OS, sets PasswordAuthentication yes

# Then check what SSH is actually using
$ sudo sshd -T | grep -i passwordauthentication
passwordauthentication no

Tradeoffs

Every choice here trades some convenience for security. I made those trades on purpose, and I revisit them when something on the network changes.

Questions about the setup?

I’m happy to talk through how it’s locked down.

Get a quote