A firewall blocks traffic to ports you do not use. Set one up on every VPS.
Ubuntu or Debian: UFW
- Allow SSH first, or you will lock yourself out: ufw allow OpenSSH
- Allow web traffic if needed: ufw allow 80/tcp and ufw allow 443/tcp
- Turn it on: ufw enable
- Check: ufw status verbose
AlmaLinux or Rocky: firewalld
- Check: firewall-cmd --state
- Allow SSH, HTTP and HTTPS: firewall-cmd --permanent --add-service=ssh --add-service=http --add-service=https
- Apply: firewall-cmd --reload
Good practice
- Open only what you need. Keep databases (3306, 5432) closed to the internet. Connect through SSH tunnel or a private rule.
- Use SSH keys. See "How do I set up SSH keys?".
- Consider fail2ban to block repeated failed logins.
- Change defaults only if you understand the effect. Test in a second terminal before closing your first.
Locked yourself out? Open the console in the VPS control panel. It does not use the network firewall. Fix the rule from there.
Cloud firewall Check if the VirtFusion panel offers a network firewall. If so, you can use it in addition to the server firewall.
Still need help?
Ask Zeni in the chat bubble, or open a support ticket. We answer 24/7.