16

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.

6 Answers 6

19

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
6

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
5

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.

2

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

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

1
  • 3
    Welcome to Super User. While this link may answer the question, it is preferred to spell out the elements that are relevant that help the OP and reference the link. Links get broken and then your answer is well....not an answer, but a broken link.
    – Carl B
    Commented Jul 14, 2014 at 5:51
0

tested on fedora 21

gufw + ufw:

mkdir gufw

cd 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.*.tar.gz

cd gui-ufw-15.10.0/

echo '[home_zhonghuaren]
name=RPM Sphere (Fedora_21)
type=rpm-md
baseurl=http://download.opensuse.org/repositories/home:/zhonghuaren/Fedora_21/
gpgcheck=1
gpgkey=http://download.opensuse.org/repositories/home:/zhonghuaren/Fedora_21/repodata/repomd.xml.key
enabled=1' > /etc/yum.repos.d/zhonghuaren_suse_gufw.repo

yum install ufw
systemctl enable ufw
systemctl start ufw
chkconfig ufw on
ufw enable
ufw status
ufw default deny incoming
ufw default allow outgoing

                                                                                                                                                        #ufw default deny outgoing 1


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


python setup.py install --prefix=/usr


systemctl disable firewalld
systemctl stop firewalld
chkconfig firewalld off

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




3 http://pantestmb.blogspot.com/2013/04/fedora-18-disable-firewalld-install.html
2 http://translate.google.com/translate?hl=en&sl=es&u=http://heperdidolarazon.neq3.com/%3Fp%3D332&prev=search
1 https://www.digitalocean.com/community/tutorials/how-to-setup-a-firewall-with-ufw-on-an-ubuntu-and-debian-cloud-server

http://pastebin.com/raw.php?i=TX7jBNfD

2
  • 2
    The question asked about CentOS, if they are wholly compatible please explain so that other users not so knowledgeable my understand. Some other detail may also be helpful. Other than that i relay this message from Carl B. Welcome to Super User. While this link may answer the question, it is preferred to spell out the elements that are relevant that help the OP and reference the link. Links get broken and then your answer is well....not an answer, but a broken link. – Carl B
    – mic84
    Commented Jun 19, 2015 at 10:05
  • these build instructions work on fedora 21 when built on centos, centos uses gtk 3.8.8 in order for gufw to run on centos it requires gtk 3.10 when trying to build gtk 3.10 it pulls alot of other dependencies which require matching versions might be possible with building from gtk 3.10 source or using external packages
    – gufw
    Commented Jun 19, 2015 at 21:11
0

In CentOS 7, run following commands:

sudo yum install epel-release -y
sudo yum install --enablerepo="epel" ufw -y

Then enable ufw

ufw enable 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .