如果是的话,我该怎么做?
如果没有,除了 iptables 之外,还有其他更简单的方法在 CentOS 上设置一些基本规则吗?
我更像是一个应用程序开发人员,而不是系统管理员。
答案1
由于 ufw 在 EPEL 存储库中可用,因此可以直接将其作为包安装:
yum install -y epel-release
yum install -y ufw
答案2
我可以确认,对于想要使用 gufw + ufw 代替firewalld 的用户来说,这在 CentOS 7 上是有效的
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
答案3
虽然我不确定 UFW 是否可以轻松移植,但你可以尝试其他方法
yum install system-config-firewall-tui
system-config-firewall-tui
- 选择已启用
- 选择自定义(在 NCurses 对话框中的元素之间按 Tab 键,使用空格进行选择)
- 现在使用向下箭头浏览列表,使用空格键启用/禁用端口
- 选择关闭
- 选择确定
现在您已设置好防火墙,并且每次重启时它都会启用。
答案4
在 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