Firewall for ubuntu and debian
Installation
sudo apt install ufw
Policy Setting
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw enable
Allowing Ports/Services
You can either allow the service or the port
Allowing ssh
sudo ufw allow ssh
OR
sudo ufw allow 22
Disabling Firewall
sudo ufw disable