Skip to main content

UFW

General Info

By default, UFW is set to deny all incoming connections and allow all outgoing connections. This means anyone trying to reach your server would not be able to connect, while any application within the server would be able to reach the outside world. 

So make sure to allow ssh before enabling UFW!!! UFW requires you to add / deny ports in a certain order, if you want to allow a certain ip access a port but deny access by everyone else, the ip must be allowed first then deny all after


Setup

 sudo apt update && sudo apt install -y ufw

 

Basic Management

Turning UFW on: 

ufw enable

Turning UFW off: 

ufw disable

Check if UFW is enabled or disabled

sudo ufw status