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

Update rspamd #40434

Closed
wants to merge 5 commits into from
Closed

Update rspamd #40434

wants to merge 5 commits into from

Conversation

sshisk
Copy link
Contributor

@sshisk sshisk commented May 13, 2018

Motivation for this change

Deprecate rmilter and all this more configurable.

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
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • 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.

Be able to test aliased options with isDefined.
Deprecated by rspamd_proxy.
Add locals and overrides to configure individual modules.
Improve default configuration. Enable controller and milter proxy by default with unix sockets.
Fix aliases, before they overrode module defaults.
Fix types in submodules.
Add postfix configuration for quick integration.
Fix service dependencies so that systemd sockets aren't removed.
Use unix sockets, don't test IPv6, general cleanup.
@sshisk sshisk requested review from edolstra and nbp as code owners May 13, 2018 12:49
@GrahamcOfBorg GrahamcOfBorg added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog 8.has: documentation 8.has: module (update) This PR changes an existing module in `nixos/` 8.has: clean-up 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels May 13, 2018
@xeji xeji mentioned this pull request May 13, 2018
@oxij
Copy link
Member

oxij commented May 13, 2018 via email

@xeji
Copy link
Contributor

xeji commented May 13, 2018

/cc @fpletz

@eqyiel
Copy link
Contributor

eqyiel commented Jun 17, 2018

@sshisk @oxij @nbp is there anything I can do to help move this along?

@oxij
Copy link
Member

oxij commented Jun 17, 2018 via email


systemd.services.rspamd = {
description = "Rspamd Service";

wantedBy = mkIf (!cfg.socketActivation) [ "multi-user.target" ];
after = [ "network.target" ] ++
(if cfg.socketActivation then allSocketNames else []);
requires = mkIf cfg.socketActivation allSocketNames;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why remove these? In your commit message you mention that service dependencies where changed to counteract the sockets getting deleted but that problem is fixed further down by not setting RuntimeDirectory

@@ -323,6 +372,7 @@ in
value = {
description = "Rspamd socket ${toString each.index} for worker ${each.name}";
wantedBy = [ "sockets.target" ];
after = optional (each.name == "rspamd_proxy") "postfix.service";
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be before? You want the socket to be started before postfix uses it.

Copy link
Member

Choose a reason for hiding this comment

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

This should be not required when socket activation is used.

Copy link
Contributor

@griff griff Sep 27, 2018

Choose a reason for hiding this comment

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

This should be not required when socket activation is used.

You are right this line is not required. But thought this line is at best redundant and in my opinion also wrong since you want the socket to be created before not after the service, there is some logic behind adding an explicit dependency between postfix and the socket. In situations where the socket and postfix has been manually stopped an explicit dependency makes systemd also start the socket when you start postfix.

But I think this would have been a better way to add the dependency:

systemd.services.postfix = mkIf cfg.postfix.enable {
  after = [ "rspamd-normal-1.socket" ];
  requires = [ "rspamd-normal-1.socket" ];
}

@oxij oxij mentioned this pull request Jul 2, 2018
@oxij
Copy link
Member

oxij commented Jul 2, 2018

Status update.

#40418 got merged recently (thanks @7c6f434c and @nbp!) so the first patch in this patchset and import lines in 8795776 are no longer needed.

I picked rspamd update to #42858 for convenience in case anyone still wants that (two closed PRs for one, btw. hurry up to claim your prize! etc etc).

I guess the rest is stalled until someone with commit access decides to take interest...

@Mic92
Copy link
Member

Mic92 commented Sep 27, 2018

Sorry this did not got into 18.09. I am now also using rspamd and would review this if rebased.

controller = {};
rspamd_proxy = {};
Copy link
Member

Choose a reason for hiding this comment

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

This is a good default but should be also mentioned in the release notes.

services.postfix.extraConfig = mkIf cfg.postfix.enable ''
smtpd_milters = unix:private/rspamd
non_smtpd_milters = $smtpd_milters
milter_protocol = 6
Copy link
Member

Choose a reason for hiding this comment

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

This is apparently the default in our postfix version.


services.postfix.extraConfig = mkIf cfg.postfix.enable ''
smtpd_milters = unix:private/rspamd
non_smtpd_milters = $smtpd_milters
Copy link
Member

Choose a reason for hiding this comment

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

The official documentation does not mention this: https://rspamd.com/doc/integration.html

Copy link
Contributor

Choose a reason for hiding this comment

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

No but if you want rspamd to also scan mails from command line you need this. And if you use the DKIM module in rspamd to also add DKIM signatures you want rspamd to also be called for command line mails.

Copy link
Member

Choose a reason for hiding this comment

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

makes sense.

@Mic92
Copy link
Member

Mic92 commented Sep 27, 2018

cc @avnik

@griff
Copy link
Contributor

griff commented Sep 27, 2018

This might not be the place but since this is the latest change to the rspamd module I thought I might bring it up here. The socket activation code for rspamd doesn't work and can't be made to work until rspamd/rspamd#2035 is fixed. See also #47421

Also the worker configuration needs to be changed to better reflect how rspamd works. I am planning on working on these changes to the worker configuration in the near future. But in essence the problem is that a configuration of:

workers.controller = {};
workers.controller2 = {
  type = "controller";
  bindSockets = ["localhost:11336" ];
};

results in the bad rspamd config of:

workers {
  type = "controller";
  .includes "$CONFDIR/worker-controller.inc"
  bind_socket = "localhost:11334";
}
workers "controller2" {
  type = "controller";
  bind_socket = "localhost:11336";
}

But the essence of what I am trying to do with my controller2 config (i.e. a second controller with a different password) is actually possible with rspamd. The config just has to look like this:

workers {
  type = "controller";
  .includes "$CONFDIR/worker-controller.inc"
  bind_socket = "localhost:11334";
}
workers "controller" {
  bind_socket = "localhost:11336";
}

@griff
Copy link
Contributor

griff commented Sep 27, 2018

On a more review note I like the locals and overrides in this PR though I would have liked them to be more like environment.etc.<name> options where there is both a .text and a .source so that you can set the content from either inline text or a path.

@griff
Copy link
Contributor

griff commented Nov 6, 2018

My PR #49620 that adds my version of locals and overrides options has been merged.

I have also created #49809 that adds support for multiple workers as well as the postfix integration that this PR also included.

What this means is that once #49809 is merged all the changes made by this PR have in one form or another been implemented in other PRs and so this PR can probably be closed.

@fpletz fpletz closed this Nov 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog 8.has: clean-up 8.has: documentation 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants