Skip to content

Commit

Permalink
containers: Reload podman network on firewalld reload
Browse files Browse the repository at this point in the history
firewalld reload causes the podman network rules to be removed. It is
being tracked at containers/podman#5431. In
the mean time, add a workaround service to rebuild the rules when
firewalld is started or reloaded.
  • Loading branch information
jameslikeslinux committed Feb 18, 2022
1 parent adf0ede commit 147c49b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
14 changes: 14 additions & 0 deletions files/containers/podman-firewalld-reload.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=Redo podman NAT rules after firewalld starts or reloads
Documentation=https://github.com/containers/podman/issues/5431
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
10 changes: 9 additions & 1 deletion manifests/base/containers.pp
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,19 @@
content => "[Service]\nDelegate=yes\n",
notify => Nest::Lib::Systemd_reload['containers'],
;

'/etc/systemd/system/podman-firewalld-reload.service':
source => 'puppet:///modules/nest/containers/podman-firewalld-reload.service',
notify => Nest::Lib::Systemd_reload['containers'],
;
}
->
nest::lib::systemd_reload { 'containers': }
->
service { 'podman.socket':
service { [
'podman.socket',
'podman-firewalld-reload',
]:
enable => true,
}

Expand Down

0 comments on commit 147c49b

Please sign in to comment.