大网数据广告活动
服务器运维问答

Fedora Server 25 firewall issue. Ports 22, 80, 443 blocked at each boot, have to stop firewalld

· 52CE 我爱测

I setup Fedora Server 25 in a VM and used SaltStack to install NextCloud via this walk-thru . The issue I am having is the firewall is too restrictive and is blocking ports 22, 80 and 443. Per the walk-thru creator's suggestion, …

问题原文

原帖链接 · KidACrimson · CC BY-SA 3.0

I setup Fedora Server 25 in a VM and used SaltStack to install NextCloud via this walk-thru. The issue I am having is the firewall is too restrictive and is blocking ports 22, 80 and 443. Per the walk-thru creator's suggestion, I edited the SaltStack "nextcloud.sls" file as follows, but it did not help:
#line108 FedoraServer: firewalld.present: - name: FedoraServer - block_icmp: - echo-reply - echo-request - default: False - masquerade: True - ports: - 22/tcp - 80/tcp - 443/tcp - 9090/tcp

What can I do to open these ports so I don't have to keep stopping the firewalld service at each boot? Thank you.
EDIT: So, even after removing - firewalld from the nextcloud.sls script (under install_network_packages: pk.installed:the firewall is still starting up and blocking all the ports I need. There must be something else in Fedora Server that is overriding the SaltStack script and enabling the firewall...??

已采纳解答

原帖链接 · shodanshok · CC BY-SA 3.0

I don't know SaltStack, but you should be able to permanently open the required ports via firewall-cmd. For example, to permanently open ssh, try the following:

firewall-cmd --add-service=ssh; firewall-cmd --add-service=ssh --permanent

For enabling ICMP and the other services:

firewall-cmd --remove-icmp-block=echo-request
firewall-cmd --remove-icmp-block=echo-request --permanent
firewall-cmd --remove-icmp-block=echo-reply
firewall-cmd --remove-icmp-block=echo-reply --permanent
firewall-cmd --add-service=http
firewall-cmd --add-service=http --permanent
firewall-cmd --add-service=https
firewall-cmd --add-service=https --permanent
firewall-cmd --add-port=9090/tcp
firewall-cmd --add-port=9090/tcp --permanent

I suggest you to first try without the permanent rules. If all works correctly, you can issue the permanent rules and reboot the machine.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-04-12)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。