Mastering Linux Security and Hardening
上QQ阅读APP看书,第一时间看更新

Uncomplicated firewall for Ubuntu systems

The ufw is already installed on Ubuntu 16.04 and Ubuntu 18.04. It still uses the iptables service, but it offers a vastly simplified set of commands. Perform just one simple command to open the desired ports and another simple command to activate it, and you have a good, basic firewall. Whenever you perform a ufw command, it will automatically configure both the IPv4 and the IPv6 rules. This alone is a huge time-saver, and much of what we've had to configure by hand with iptables is already there by default.

There's a graphical frontend that you can use on desktop machines, but since we're learning about server security, we'll just cover the command-line utility here.

ufw is available for Debian, and other Debian-based distros, but it might not be installed. If that's the case, install it by using the  sudo apt install ufw command.