UFW firewall management
ufw
(Uncomplicated Firewall) simplifies the process of setting up firewalls on your server, without directly using iptables
.
sudo apt install ufw
First we deny all incoming requests as the default:
ufw default deny incoming
And allow all outgoing requests as the default:
ufw default allow outgoing
Next we need to allow certain requests based on their port:
Port | Service | Rule |
---|---|---|
22 | SSH | allow |
80 | HTTP | allow |
443 | HTTPS | allow |
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
Enable:
ufw enable
Verify rules:
ufw status --verbose