-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
nixos-firewall-tool: add nftables support #275126
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you split cd362006aced83af980799675184b668ac7cdb04 into two; one that refactors and one that does the actual change? It's hard to tell what it does.
The part pertaining the firewall tool looks pretty good to me though. I can't really review the nftables firewall change; if you want this merged quickly, do those in a separate PR.
backend = if config.networking.nftables.enable then "nftables" else "iptables"; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you make the iptables backend selection also explicit? There might be more than two firewall implementations in the future and I'd rather throw here than install the iptables firewall tool in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, we only have a boolean option networking.nftables.enable
for firewall backends. Do you mean we add a new option to set the backend?
1e4ad2c
to
6d5402d
Compare
Thanks for your quick review. Unfortunately the firewall tool change depends on the nftables firewall module change. It would be better not to separate them. |
Hi @duament, thank you for figuring out a solution to make the I agree with #275126 (review) to split out the required changes in the firewall module to the changes in the Regarding your change at Future changes in script can break CLI command compatibility with the other. Is this even a requirement? Passing the backend as a package option causes |
@@ -79,6 +79,8 @@ The pre-existing [services.ankisyncd](#opt-services.ankisyncd.enable) has been m | |||
|
|||
- The `hardware.pulseaudio` module now sets permission of pulse user home directory to 755 when running in "systemWide" mode. It fixes [issue 114399](https://github.com/NixOS/nixpkgs/issues/114399). | |||
|
|||
- `nixos-firewall-tool` now supports nftables and is installed by default when NixOS firewall enables. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `nixos-firewall-tool` now supports nftables and is installed by default when NixOS firewall enables. | |
- `nixos-firewall-tool` now supports nftables and is installed by default when NixOS firewall is enabled. |
|
||
let | ||
|
||
inherit (lib) mkIf mkOption types mdDoc optionalString; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you not inherit concatStringsSep
, mapAttrsToList
, ... here too?
6d5402d
to
8da2338
Compare
You're right. I created #275371 for the firewall module change.
I guess we can support both backends in one script and determine which one to use at runtime. Just check if |
nft list table inet nixos-fw | ||
;; | ||
"reset") | ||
systemctl reload nftables.service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reloading nftables for undoing port changes is a bit excessive, see: #286584.
Instead of the current approach, I would suggest add a set of type inet_proto . inet_service
, call it something like tool-ports
, and let this command do a single flush of this set.
@duament do you still intend to proceed with this PR? I can work on this if you don't have time. |
Feel free to continue this pr. |
Description of changes
Add nftables support in
nixos-firewall-tool
and enable it by default when NixOS firewall enables.Also add some tests for
nixos-firewall-tool
innixosTests.firewall
.Depends on #275371
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)ping @Atemu @clerie
Add a 👍 reaction to pull requests you find important.