Rspamd warning: cannot load dkim key

Issue description

Rspamd can't find the dkim keys.

I only noticed it since I was upgrading to 20.09 and rspamd restarted (the error was there even before though). Other than that, upgrade was smooth enough (thanks 🙂 )

Just wanted to report since I couldn't find via search, but Gitlab search is a bit weird, feel free to close if this is a duplicate.

Symlinking the keys from the defined dkimKeyDirectory into the expected folder causes the issue to disappear.

What I expected to happen:

dkimKeyDirectory is also respected for rspamd config

What happened:

rspamd gave an error on the logs (changed hostname):

Nov 09 11:18:23 hostname rspamd[28421]: <a427a5>; proxy; dkim_module_load_key_format: cannot load dkim key /var/lib/rspamd/dkim/website.com.dkim.key: cannot stat key file: '/var/lib/rspamd/dkim/website.com.dkim.key' No such file or directory

Technical details

  • system: "x86_64-linux"
  • host os: Linux 5.4.60, NixOS, 20.09.1683.1ae46bffe4a (Nightingale)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.3.7
  • channels(root): "nixos-20.09.1683.1ae46bffe4a"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

SNM release branch name and Commit ID

Branch 20.09, commit ID: c04260cf5e685fc99ccb669654e147f94e3de8a4 (current latest)

Relevant part of the config to reproduce:

  mailserver = {
    enable = true;
    fqdn = "mail.<redacted>";
    domains = [ "<redacted>" "<redacted_anotherdomain>" ];
    mailDirectory = "/shared/mail";
    certificateDirectory = "/shared/mail/certificates";
    dkimKeyDirectory = "/shared/.mail_dkim_keys";
    certificateScheme = 3;
    loginAccounts = {
      "<redacted>" = {
        hashedPassword = secrets.mailAccountPass;
      };
    };
    enableImap = true;
    enablePop3 = true;
    enableImapSsl = true;
    enablePop3Ssl = true;
    enableManageSieve = true;
    virusScanning = false;
    localDnsResolver = false;
  };

Relevant journald log:

Problematic line is already pasted above