Fedora的firewall-cmd显示比configuration更多的可用服务

所以是的,configurationFedora 20的firewall-cmd。 试图限制入站stream量只有http,https和ssh。 但是,机器仍然响应ping,而–get-service命令显示了我不使用的东西的清单。

为什么断开连接?

–get-service命令是否准确,或者是–list-services命令是否准确?

如果是后者,为什么ping能够通过?

[root@build-node httpd]# firewall-cmd --get-service amanda-client bacula bacula-client dhcp dhcpv6 dhcpv6-client dns ftp high-availability http https imaps ipp ipp-client ipsec kerberos kpasswd ldap ldaps libvirt libvirt-tls mdns mountd ms-wbt mysql nfs ntp openvpn pmcd pmproxy pmwebapi pmwebapis pop3s postgresql proxy-dhcp radius rpc-bind samba samba-client smtp ssh telnet tftp tftp-client transmission-client vnc-server wbem-https [root@build-node httpd]# firewall-cmd --get-active-zone public interfaces: eth0 eth1 eth2 [root@build-node httpd]# firewall-cmd --zone=public --list-services http https ssh 

另外,摘自iptables -L -n。

 Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 INPUT_direct all -- 0.0.0.0/0 0.0.0.0/0 INPUT_ZONES_SOURCE all -- 0.0.0.0/0 0.0.0.0/0 INPUT_ZONES all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain INPUT_ZONES (1 references) target prot opt source destination IN_public all -- 0.0.0.0/0 0.0.0.0/0 [goto] IN_public all -- 0.0.0.0/0 0.0.0.0/0 [goto] IN_public all -- 0.0.0.0/0 0.0.0.0/0 [goto] IN_public all -- 0.0.0.0/0 0.0.0.0/0 [goto] Chain IN_public_allow (1 references) target prot opt source destination ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 ctstate NEW ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:443 ctstate NEW ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 ctstate NEW 

--get-service显示firewalld意识到的所有服务,而不是那些已经打开端口的服务。

--list-services显示那些你已经打开的端口。

你可以在iptables列表中看到只有端口22,80和443是打开的,这就是你说的你想要的。

最后,关于ping:默认情况下允许所有的ICMP与firewalld(因为除非你真的知道你在做什么,否则通常是一个坏主意)。 如果你真的想“阻止”ping,那么你必须明确地这样做。 您可以使用--get-icmptypes来查看firewalld知道的ICMPtypes列表,以及--add-icmp-block来阻止其中的一个。 确保你在机器的控制台上,以防你自己locking。