作为系统强化的一部分,我正在尝试在CentOS 6.6 kickstart中configuration防火墙。 它确实在一种情况下工作,否则它不会。
Kickstart防火墙
firewall --enabled --service=ssh --service=http --service=https --port=53:udp,69:udp,25150:tcp,25151:tcp,3306:tcp
这告诉它启用防火墙,并打开一些特定的服务。 换行是为了可读性,而不是configuration的一部分。
我的软件包部分如下,请注意:如果我添加–nobase选项,iptables处于直通模式,没有configuration的跟踪。
只要我删除–nobase ,iptables设置正确,只有定义的一组开放端口。
Kickstart包:
#%packages --nobase --excludedocs %packages --excludedocs @core yum wget openssh-server yum-downloadonly screen sysstat lsscsi ntpdate rudder-agent -nano -selinux-policy -selinux-policy-targeted
我做了很多重新安装来跟踪这个,并通过谷歌search,发现有相当多的人结合 – 无线和防火墙 – 启用 – 端口设置。
另外,fyi:将iptables添加到软件包列表并没有做出差异。 – 它是自动添加的。
如果您想知道,最终应用程序的SW供应商不允许启用SELinux。
防火墙输出1
这是基地被添加时的输出:
[host]# iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT icmp -- anywhere anywhere ACCEPT all -- anywhere anywhere ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:http ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:https ACCEPT udp -- anywhere anywhere state NEW udp dpt:domain ACCEPT udp -- anywhere anywhere state NEW udp dpt:tftp ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:25150 ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:25151 ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:mysql REJECT all -- anywhere anywhere reject-with icmp-host-prohibited Chain FORWARD (policy ACCEPT) target prot opt source destination REJECT all -- anywhere anywhere reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT) target prot opt source destination
防火墙输出2
这是当我用–nobase:
[host]# iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination
问题 :
基本上,我只想填补缺less的依赖。 如果没有办法find它,我会把iptablesconfiguration置于OS安装以外的东西的控制之下。 我想避免这种情况,以便防火墙configuration在第一次启动,并由默认机制生成,而不是一些插件。
您需要添加system-config-firewall-base软件包,该软件包提供用于在kickstart期间configuration防火墙的lokkit命令。
6.6之前的RHEL / CentOS版本自动包含这个包,请参阅https://bugs.centos.org/view.php?id=7956和https://bugzilla.redhat.com/show_bug.cgi?id=1161682讨论这个问题。