Ubuntu quick firewall configuration

Quick instructions for enabling firewall on Ubuntu using Uncomplicated Firewall (ufw). The resulting rules are quite obvious. Incoming traffic is denied, except for ssh, http and https (these refer to /etc/services) and outgoing is allowed.

These policies do not affect ICMP. Incoming ICMP remains allowed as per default ufw settings.

sudo apt-get install ufw
sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw enable