Is it possible to put UFW on CentOS?

If so, how would I do it?

If not, is there an easier way to set some basic rules on CentOS other than iptables?

I'm more of an app developer and less of a sys admin.


Solution 1:

Since ufw is available in the EPEL repository, it can be directly installed as a package:

yum install -y epel-release
yum install -y ufw

Solution 2:

While I am not sure if UFW can be ported easily you can try an alternative

  1. yum install system-config-firewall-tui
  2. system-config-firewall-tui
  3. Select Enabled
  4. Choose Customize (tab between elements in NCurses Dialog, use space to select)
  5. Now use down arrow to navigate list, space to enable/disable the port
  6. Choose Close
  7. Choose Ok

You will now have your firewall setup and this will be enabled on every reboot.

Solution 3:

I can confirm this works on CentOS 7 for users who want to use gufw + ufw instead of firewalld

cd /etc/yum.repos.d/

wget http://download.opensuse.org/repositories/home:zhonghuaren/Fedora_23/home:zhonghuaren.repo

yum install ufw

cd /home

systemctl enable ufw

systemctl start ufw

chkconfig ufw on

ufw enable

ufw status

ufw default deny incoming

ufw default allow outgoing

or

ufw default deny outgoing


systemctl disable firewalld

systemctl stop firewalld

chkconfig firewalld off





yum install webkitgtk3 gnome-icon-theme-symbolic python-distutils-extra gtk2 gtk2.i686 gtk3 gtk2-devel gtk3-devel python-netifaces intltool

cd a_place_to_build

mkdir gufw

wget https://launchpad.net/gui-ufw/gufw-15.04/15.04/+download/gui-ufw-15.04.4.tar.gz

tar -xvf gui-ufw-15.04.4.tar.gz

cd gui-ufw-15.04.4

as root or sudo -i

python setup.py clean install

cd /usr/bin

cp -rf gufw gufw.orig

cp -rf gufw.pkexec gufw

cp: overwrite ‘gufw’? y

then launch as

$sudo gufw

or

as root gufw 


#(optional)
yum remove firewalld firewall-config firewall-applet

Solution 4:

You should take a look at firewalld. It's more RH friendly.

http://www.reddit.com/r/linux/comments/1ruxwh/is_firewalld_replacing_iptables/