UFW, acronym for Uncomplicated Firewall , is a service that works like a firewall to be installed on Linux distributions: Ubuntu and Debian. Due to the difficulty of using iptables in a conventional way to manage the opening and closing of ports on your private servers.
A firewall is the most appropriate form of computer security to consider to allow access in and out (outbound) of packet transfer. It is very important due to the multiple threats and new generations of hacking to try to violate ports and accesses.
This tool may (or may not) be default depending on the version of the Debian and Ubuntu distribution, which was specifically developed in order to make iptables firewall management simple. Below you will discover the simple methods of use to create basic rules.
To install UFW is easy.
apt install ufw
Enable firewall: ufw enable
Disable the firewall: ufw disable
Show status: ufw status
Sample Numbered List of Rules: ufw status numbered
Block all inbound traffic: ufw default deny incoming
Allow all incoming traffic: ufw default allow incoming
Block port 22: ufw deny 22
Allow port 22: ufw allow 22
Block port 22 only for a specific person: ufw deny from 22.214.171.124 to any port 22
Here are some important considerations for the job.
1. You need root (sudo) permissions to be able to install and manage the package.
2. UFW is disabled by default.
3. Before activating it, you must allow SSH access so that you are not excluded from your own server: (ufw allow 22) or (ufw allow SSH)
4. The ports required for a web application are port 80 for the http protocol and 443 for the https protocol. You can also enable both by ufw allow "WWW Full"