Ubuntu firewall ufw commands
sudo ufw default deny incoming
sudo ufw default deny outgoing
Allow incoming requests from specific ip address to specific port
For example only from [ip] access to ssh
ufw allow from [ip] to any port 22 proto tcp
Allow outgoing requests to specific port. For example allow outgoing email requests
ufw allow out 465
ufw allow out 587
Web, allow incoming and outgoing web trafic
Allow outgoing to port 80 on tcp
ufw allow out proto tcp to any port 80
Allow incoming on port 80
ufw allow in proto tcp to any port 80
Show all rules numbered. Useful for deleting specific rule
ufw status numbered
Delete rule by number
ufw delete [number]
ufw insert 1 allow out to [ip] port 9418 proto tcp
ufw insert 1 allow out 587