我将不胜感激一些帮助configurationfirewalld请。 这里有一些背景。 我所要做的就是阻止所有的访问 – 除了列入白名单的IP地址到https上运行的Web应用程序。
我做了很多Googlesearch。 了解了一些东西,但没有一个工作。 这是我所做的:
我可以告诉firewalld正在运行
# systemctl status firewalld firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled) Active: active (running)
也与
# firewall-cmd –state running
我有默认区域
# firewall-cmd --get-zones block dmz drop external home internal public trusted work
我的活动区域包括:
# firewall-cmd --get-active-zones public sources: 192.72.0.193 192.72.0.0/22 94.27.256.190
我的默认区域是公开的:
# firewall-cmd --get-default-zone public
公众的细节是:
public (default) interfaces: sources: 192.72.0.193 192.72.0.0/22 94.27.256.190 services: http https ssh ports: masquerade: no forward-ports: icmp-blocks: rich rules:
我的理解是,上面公共区域的configuration将只限制授予来自任何指定IP地址的请求。 但是,当我尝试从列表之外的IP访问https://www.example.com时,它允许它。
一个选项是从区域中删除服务:https
firewall-cmd --zone=public --remove-service=https
然后使用所谓的丰富规则来指定[IP地址]可以访问哪些服务(如http和https),如下所示:
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="xxx0/24" service name="https" log prefix="https" level="info" accept'
可能需要重新加载