UFW firewall rules generator
Choose what your server should accept and get the ufw commands in a safe order: SSH is allowed first and the firewall is enabled last, so your session survives.
Why the order matters
ufw enable starts filtering at once. If SSH is not allowed before that moment, your session freezes and you are locked out. The generator always adds the SSH rule first and enables the firewall last.
Limit or allow
- ufw limit lets normal logins through and blocks addresses that hammer the port. It is a good default for SSH.
- Restricting SSH to your own IP is stronger, but needs a fixed address or a VPN.
- On a web server, open 80 and 443 to everyone and keep the databases private.
ufw and Docker
Docker writes its own iptables rules, so a port published with -p 8080:8080 is reachable even when ufw denies it. Publish it as 127.0.0.1:8080:8080 and put nginx or Caddy in front.
More tools
- VPS ping test
- VPS cost calculator
- chmod calculator
- Cron generator
- Subnet calculator
- SSH key generator
- Bandwidth calculator
- What is my IP
- Cloud-init generator
- SSH hardening generator
- Fail2ban config generator
- WireGuard config generator
- Nginx reverse proxy generator
- Docker Compose generator
- Systemd service generator
- Swap size calculator
- DNS lookup