How to enable ufw on your server

2016-02-15 | #helper, #ubuntu

If you are on Ubuntu, your in luck: it's already there, otherwise install it with "apt-get ufw".

The first and most important thing if you are only connected via SSH: Don't lock yourself out!

Before starting the firewall make sure to open the most basic standard ports for ssh, http and https and deny all the rest:

ufw allow 22

ufw allow 80

ufw allow 443

ufw default deny

Only after this you may proceed to actually start the firewall with

ufw enable

Of course "disable" is the opposite and stops the firewall again. Btw: enable/disable also register ufw to be started/not be started on boot.

To activate verbose logging to /var/log/syslog, enter

ufw logging on

You can have a look at applications that registered themselves automatically to ufw with

ufw app list