Secure the server in 15 minutes
A checklist for administrators: two-factor login for staff, SSH keys, the firewall and fail2ban, account isolation, the web firewall and updates.
A new HF Panel server is already locked down in many ways: the firewall is on, fail2ban bans password guessers, every account has its own Linux user, and every website sits behind a web application firewall. This checklist closes the remaining gaps in about 15 minutes.
You need: an administrator login and root SSH access to the server.
1. Turn on two-factor login for yourself
- In Server Admin, open your username at the top right › Password & security.
- Click Set up two-factor login, scan the QR code with an authenticator app and enter the code. Click Turn on.
- Save the backup codes somewhere safe.
Better still, add a passkey on the same screen: it can't be phished. See Password & security.
2. Require it for all staff
- Open Server Admin › System › Settings.
- Tick Require two-factor login for administrators and resellers.
- Click Save settings.
The setting can only be saved after your own two-factor login is on, so you can't lock yourself out. While you are there, check Risky actions: Another administrator must approve makes account deletes and full restores need a second person. See Approvals.
3. Give staff their own logins
Never share the main admin login. Open Server Admin › Accounts › Staff logins and give each person their own login with Make login. Choose Read-only — see everything, answer tickets unless they really need Full access — a second administrator. See Staff logins.
4. Use SSH keys for root
HF Panel does not change how you sign in to the server itself, so do this once at the command line:
- On your computer, make a key if you have none:
ssh-keygen -t ed25519. - Copy it to the server:
ssh-copy-id root@server.yourdomain.com. - Check that you can sign in with the key in a new terminal window.
- Only then, in
/etc/ssh/sshd_config, setPasswordAuthentication noand restart SSH withsystemctl restart ssh.
Warning: keep your first SSH session open until you have tested the key in a second one. Take a snapshot at your provider first if you are unsure.
Customers sign in to SFTP with their own keys under Control Panel › Security › SSH / SFTP keys.
5. Check the firewall
- Open Server Admin › Security › Firewall.
- In Rules, delete any port you opened for a test and no longer need. The SSH rule shows keeps you logged in and can't be deleted here.
- Under Banned by fail2ban, see who has been guessing passwords. Addresses that fail SSH 5 times are banned for an hour.
To block an attacker everywhere, enter the address or range under Block an IP from the whole server and click Block. See Firewall.
6. Keep accounts apart
-
Open Server Admin › Accounts › Packages and, under CPU & memory limits, click Enforce limits. One busy or hacked site can then no longer slow down the others.
-
Open Server Admin › Security › Account isolation and choose:
Setting Choose Private filesystem view On Private /tmp Each account its own Hide other accounts' processes Hidden SSH access SFTP only, unless customers need a shell -
Click Check first, read the findings, then click Apply.
See Account isolation.
7. Block attacks on websites
- Open Server Admin › Security › Malware & web firewall.
- In Web application firewall, click Block attacks. If you are cautious, run Log only for a few days first and check the activity for false alarms.
- In Malware scanner, keep Scan every account every night ticked and click Save.
8. Stay up to date
- Open Server Admin › Server › HF Panel updates.
- Tick Install new versions automatically at night and click Save.
Then open Server Admin › Server › Server health and fix anything red or amber in the Security group, such as a restart needed after system updates.
9. Check that backups leave the server
A secure server still needs a way back. Follow Back up off-server if you haven't yet.