Skip to content
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: merge global and interface specific rules #50625

Closed
wants to merge 1 commit into from

Conversation

blaxill
Copy link
Contributor

@blaxill blaxill commented Nov 18, 2018

Merge global and interface specific firewall.allowed* rules, instead of
silently dropping global rules when both types are set.

Motivation for this change

Currently global networking.firewall.allowed* are dropped for interfaces when they have interface specific rules. Although this was documented, the more intuitive option would be to merge the rules.

#47580

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)

  • Built on platform(s)

    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)

    Ran nix-build firewall.nix, I'm not sure if it finished cleanly, it ends with:

syncing
walled: running command: sync
walled: exit status 0
attacker: running command: sync
attacker: exit status 0
test script finished in 22.48s
cleaning up
killing walled (pid 600)
killing attacker (pid 612)
vde_switch: EOF on stdin, cleaning up and exiting
vde_switch: Could not remove ctl dir '/build/vde1.ctl': Directory not empty
/nix/store/i6v45ivxy6r3w2hkhg4ifv8qcd5k4qxb-vm-test-run-firewall
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

@blaxill
Copy link
Contributor Author

blaxill commented Nov 18, 2018

Hmm, I think there is something wrong with this currently, investigating…

Add the firewall.allowed* rules to the "default" interface (applied to all
interfaces), instead of using them as a default value for the
firewall.interface.* attr
@blaxill
Copy link
Contributor Author

blaxill commented Nov 18, 2018

Closing this temporarily while I fix it

@blaxill blaxill closed this Nov 18, 2018
default = {
default = mapAttrs (name: value: cfg."${name}") commonOptions;
};
default = { };
type = with types; attrsOf (submodule [ { options = commonOptions; } ]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to set the defaults from within the module, like this:

submodule {
  options = commonOptions;
  config = mapAttrs (name: value: mkOptionDefault cfg.${name}) commonOptions;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants