1 { pkgs, lib, config, ... }:
3 inherit (builtins) attrNames listToAttrs readFile;
4 inherit (builtins.extraBuiltins) pass pass-chomp;
6 inherit (pkgs.lib) unlinesAttrs;
7 inherit (config.services) postfix rspamd dovecot2;
11 rspamd/sourcephile.fr.nix
12 rspamd/autogeree.net.nix
15 services.rspamd.dkimSelectorMap = lib.mkOption {
18 description = ''Each line maps a domain to its active DKIM selector'';
19 apply = s: pkgs.writeText "dkim_selectors.map" s;
23 users.users."${rspamd.user}".extraGroups = [ "keys" ];
27 postfix.enable = postfix.enable;
29 "dkim_signing.conf".text = ''
30 selector_map = ${rspamd.dkimSelectorMap};
31 path = "/run/keys/dkim.$domain.$selector.key";
32 allow_username_mismatch = true;
35 selector_map = ${rspamd.dkimSelectorMap};
36 path = "/run/keys/dkim.$domain.$selector.key";
37 allow_username_mismatch = true;
41 debug_modules = [“dkim_signing”]
46 "milter_headers.conf".text = ''
47 extended_spam_headers = true;
49 "actions.conf".text = ''
50 reject = 15; # Reject when reaching this score
51 add_header = 6; # Add header when reaching this score
52 greylist = 4; # Apply greylisting when reaching this score (will emit `soft reject action`)
57 # Like controller but without a password, only the bindSockets' permissions
59 includes = [ "$CONFDIR/worker-controller.inc" ];
61 { socket = "/run/rspamd/learner.sock";
63 owner = "${rspamd.user}";
64 group = "${dovecot2.group}";
71 includes = [ "$CONFDIR/worker-controller.inc" ];
77 #static_dir = "''${WWWDIR}";
79 password = "${pass-chomp "servers/mermet/rspamd/controller/hashedPassword"}";
85 services.postfix.extraConfig = ''
86 smtpd_milters = unix:/run/rspamd.sock
87 milter_default_action = accept
89 # Allow users to run 'rspamc' and 'rspamadm'.
90 environment.systemPackages = [ pkgs.rspamd ];