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

List runtime-only changes in firewalld

· 52CE 我爱测

Is there a way to list runtime-only (i.e. no --permanent ) changes in firewalld? I would like to see a diff in my configuration to make sure no change will get lost in case of a --reload .

问题原文

原帖链接 · Iso · CC BY-SA 4.0

Is there a way to list runtime-only (i.e. no --permanent) changes in firewalld? I would like to see a diff in my configuration to make sure no change will get lost in case of a --reload.

已采纳解答

原帖链接 · natxo asenjo · CC BY-SA 4.0

as far as I can see no tool that offers you that possibility, but you can create it yourself.

I add a runtime acl to port 54/tcp:

# firewall-cmd --add-port=54/tcp

Then I can save the runtime rules to a file:

# firewall-cmd --list-all > /tmp/runtime_rules

And I save the permanent rules to another file:

# firewall-cmd --list-all --permanent > /tmp/permanent_rules

Finally I use diff to compare both

# diff /tmp/runtime_rules /tmp/permanent_rules 
1c1
< FedoraWorkstation (active)
---
> FedoraWorkstation
4c4
<   interfaces: wlp2s0
---
>   interfaces: 
7c7
<   ports: 1025-65535/udp 1025-65535/tcp 54/tcp
---
>   ports: 1025-65535/udp 1025-65535/tcp

And there you have the port I added on the runtime rules, not on the permanent one.

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

资料来源与适用范围

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

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

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