Skip to content
In-house anti-DDoS, included on VPS, game servers and web hosting · hosted in France · cancel anytime See our plans
CloudFive
Log in

01

What changes on a dedicated server

The basics in the guide securing a Linux VPS still apply. Three points need more attention on a dedicated server:

  • No remote console on most models. On a VPS, a firewall mistake is fixed from the customer area's console; on a dedicated server without iDRAC or IPMI, it requires work on the machine itself. Every SSH or firewall change is therefore made with a session open and, where possible, an automatic rollback.
  • Several services, sometimes a hypervisor. The Proxmox or Virtualizor interface controls every hosted machine: it is the server's most valuable door.
  • Several IP addresses. A service listening on all addresses can be reached on each of them.

Start by listing what is listening:

sudo ss -tulpn

Every line whose local address is 0.0.0.0, [::], * or a public address is exposed. Stop what you do not use (sudo systemctl disable --now nom-du-service) and make anything that only needs local access, such as a database, listen on 127.0.0.1. What must stay active without being public, for example rpcbind on port 111, used for NFS sharing, is closed at the firewall.

02

SSH: keys only, root closed

Prerequisite: your account with sudo already logs in with an SSH key (see first steps on a dedicated server and creating an SSH key). Also add a second key, kept on another device: if your computer breaks down, it is what gets you back onto a server with no console.

Then create /etc/ssh/sshd_config.d/00-durcissement.conf:

PasswordAuthentication no
KbdInteractiveAuthentication no
PermitRootLogin no
AllowUsers alice
  • The name starts with 00 because SSH keeps the first value it reads for each setting: this file is read before the others.
  • AllowUsers only allows the listed accounts: do not forget yours.
  • On a Proxmox cluster (several linked servers), the nodes talk to each other over SSH with root's key: replace no with prohibit-password, which refuses root's password but keeps keys, and add root to AllowUsers.
  • With several IP addresses, ListenAddress 203.0.113.10 restricts SSH to one of them. On Ubuntu, where SSH starts through a systemd socket, changing Port or ListenAddress also requires sudo systemctl daemon-reload then sudo systemctl restart ssh.socket.

Check, then apply, without closing your session:

sudo sshd -t
sudo systemctl restart ssh
sudo sshd -T | grep -Ei 'passwordauth|permitroot|allowusers'

sshd -t prints nothing if the syntax is correct. Then test the connection in a new window: until it succeeds, the original session is your only way in.

03

Firewall: nftables or ufw, with a safety net

Before applying rules, schedule their automatic rollback:

sudo systemd-run --on-active=10min --unit=filet-parefeu /usr/sbin/ufw disable

In ten minutes, the firewall will disable itself. Apply your rules, check in a new window that SSH answers, then cancel the safety net: sudo systemctl stop filet-parefeu.timer. If you locked yourself out, wait: access comes back. With nftables, the safety net becomes /usr/sbin/nft flush ruleset.

With ufw (Debian, Ubuntu):

sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow from 198.51.100.7 to any port 22 proto tcp
sudo ufw allow proto tcp from any to 203.0.113.11 port 80,443
sudo ufw enable
sudo ufw status numbered

The third line restricts SSH to your fixed address (replace the example one). Without a fixed address, use sudo ufw limit 22/tcp, which refuses an address opening 6 or more connections within 30 seconds. The fourth line only opens the web on the site's IP, not on the server's other addresses. A rule without a specific address also applies to IPv6, and ufw delete followed by a number removes a rule.

With nftables, Debian's default firewall, the rules live in /etc/nftables.conf:

#!/usr/sbin/nft -f
flush ruleset

table inet filtre {
  chain entree {
    type filter hook input priority 0; policy drop;
    ct state vmap { established : accept, related : accept, invalid : drop }
    iifname "lo" accept
    meta l4proto { icmp, ipv6-icmp } accept
    ip saddr 198.51.100.7 tcp dport 22 accept
    ip daddr 203.0.113.11 tcp dport { 80, 443 } accept
  }
}

Check with sudo nft -c -f /etc/nftables.conf (nothing is applied), load with sudo nft -f /etc/nftables.conf, then enable loading at boot: sudo systemctl enable nftables. ICMP stays open: IPv6 needs it to work. Use only one of the two tools.

Two traps: the flush ruleset line erases every rule, including Docker's or the hypervisor's, and ports published by Docker bypass ufw. On a Proxmox host, use its built-in firewall (next section) rather than these files.

04

Hypervisor: the 8006 interface and the Virtualizor panel

The Proxmox interface, on port 8006, exposes its whole API. Do not leave it open to the world. The safest way without a console is to restrict it to your addresses in /etc/default/pveproxy, which does not affect SSH:

ALLOW_FROM="198.51.100.7,192.0.2.0/24"
DENY_FROM="all"
POLICY="allow"
sudo systemctl restart pveproxy.service spiceproxy.service

Replace the example addresses with yours. If your address changes, you go back through SSH to fix the file. Even better: only open the interface through a VPN (see creating your WireGuard VPN).

  • The Proxmox firewall is disabled by default. Once enabled at Datacenter level, it blocks all traffic to the host, except the interface and SSH from the "management" IP set: add your addresses to it before enabling, with an SSH session open. Possible safety net: sudo systemd-run --on-active=10min --unit=filet-pve /usr/sbin/pve-firewall stop.
  • Virtual machines have their own rules, separate from the host's: in Proxmox, each network card has its own Firewall box to tick, in addition to the general switch. Otherwise, set up a firewall inside each machine.
  • Accounts: enable two-factor authentication (TOTP or security key), starting with root@pam, and create named accounts with only the rights they need.
  • Virtualizor: the panels use ports 4081 to 4085 (administration on 4084 and 4085). In Settings › Master Settings › Security settings, fill in "Allowed IP list to Access Panel" with your addresses and set the maximum number of login attempts; also enable two-factor authentication for root.

For setting up Proxmox, see Proxmox on a dedicated server and creating a VM on Proxmox.

05

fail2ban, automatic updates and backups

fail2ban temporarily bans addresses that pile up failed logins. On a dedicated server with no console, the line that matters is ignoreip: it keeps you from banning yourself. Install sudo apt install fail2ban python3-systemd, then create /etc/fail2ban/jail.local:

[DEFAULT]
ignoreip = 127.0.0.1/8 ::1 198.51.100.7
bantime = 1h

[sshd]
enabled = true
backend = systemd

backend = systemd reads the systemd journal, because Debian no longer writes /var/log/auth.log by default since version 12. Restart with sudo systemctl restart fail2ban and check with sudo fail2ban-client status sshd.

Automatic updates go through unattended-upgrades, already installed and active on Ubuntu Server. On Debian: sudo apt install unattended-upgrades, then sudo dpkg-reconfigure -plow unattended-upgrades. Leave automatic reboot disabled (Unattended-Upgrade::Automatic-Reboot is false by default): on a machine with no console, reboot yourself, at a time when you can watch it come back. On Proxmox, the default configuration only covers Debian's repositories: update the Proxmox packages yourself, with apt full-upgrade.

Backups are the last line of defence, including against an intrusion that encrypts or deletes your data. They must go to another machine, with access that does not let the backed-up server delete them. On Proxmox, a Proxmox Backup Server installed elsewhere fills this role; otherwise, restic or borg. Test a restore from time to time.

06

On a CloudFive dedicated server: optional anti-DDoS

Neither fail2ban nor a firewall installed on the machine stops a denial-of-service attack: when the network link is saturated, legitimate traffic no longer reaches the server. Filtering has to happen upstream. On our dedicated servers, from €75 per month, anti-DDoS is offered as an option, requested by ticket; the page anti-DDoS dedicated server and the guide anti-DDoS server explain how it works.

  • Console: only the 2x Xeon Gold 6254 has iDRAC access. On the other models, use the safety net for every SSH or firewall change.
  • Network: the Ryzen servers are on our own network, AS218808, with 5, 10 or 20 IP addresses included depending on the model (€1.50 per month for each extra address); remember to filter each of them.
  • Systems: Debian, Ubuntu, Proxmox or Virtualizor on delivery, with full root access; Windows is also possible (ask about the terms when ordering or by ticket), but this guide covers Linux systems. Securing the system and services remains in your hands.
  • Options: anti-DDoS, storage or plan changes are requested by ticket from the customer area manager.cloudfive.fr; support answers in French 7 days a week, by ticket, on Discord and by phone.
07

Frequently asked questions

How do I secure a dedicated server without a remote console?

Always keep an SSH session open during a change, test in a new window and schedule the automatic rollback of firewall rules with systemd-run. Add a second SSH key and put your address in fail2ban's ignoreip so you do not ban yourself.

Should I disable root SSH login on a dedicated server?

Yes, once your own sudo account logs in with a key: PermitRootLogin no and PasswordAuthentication no. On a Proxmox cluster, use PermitRootLogin prohibit-password instead, because the nodes connect to each other with root's key.

How do I protect the Proxmox interface on port 8006?

Restrict it to your addresses with ALLOW_FROM, DENY_FROM and POLICY in /etc/default/pveproxy, then restart pveproxy and spiceproxy, or go through a VPN. Also enable two-factor authentication on root@pam and create named accounts.

ufw or nftables on a dedicated server?

Both work; ufw is simpler, nftables is more precise and is Debian's default firewall. Use only one, and on a Proxmox host, prefer the firewall built into Proxmox.

Does a firewall protect a dedicated server against DDoS attacks?

No. A firewall installed on the machine can do nothing when the network link is saturated: filtering has to happen upstream. At CloudFive, anti-DDoS is offered as an option on dedicated servers, requested by ticket.

Support CloudFive AI

An answer right away, a real team behind it.

CloudFive AI answers you at any hour, in seconds. When it doesn’t know, or as soon as you ask, the team that runs the machines takes over. No offshore call centre.

  • TicketThe team replies in under 2 hours, 7 days a week.
  • CloudFive AIAt any hour, on ia.cloudfive.fr, Discord and in your customer area.
  • DiscordThe team, the AI and other customers, in the help channel.
  • Your data stays with usAI runs on our servers in France; e-mails, IPs and passwords are masked.
A ticket in the customer area: a customer’s question about a Minecraft plugin, and the CloudFive team’s reply
A real ticket in the customer area, answered by the team (demo account; shown in French).
CUSTOMER AREA · APP

Your servers.
At your fingertips.

Restart a server, watch its resources live, pay an invoice or open a ticket — and get an alert when something goes wrong.

  • The status of all your services at a glance
  • Blocked attacks, filtered traffic, monthly peak
  • A notification when a server goes down or an invoice is due

App coming soon · in the meantime, everything works in your browser at manager.cloudfive.fr

The CloudFive app: the list of your services, with their status
The CloudFive app: the home screen, your services’ status, blocked attacks and an invoice to pay