How to install UFW on Fedora 25 (Uncomplicated Firewall)

Aug 22, 2016

The “Uncomplicated Firewall” was designed to be a simple tool to setup iptables and create a full firewall structure with simple commands.

On this tutorial, learn how to install this powerful tool on your Fedora 25.

Preparations:

On these steps, you’ll install a new firewall manager. So it’s important to disable any other firewall you have on your system.

The following lines will disable the built in Fedora’s firewall and the iptables, if enabled:

su
systemctl stop iptables  
systemctl stop firewall  
exit  

1. Download the UFW

You can check the latest version of UFW on LaunchPad. On this tutorial I’ll show how to install the lastest version on the moment of publication of this post (v0.35).

wget https://launchpad.net/ufw/0.35/0.35/+download/ufw-0.35.tar.gz  
tar xvzf ufw-0.35.tar.gz  
cd ufw*  

2. Compile and install

Now we have the source of UFW. Just run the following lines to install on your system:

su  
python ./setup.py install  

3. Fix permissions

After an installation, many directories doesn’t have the correct permissions for security reasons. You can check these problems by running su -c “ufw status”. To fix all theses security issues, just run:

chmod 751 /etc/default/ufw /lib/ufw/ufw-init /etc/ufw/ufw.conf /sbin/ufw /etc/ufw/applications.d/ufw-mailserver /etc/ufw/applications.d/ufw-chat /etc/ufw/applications.d/ufw-loginserver /etc/ufw/applications.d/ufw-proxyserver /etc/ufw/applications.d/ufw-fileserver /etc/ufw/applications.d/ufw-directoryserver /etc/ufw/applications.d/ufw-printserver /etc/ufw/applications.d/ufw-webserver /etc/ufw/applications.d/ufw-dnsserver /etc/ufw/applications.d/ufw-bittorent  

Check if everything is ok

If for some reason the ufw doesn’t already have enable, just run the command below. To check if everything is working ok, just run su -c “ufw status” and you have to see the message “Status: active”

su -c "ufw enable"  
su -c "ufw status"  

Example:

# Allow access from and to port 22 (used by ssh service)  
 su -c "ufw allow ssh"

# Allow access from and to ports 500 and 4500 using UDP protocol  
 su -c "ufw allow 500/udp"  
 su -c "ufw allow 4500/udp"  

UFW (Uncomplicated Firewall) on Fedora 24 example

How to use

This tutorial I just show you how to install the UFW on Fedora. If you want to learn how to use, I strongly recommend you to check to official Ubuntu documentation about UFW. Just it:

UFW – Community Help Wiki
https://help.ubuntu.com/community/UFW

Need help?

If you have any question, just let me know in the comments below. I will be glad to help you! ^^

References:

Tags

Luiz Costa

I am a senior software engineer at Red Hat / Ansible. I love automation tools, games, and coffee. I am also an active contributor to open-source projects on GitHub.