Simple firewall with UFW
Block incoming traffic, allow only what is useful.
- Install UFW if needed:
sudo apt install ufw
- Default policy:
sudo ufw default deny incoming sudo ufw default allow outgoing
- Allow SSH BEFORE enabling (otherwise you lose access):
sudo ufw allow ssh
- Allow other services then enable:
sudo ufw allow 80,443/tcp sudo ufw enable
- Check:
sudo ufw status verbose