Secure your vServer: basic protection in 5 steps | Speed-Net

Secure your vServer: basic protection in 5 steps

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.

⏱️ Timeapprox. 30 minutes
📊 DifficultyAdvanced
🧰 You needRoot access via SSH and access to the vServer Control Panel (see welcome email)
💡 Tip
First create a backup in the vServer Control Panel. If you accidentally lock yourself out in step 2, you can get back onto the server via the VNC console.
1

Update the system

Install all updates and set up automatic security updates.

SystemCommand
AlmaLinux / Rocky Linuxdnf -y update and for automatic updates dnf -y install dnf-automatic and systemctl enable --now dnf-automatic.timer
Ubuntu / Debianapt update && apt -y upgrade and apt -y install unattended-upgrades
2

Log in with an SSH key

  1. Store your SSH key in the vServer Control Panel or in the file ~/.ssh/authorized_keys.
  2. Test logging in with the key in a second window.
  3. Only then set the line PasswordAuthentication no in the file /etc/ssh/sshd_config and restart SSH with systemctl restart sshd.
⛔ Warning
Only switch off password login once logging in with the key works reliably. Otherwise you lock yourself out.
3

Install Fail2ban

Fail2ban automatically blocks IP addresses that enter a wrong password too often.

SystemCommand
AlmaLinux / Rocky Linuxdnf -y install epel-release && dnf -y install fail2ban
Ubuntu / Debianapt -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.

How to check that everything works

Log in via SSH with your key in a new window. With fail2ban-client status sshd you see whether Fail2ban has already blocked addresses.

Common problems and solutions

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.

Further help

Stuck? Create a support ticket in the Support Center. We are happy to help.