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/postfix: fix default postfix config #34060

Merged
merged 3 commits into from Jan 26, 2018

Conversation

WilliButz
Copy link
Member

services.postfix.config is now correctly merged with the default attrset
specified in the module. Some options that are lists in postfix also
have to be lists in nix to be merged correctly. Other default options are
now set with mkDefault so they can be overridden via the module system.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Ran the dovecot test
  • 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/)
  • Fits CONTRIBUTING.md.

/cc @qknight @globin @fpletz

@uwap
Copy link
Contributor

uwap commented Jan 24, 2018

With your PR I think it is impossible to remove default configs.

For example the default postfix config for recipient_canonical_maps is

recipient_canonical_maps = [ "tcp:127.0.0.1:10002" ]

If I want to set it to [ "tcp:127.0.0.1:10003" ] instead, I would write

recipient_canonical_maps = [ "tcp:127.0.0.1:10003" ]

which would now merge to

recipient_canonical_maps = [ "tcp:127.0.0.1:10002" "tcp:127.0.0.1:10003" ]

@WilliButz
Copy link
Member Author

@uwap you are right about the merging of the values, which is the intended behaviour, but you should still be able to override the default value with a 'lower' priority e.g.

recipient_canonical_maps = lib.mkForce [ "tcp:127.0.0.1:10003" ]

@uwap
Copy link
Contributor

uwap commented Jan 24, 2018

I think the changed behavior should be documented in the release changelog then? cc @fpletz

@@ -24,7 +24,7 @@ let
then [ (concatStringsSep ", " (map (s: "reject_rbl_client " + s) cfg.dnsBlacklists)) ]
else [];

clientRestrictions = concatStringsSep ", " (clientAccess ++ dnsBl);
clientRestrictions = clientAccess ++ dnsBl;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't really get why you do this change. Could you explain it?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I made a mistake there, as I can't think of why I did that. Thank you 👍

Copy link
Member

Choose a reason for hiding this comment

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

The module adds commas inconsistently. Commas seem to be optional in postfix's main.cf so we should either add them for all options that are lists or not.

`services.postfix.config` is now correctly merged with the default attrset
specified in the module. Some options that are lists in postfix also
have to be lists in nix to be merged correctly. Other default options are
now set with `mkDefault` so they can be overridden via the module system.
@fpletz
Copy link
Member

fpletz commented Jan 26, 2018

@uwap I consider the previous behaviour a bug because the options would not merge nicely as other options do in the module system. We will document the change in the release notes.

@fpletz
Copy link
Member

fpletz commented Jan 26, 2018

@uwap Regarding your concern with merging default options: We made sure that we only set list options if another option in services.postfix is set. This effectively means that the user specifically wants the module to help out with the config, i.e. in your example useSrs.

If the old behaviour is used and the user sets recipient_canonical_maps the useSrs option doesn't work anymore because "tcp:127.0.0.1:10001" would be removed.

@fpletz
Copy link
Member

fpletz commented Jan 26, 2018

I've added a mention in the release notes and a commit to add commas between list option elements. This makes the output of postconf nicer even though they are technically not needed.

@uwap
Copy link
Contributor

uwap commented Jan 26, 2018

@fpletz Great! Thank you!

@fpletz fpletz merged commit 1c2e33f into NixOS:master Jan 26, 2018
@WilliButz WilliButz deleted the fix-postfix-module branch January 26, 2018 19:15
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