Every new server I stand up gets the same basic treatment before it does anything else. Here’s the checklist.
- Update everything and turn on automatic security updates (unattended-upgrades on Debian/Ubuntu, dnf-automatic on RHEL-family).
- Create a normal user with sudo and stop working as root.
- SSH keys only. In
sshd_config, setPasswordAuthentication noandPermitRootLogin no. Test a second session before you log out. - Firewall: default deny inbound, then allow only what you need (ufw or firewalld).
- fail2ban to block brute-force attempts.
- Remove what you don’t use. Check listening ports with
ss -tulpnand disable stray services. - Time sync and logging so your logs actually line up when you need them.
- Backups, and test a restore at least once.
- Patch the kernel and reboot when security fixes land. Bugs like this week’s PwnEscape are why.
None of this is fancy, but it stops the vast majority of drive-by attacks.
Happy Hacking!