-
Notifications
You must be signed in to change notification settings - Fork 206
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
Feature request: allow forced netavark firewall driver #1338
Comments
+1 to |
Personally, I suggest changing firewall_driver to packetfilter_backend or packetfilter_controller, and adding the parameter --pf-backend/--pf-controller <firewalld/iptables/nft> to the incoming method, which is not a way to deprecate getting the backend through environment variables |
Also, I would like to ask a question here: what is the basis for netavark's priority of using firewalld/iptables/nft? Does it try to check that the dbus bus has firewalld before using ipt/nft? (cni-plugins will check for the presence of firewalld before using iptables) |
netavark does not support nft yet, if you try to activate it, you receive error that it isn't yet supported. But yes, for the moment; available supported arguments are:
Feature is already done like this, so it's unlikely to be available in that form as driver option should be carried from main to mod when env is available globally- not impossible, but unlikely to happen, I think.. @Luap99 though decides on things like that..
Thank god that it doesn't do so and depend on such monster as dbus :O I would make a PR to this, but Go isn't my strong suite.. I could do it, but it would be nasty. I think here, a surgeon would be preferred over a lumber jack.. But surely this could be done nicely by someone else. |
@oskarirauta Wait, what function is meant by function here? |
@unknowndevQwQ Like this for example: |
@oskarirauta |
No, just like I earlierly told you. Firewall driver selection is made inside a function that has no access to command-line arguments (as far as I know, I am not a rust expert) where as ENV is available globally. Most likely that would need to be parsed on startup (main in c/c++) of application, and then passed through all the functions all the way to mod.rs which then is handling selection of firewall driver, possibly even would be integrated in some classes, sorry; I didn't investigate any further, how long would the path go; I think that this is one of the main reasons, why it rather uses env. Firewall selection isn't my hand-writing at all, I just added there one more option: disable firewall completely. You could request such feature from Luap99 on netavark repository, but in my opinion, which doesn't weight, but still- such feature is unlikely to happen, as it would fundamently change design and as I described, it's very likely that it would have a lot of changes to netavark. Not sure if this request is fulfilled here anytime soon, but also, NETAVARK_FW could be passed every time, when netavark is invoked, with argument set or unset in containers.conf - as passing it with empty argument, would be same as not passing it at all. Where as command-line argument, would have other difficulties, for example:
Maybe it also could be very easy. Like I said, I don't know rust that much. But.. May I ask you why this would be important? Out of my curiosity. |
For those who are in haste to force firewall driver on the early train, I'll provide a method of wrapper-script. In here, I assume your netavark lives in /usr/lib/podman.. Rename your netavark to netavark-bin and write a script with filename netavark to same location and set executable bit, enter following content to script:
Replace none between quotes with your choice of firewall. But for proper support, I hope it will soon be provided from containers.conf |
@oskarirauta With the help of the clap-like args parser in rust, it does become easier to do something like this. I should create an issue in netavark and continue to discuss the issues I raised above.
Environment variables can be a hindrance in checking for problems because they are not as visible as the command line is in ps or other tools. I had tried to get podman to use gvisor as the OCI runtime, but kept having problems until I found out that podman was misbehaving (podman was passing an empty XDG_RUNTIME_DIR to gvisor). |
Selecting the backend by environment variables is provided in this commit. |
env is always available at proc.. /proc/{pid}/env |
Yes, but that seems to be quite old commit.. Check present mod.rs instead. |
This is not possilbe for os-tree systems like Fedora Core OS where the /usr tree is immutable. |
I think the better solution would be config based network setup just like cni plugins |
closes containers#1338 Signed-off-by: Chetan Giradkar <[email protected]>
closes containers#1338 Signed-off-by: Chetan Giradkar <[email protected]>
closes containers#1338 Signed-off-by: Chetan Giradkar <[email protected]>
closes containers#1338 Signed-off-by: Chetan Giradkar <[email protected]>
closes containers#1338 Signed-off-by: Chetan Giradkar <[email protected]>
closes containers#1338 Signed-off-by: Chetan Giradkar <[email protected]>
closes containers#1338 Signed-off-by: Chetan Giradkar <[email protected]>
Do we know in which release the e8d080d commit will be integrated ? |
podman 5.0 |
You can do the modification in another directory and list that directory in |
Feature request description
Netavark for the moment comes with 2 supported variants of firewall, firewalld and iptables; there's also nftables, but if that is enabled, error is thrown that it isn't currently supported. There has been a feature request on netavark for none firewall, meaning possibility to disable all firewall/portmapper related features to allow their management either manually, possibly with firewall that is not supported by netavark - or not to do it at all, if that's what user wants.
Currently iptables is more or less considered as old- modern distros that don't use firewalld, often go with nftables- in my case, I want to run podman on Openwrt, which goes to later mentioned, except that, I want to configure my firewall manually, whether I use iptables or nftables, there is a small issue; when ever any interface renews, firewall is restarted, leading to situation where manually written rules (outside of system specified ways), disappear for good. Let's say, that my netavark interface is podman0, it comes up and firewall rules are written, shortly after this hotplug system triggers firewall restarting and my container(s) loose all their firewalling capabilities. Best solution in this case, is to use system's own firewalling method manually, there's some ways to archieve this, but it would be great if this just could be a configurable option. Ackording to chatter about the subject, this doesn't affect only openwrt, feature is looked up by other os users as well.
Suggest potential solution
Feature currently is unsupported by netavark, but in progress. I actually wrote a fork that does support this, but name of value for environment variable should be debated by netavark maintainers- and check if they'd be interested in changing some things, even though my patch does seem to do exactly the requested; as they proposed it.
Usage of feature is by exposing a environment variable for netavark, called NETAVARK_FW - supported values are "firewalld", "iptables", "nftables" where last one causes error mentioned before - and in my patch, value is added to list as "none", meaning to disable firewall features completely by stub firewall driver;
containers/netavark#339 (comment) explains proposing usage solution for this, value in containers.conf for selecting disabled firewall which then would trigger NETAVARK_FW environment variable adding to netavark commands environment.
So could we have a configuration option to containers.conf that passes NETAVARK_FW as environment variable when netavark is executed? Maybe like this
firewall_driver = 'your_choice_of_forced_driver'
where value would be passed as NETAVARK_FW environment value if value pair is present in containers.conf.
Have you considered any alternatives?
At the moment, this is do-able with sticking to cni...
Or you could choose a legacy iptables- or change your distribution to something that uses firewalld..
Additional context
https://github.com/containers/netavark/issues/339](https://github.com/containers/netavark/issues/339
The text was updated successfully, but these errors were encountered: