Skip to content

Commit

Permalink
fix: add service to reload podman network on firewalld changes
Browse files Browse the repository at this point in the history
addresses #90
  • Loading branch information
bsherman committed Oct 17, 2023
1 parent b0c2e18 commit 01dc61a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions main/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"cockpit-selinux",
"cockpit-storaged",
"cockpit-system",
"dbus-tools",
"distrobox",
"firewalld",
"open-vm-tools",
Expand Down
16 changes: 16 additions & 0 deletions main/usr/lib/systemd/system/podman-firewalld-reload.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# From: https://github.com/containers/podman/issues/5431#issuecomment-1022121559
#
[Unit]
Description=Redo podman NAT rules after firewalld starts or reloads
Wants=dbus.service
After=dbus.service

[Service]
Type=simple
Environment=LC_CTYPE=C.utf8
ExecStart=/bin/bash -c "dbus-monitor --profile --system 'type=signal,sender=org.freedesktop.DBus,path=/org/freedesktop/DBus,interface=org.freedesktop.DBus,member=NameAcquired,arg0=org.fedoraproject.FirewallD1' 'type=signal,path=/org/fedoraproject/FirewallD1,interface=org.fedoraproject.FirewallD1,member=Reloaded' | sed -u '/^#/d' | while read -r type timestamp serial sender destination path interface member _junk; do if [[ $type = '#'* ]]; then continue; elif [[ $interface = org.freedesktop.DBus && $member = NameAcquired ]]; then echo 'firewalld started'; podman network reload --all; elif [[ $interface = org.fedoraproject.FirewallD1 && $member = Reloaded ]]; then echo 'firewalld reloaded'; podman network reload --all; fi; done"
Restart=always

[Install]
WantedBy=multi-user.target

0 comments on commit 01dc61a

Please sign in to comment.