UFW Filewall Guide

From D-Wiki

UFW Filewall Guide

UFW is a front-facing firewall program for different Linux distros, which can be used to restrict access to different parts of your server.

Installation

apt install ufw

Usage

With ufw status verbose you can check the status of the firewall and from which server ports (and therefore which services) are allowed to be made a request at.

ufw allow {PORT} is used to allow requests to a port.

ufw deny {PORT} is used to automatically deny all requests to a port. (You can also use ufw deny from {IP_ADDRESS} to block certain IP-Addresses)


For the ports you can also use pre-defined values instead of concrete ports and ufw will do the rest automatically. Examples: https, http, smtp, imap etc.

Usage of that: ufw allow https