我刚安装了Fedora 23 Server。 我有一个默认创build的单个区域:
# firewall-cmd --get-active-zones FedoraServer interfaces: eth0
如果我添加一个服务到这个区域,它工作正常:
# firewall-cmd --zone=FedoraServer --add-service=http success # firewall-cmd --zone=FedoraServer --list-all FedoraServer (default, active) interfaces: eth0 sources: services: dhcpv6-client http ssh ports: masquerade: no forward-ports: icmp-blocks: rich rules:
但运行firewall-cmd --reload时会丢失。
如果我试图使这个答案build议永久,我得到以下错误:
# firewall-cmd --zone=FedoraServer --add-service=http --permanent Error: INVALID_SERVICE: 'cockpit' not among existing services
我很惊讶,因为这是来自OVH模板的全新安装。
如何解决这个错误?
正如迈克尔·汉普顿在评论中所build议的,这似乎是特定于OVH Fedora 23服务器模板的。
我在/etcsearch了cockpit ,发现了以下文件:
/etc/firewalld/zones/FedoraServer.xml
其中包含以下几行:
<?xml version="1.0" encoding="utf-8"?> <zone> <short>Public</short> <description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description> <service name="ssh"/> <service name="dhcpv6-client"/> <service name="cockpit"/> </zone>
我删除了这一行,并保存该文件:
<service name="cockpit"/>
现在它的作品!
他们基本上似乎已经添加了一个默认的服务firewalld,这是没有安装在他们的模板。