use*_*751 3 fedora firewalld fedora-20
所以是的,配置 Fedora 20 的 firewall-cmd。试图将入站流量限制为仅 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
Run Code Online (Sandbox Code Playgroud)
此外,摘自 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
Run Code Online (Sandbox Code Playgroud)
--get-service
显示 firewalld 知道的所有服务,而不是您已为其打开端口的服务。
--list-services
显示您已为其打开端口的那些。
您可以在iptables
列表中看到只有端口 22、80 和 443 是开放的,这就是您所说的。
最后,关于 ping:默认情况下,firewalld 允许所有 ICMP(因为阻止它通常是一个坏主意,除非您真的知道自己在做什么)。如果您真的想“阻止 ping”,那么您必须明确地这样做。您可以使用--get-icmptypes
查看 firewalld 知道的 ICMP 类型列表,并--add-icmp-block
阻止其中之一。确保你在机器的控制台上,以防你把自己锁在外面。
归档时间: |
|
查看次数: |
17092 次 |
最近记录: |