A vServer is reachable on the internet from the first minute and is automatically scanned for vulnerabilities. With these five steps you close the most common gaps.
| ⏱️ Time | approx. 30 minutes |
| 📊 Difficulty | Advanced |
| 🧰 You need | Root access via SSH and access to the vServer Control Panel (see welcome email) |
| 1 | Update the system |
Install all updates and set up automatic security updates.
| System | Command |
|---|---|
| AlmaLinux / Rocky Linux | dnf -y update and for automatic updates dnf -y install dnf-automatic and systemctl enable --now dnf-automatic.timer |
| Ubuntu / Debian | apt update && apt -y upgrade and apt -y install unattended-upgrades |
| 2 | Log in with an SSH key |
~/.ssh/authorized_keys.PasswordAuthentication no in the file /etc/ssh/sshd_config and restart SSH with systemctl restart sshd.| 3 | Install Fail2ban |
Fail2ban automatically blocks IP addresses that enter a wrong password too often.
| System | Command |
|---|---|
| AlmaLinux / Rocky Linux | dnf -y install epel-release && dnf -y install fail2ban |
| Ubuntu / Debian | apt -y install fail2ban |
Enable the service with systemctl enable --now fail2ban.
| 4 | Set up the firewall |
Only allow the ports you really need, for example 22 for SSH and 80 and 443 for websites. The easiest way is a firewall plan in the vServer Control Panel.
| 5 | Regular backups |
Create a backup in the vServer Control Panel before every major change, and additionally back up important data in a second location.
Log in via SSH with your key in a new window. With fail2ban-client status sshd you see whether Fail2ban has already blocked addresses.
After the change I can no longer access the server via SSH.
Open the VNC console in the vServer Control Panel, log in there as root and set PasswordAuthentication yes back.