Email not dkim signed.

Discussion in 'ISPConfig 3 Priority Support' started by francoisPE, Nov 9, 2022.

  1. francoisPE

    francoisPE Active Member HowtoForge Supporter

    Hello,
    I hav a multiserver conf working well.
    I discover that mails sent by my server are not DKIM signed !
    That's very strange because in my domain, there is clearly a dkim setup
    upload_2022-11-9_23-1-4.png

    here below extract of a mail source code :
    upload_2022-11-9_23-2-47.png

    My DNS records are green !

    Any idea ?
     
  2. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    Have you tried disabling and then re-enabling DKIM?
     
  3. francoisPE

    francoisPE Active Member HowtoForge Supporter

    Yes, I've just did it.
    Unfortunately, it is unchanged ! :(

    How can I check ispconfig conf is really implemented in postfix ?
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Dkim signing is not done by postfix, it is done by either Ammavis or Rspamd, depending on which exact setup you use on that server. Which spamfilter system do you use?
     
  5. francoisPE

    francoisPE Active Member HowtoForge Supporter

    I understand better !
    Dkim run good months ago
    It turned from amavis to rspamd something like 2 month ago
    Something probably went wrong at that time...
    What should I do to debug ?
     
  6. pyte

    pyte Well-Known Member HowtoForge Supporter

    Check the files dkim_domains.map and dkim_selectors.map in /etc/rspamd/local.d/ in both of these files the domain that you activated DKIM for should be listet. Is this the case?

    Make sure to check the content of /var/lib/amavis/dkim/ as well, as the keys should be stored there
     
    till likes this.
  7. francoisPE

    francoisPE Active Member HowtoForge Supporter

    I think that's ok:

    /etc/rspamd/local.d/dkim_domains.map
    mydom.tld /var/lib/amavis/dkim/mydom.tld.private
    ...
    /etc/rspamd/local.d/dkim_selectors.map
    mydom.tld mykey

    and
    ls /var/lib/amavis/dkim/
    total 24
    -rw-r--r-- 1 root root 1704 Nov 10 07:58 mydom.tld.private
    -rw-r--r-- 1 root root 451 Nov 10 07:58 mydom.tld.public
    And I check : above files content match key I can see in GUI

    The only thing I see is the following
    - I have a multiVPS conf, with 2 mail servers (it works well up to now)
    - I have domains on both servers
    - on one of these server, I have some 'dkim' of the other server, I would say that some domains from the other server are in /etc/rspamd/local.d/dkim_domains.map of that server. Idem for files in /var/lib/amavis/dkim/

    BUT, all mail domains have 'dkim: none' in email header wherever there are : one mail or the other mail server !?
     
    Last edited: Nov 10, 2022
  8. pyte

    pyte Well-Known Member HowtoForge Supporter

    You check active modules and make a config dump with rspamadm tool.

    I'll check tomorrow to make sure what needs to be enabled. In the meantime you could check rspamds logs and may find some more information what is going wrong. I should ne located somewhere at /var/log/rspamd/rspamd.log
     
  9. francoisPE

    francoisPE Active Member HowtoForge Supporter

    I find that
    Code:
    2022-11-10 00:00:09 #1659(normal) <c07882>; task; dkim_module_load_key_format: cannot load dkim key /var/lib/amavis/dkim/mydom.tld.private: cannot stat key file: '/var/lib/amavis/dkim/mydom.tld.private' Permission denied
    This file is -rw-r--r-- 1 root root

    I check
    rspamadm configgraph | grep dkim
    Code:
    "local.d/dkim_signing.conf" [shape=box,color=blue];
    "modules.d/dkim_signing.conf" [shape=box];
    "modules.d/dkim.conf" [shape=box];
    "modules.conf" -> "modules.d/dkim.conf"  [];
    "modules.conf" -> "modules.d/dkim_signing.conf"  [];
    "modules.d/dkim_signing.conf" -> "local.d/dkim_signing.conf"  [arrowhead=diamond,label="+"];
    rspamadm configdump
    Code:
    dkim_signing {
        sign_networks [
            "127.2.4.7",
        ]
        symbol = "DKIM_SIGNED";
        sign_authenticated = true;
        use_esld = false;
        selector = "dkim";
        use_redis = false;
        use_domain = "header";
        allow_hdrfrom_mismatch = false;
        path_map = "/etc/rspamd/local.d/dkim_domains.map";
        allow_username_mismatch = false;
        key_prefix = "DKIM_KEYS";
        selector_map = "/etc/rspamd/local.d/dkim_selectors.map";
        allow_envfrom_empty = true;
        allow_hdrfrom_multiple = false;
        try_fallback = false;
        sign_local = true;
    }
    
     
    Last edited: Nov 10, 2022
  10. pyte

    pyte Well-Known Member HowtoForge Supporter

    This is the issue right here. It seems like the _rspamd user is not allowed to read the file. As the file permissions are correct, i guess the underlaying directory /var/lib/amavis/dkim does not have the correct permissions.
    Code:
    chmod 750 /var/lib/amavis/dkim
    This should fix it.
     
    till likes this.
  11. francoisPE

    francoisPE Active Member HowtoForge Supporter

    ls -ld /var/lib/amavis/dkim
    drwxr-x--- 2 amavis amavis 4096 Nov 10 19:45 /var/lib/amavis/dkim
    ls -ld /var/lib/amavis/
    drwxr-x--- 8 amavis amavis 4096 Nov 9 09:30 /var/lib/amavis/

    They are both 750...
    Should I chown amavis:_rspamd ? or add _rspamd to group amavis ?

    What is the right solution for ispconfig ?
     
  12. pyte

    pyte Well-Known Member HowtoForge Supporter

    Yes it indeed is not the permission but the owner. My system has


    Code:
    root@mail01:/var/lib# ls -ldh amavis/
    drwxr-x--- 3 _rspamd _rspamd 4,0K 15. Sep 15:00 amavis/
    
    root@mail01:/var/lib# ls -ldh amavis/dkim/
    drwxr-x--- 2 _rspamd _rspamd 4,0K  7. Nov 10:04 amavis/dkim/
    
    Note: the keys themself in the dkim folder are owned by root:root but -rw-r--r--.
     
  13. francoisPE

    francoisPE Active Member HowtoForge Supporter

  14. till

    till Super Moderator Staff Member ISPConfig Developer

    I migrated my own mail server with that guide, no chown needed and a few thousand other users did it as well without having to manually execute chown. So it's more likely that this is something specific to your server than that there is missing something in the guide.
     
    Th0m likes this.
  15. francoisPE

    francoisPE Active Member HowtoForge Supporter

    @till Ok, but what is your ls -dh /var/lib/amavis ?
    Is there a chown in ispconfig code that was not executed on my machine for a whatever reason ?

    Nevertheless, DKIM is back !
    Many thanks :)
     

Share This Page