IT Manager candidate based in Riyadh. 12+ years in IT operations and infrastructure.
+966 55 973 2392
https://www.islamfathi.com
Riyadh, Saudi Arabia
A short list that closes the easy ways in on a new Debian server: updates, SSH keys, a firewall, fewer open ports and fail2ban.
A server with a public IP address gets probed within minutes of going online. Covering the basics takes an afternoon and a short list, and it removes most of the easy ways in.
Bring the system up to date first, then let it install security updates on its own.
sudo apt update && sudo apt full-upgrade
sudo apt install unattended-upgrades
sudo dpkg-reconfigure -plow unattended-upgrades
Create a regular user, add it to the sudo group and copy your public key to it. Open a second terminal and confirm you can log in with the key before changing anything else.
sudo adduser sysadmin
sudo usermod -aG sudo sysadmin
ssh-copy-id sysadmin@server
Then edit /etc/ssh/sshd_config and set PermitRootLogin no and PasswordAuthentication no. Check the file with sudo sshd -t and reload the service. Keep your first session open until the second one works, so a typo does not lock you out.
ufw is the simplest option on Debian. Allow SSH before you enable it.
sudo apt install ufw
sudo ufw default deny incoming
sudo ufw allow 22/tcp
sudo ufw allow 80,443/tcp
sudo ufw enable
List the listening services and ask whether each one needs to be there.
sudo ss -tulpn
Anything you cannot explain should be removed or limited to localhost.
fail2ban bans addresses that fail logins repeatedly. With key-only SSH it mostly reduces log noise, but it also covers other services you add later. Ship logs to a central place if you have one, since an attacker with root can edit local logs.
Your email address will not be published. Required fields are marked *