FirewallD区域评估顺序

时间:2019-12-04 22:10:07

标签: firewalld

我今天花费了几个小时来尝试为SSH访问设置防火墙规则。我有多个自定义区域,如下所示。出于安全原因,我已更改了大多数IP地址。

firewall-cmd --get-active-zones
web-zone
  interfaces: eth0
  sources: 160.1.100.0/21 10.0.0.0/8 194.1.1.0/24
ssh
  sources: 194.1.1.3
admin
  sources: 160.1.1.3
etranscripts
  sources: 55.164.111.101 55.164.84.100

web-zone (active)
  target: default
  icmp-block-inversion: no
  interfaces: 
  sources: 160.1.100.0/21 10.0.0.0/8 194.1.1.0/24
  services: 
  ports: 9060/tcp 9070/tcp
  protocols: 
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules: 

ssh (active)
  target: default
  icmp-block-inversion: no
  interfaces: eth0
  sources: 194.1.1.3
  services: 
  ports: 22/tcp
  protocols: 
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules: 

根据这些规则,人们会认为我可以从194.1.1.3 SSH到服务器,但是我不能。仍然很陌生,如果我更改了网络接口绑定的区域,则可以将ssh放入服务器。

[root@dev-banapp03 ~]# firewall-cmd --remove-interface=eth0 --zone=web-zone --permanent
The interface is under control of NetworkManager, setting zone to default.
success
[root@dev-banapp03 ~]# firewall-cmd --add-interface=eth0 --zone=ssh --permanent
The interface is under control of NetworkManager, setting zone to 'ssh'.
success
[root@dev-banapp03 ~]# firewall-cmd --get-active-zones
web-zone
  sources: 160.1.100.0/21 10.0.0.0/8 194.1.1.0/24
ssh
  interfaces: eth0
  sources: 194.1.1.3
admin
  sources: 160.1.1.3
etranscripts
  sources: 55.164.111.101 55.164.84.100

很明显,对区域评估应用了某种顺序,但是我不知道它是什么,并且我也没有找到任何好的文章。有人可以告诉我怎么回事吗?

〜鲍勃

1 个答案:

答案 0 :(得分:0)

活动区域内的处理顺序

界面,源IP,默认区域...