-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port forwarding with firewalld is not persistent #723
Comments
The problem here is that we can either mark it persistent or not. And if it is marked persistent it mean firewalld will apply them after a reboot again right? Podman has no deamon, we cannot ever have things staying around after a possible reboot so we do not use persistent AFAIK. And while it would be cool to have this fixed when using the firewalld backend, iptables and a possible direct nft implementation would still suffer from that. In my ideal world we could say firewalld please keep the rules on reaload/restart but do not add them back, e.g. on reboot. |
You do have full autonomy with the policies you create yourself, nothing is stopping you from pruning them before you add anything, e.g. after a reboot and after a container is started. And this would be firewalld-specific, direct nft/iptables should not be considered as a part of this issue. |
Of course we can add/remove any rules but that is not the problem, the problem is we have no process to do it. Podman is not a daemon, it will not be started after a boot unless someone runs a podman command. Which means if we were to mark them persistent and the system crashes firewalld will add the rules back after a boot. However there is exactly 0 guarantee that any podman command was started after the boot so we have no way of removing the old rules. The only way do that would be to create a new systemd unit and a special command to flush all rules on startup. But this is extra work for us and then we have nice race conditions to take care of as this would need to be run after firewalld created the rules but before podman starts containers and calls netavark to create rules for the container. |
Alternatively - listen for firewalld reload events and add them back after |
Noting we do tap dbus for firewalld rulesets but as mentioned, only when a
Just my 2 cents; I can't think of a way currently to make this work as at the time of reload we'd have no processes alive to handle re-adding rulesets. |
This was fixed in #840, in netavark v1.9. See https://blog.podman.io/2023/11/new-netavark-firewalld-reload-service/ for info on how to use it. |
Steps to reproduce:
Run a container that publishes a port, e.g. nginx:
This yield's the following firewalld policy:
If I now run
firewall-cmd --reload
/systemctl reload firewalld
because I did some other firewall changes (not necessarily related to this container), the port forwarding is now gone:I can remedy this myself by running
podman network reload --all
, but this should be handled by netavark/podman itself.Tested with:
Let me know if this should be raised in the podman repo instead.
The text was updated successfully, but these errors were encountered: