mailcow / mailcow-dockerized

mailcow: dockerized - 🐮 + 🐋 = 💕
https://mailcow.email
GNU General Public License v3.0
8.58k stars 1.15k forks source link

Cannot load dkim key #4377

Closed guidtz closed 2 years ago

guidtz commented 2 years ago

Hello,

Prior to placing the issue, please check following: (fill out each checkbox with an X once done)

Summary

All mails send with mailcow have no dkim signature. In UI all domains have signature registrer and all dkin informations are in dns.

Logs

Rspamd logs :

Dec 13 10:54:01 localhost.localdomain docker/mailcowdockerized_rspamd-mailcow_1/b723cf1113e6[19105]: 2021-12-13 10:54:01 #39(normal) <ffacb1>; task; dkim_module_load_key_format: cannot load dkim key /var/lib/rspamd/dkim/domaine.fr.dkim.key: cannot stat key file: '/var/lib/rspamd/dkim/domaine.fr.dkim.key' No such file or directory

Reproduction

Send mails with thunderbird and webmail.

System information

Question Answer
My operating system Debian 10
Is Apparmor, SELinux or similar active? No
Virtualization technlogy (KVM, VMware, Xen, etc - LXC and OpenVZ are not supported KVM
Server/VM specifications (Memory, CPU Cores) 15G
Docker Version (docker version) 20.10.11
Docker-Compose Version (docker-compose version) 1.29.2
Reverse proxy (custom solution) no

All others features of mailcow works well.

Best regards

guidtz commented 2 years ago

Up how te recreate or re initialize dkim keys ?

andryyy commented 2 years ago

The log line posted is irrelevant. That's a different module. Keys are loaded from Redis.

You probably have added your servers IP to the whitelist. Or the senders domain to the sender whitelist.

It is not helpful to decide to only post a single log line for that exact reason.

guidtz commented 2 years ago

@andryyy thanks for you're reply, how can i check if dkim keys are always in redis ? And also question how can I reinitilize keys ?

I have not had server ip address in whitelist so I think dkim signature don't work correctly in my installation.

Thanks for you're help

andryyy commented 2 years ago

No logs no help possible.

Am 22.12.2021 um 10:11 schrieb Chéramy Guillaume @.***>:

 @andryyy thanks for you're reply, how can i check if dkim keys are always in redis ? And also question how can I reinitilize keys ?

I have not had server ip address in whitelist so I think dkim signature don't work correctly in my installation.

Thanks for you're help

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.

guidtz commented 2 years ago

yes I understand but witch logs ? and / or how to make logs in debug mode to have more informations ?

andryyy commented 2 years ago

Can you post the Rspamd logs from the time frame of sending an unsigned email?

Am 22.12.2021 um 23:48 schrieb Chéramy Guillaume @.***>:

 yes I understand but witch logs ? and / or how to make logs in debug mode to have more informations ?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.

guidtz commented 2 years ago

Hello, this is the only logs I have when I send a mail :

Dec 23 13:53:20 localhost.localdomain docker/mailcowdockerized_rspamd-mailcow_1/f8901b3c265b[23576]: 2021-12-23 13:53:20 #52(normal) <488b51>; task; dkim_module_load_key_format: cannot load dkim key /var/lib/rspamd/dkim/aukfood.fr.dkim.key: cannot stat key file: '/var/lib/rspamd/dkim/aukfood.fr.dkim.key' No such file or directory
Dec 23 13:53:20 localhost.localdomain docker/mailcowdockerized_rspamd-mailcow_1/f8901b3c265b[23576]: 2021-12-23 13:53:20 #52(normal) <488b51>; task; rspamd_task_write_log: id: <6d41c619-976c-28cf-bd65-2997e47157d6@aukfood.fr>, qid: <57DB63A444A>, ip: 78.212.127.89, user: contact@aukfood.fr, from: <contact@aukfood.fr>, (default: F (no action): [-0.10/15.00] [MIME_GOOD(-0.10){text/plain;},ARC_NA(0.00){},ASN(0.00){asn:12322, ipnet:78.192.0.0/11, country:FR;},FREEMAIL_ENVRCPT(0.00){gmail.com;},FREEMAIL_TO(0.00){gmail.com;},FROM_EQ_ENVFROM(0.00){},FROM_HAS_DN(0.00){},MID_RHS_MATCH_FROM(0.00){},MIME_TRACE(0.00){0:+;},NEURAL_SPAM(0.00){0.838;},RCPT_COUNT_ONE(0.00){1;},RCVD_COUNT_ZERO(0.00){0;},TO_DN_NONE(0.00){},TO_MATCH_ENVRCPT_ALL(0.00){}]), len: 425, time: 8.587ms, dns req: 1, digest: <e2ab1859e0a24333c015323acbd31bcc>, rcpts: <aukfood85@gmail.com>, mime_rcpts: <aukfood85@gmail.com>

In rspamd ui I have no mapping, it 's normal ? mailcow-rspamd

Regards

andryyy commented 2 years ago

This email does not have a MAILCOW_HEADER_FROM symbol nor a MAILCOW_AUTH symbol.

Am 23.12.2021 um 13:56 schrieb Chéramy Guillaume @.***>:  Hello, this is the only logs I have when I send a mail :

Dec 23 13:53:20 localhost.localdomain docker/mailcowdockerized_rspamd-mailcow_1/f8901b3c265b[23576]: 2021-12-23 13:53:20 #52(normal) <488b51>; task; dkim_module_load_key_format: cannot load dkim key /var/lib/rspamd/dkim/aukfood.fr.dkim.key: cannot stat key file: '/var/lib/rspamd/dkim/aukfood.fr.dkim.key' No such file or directory Dec 23 13:53:20 localhost.localdomain docker/mailcowdockerized_rspamd-mailcow_1/f8901b3c265b[23576]: 2021-12-23 13:53:20 #52(normal) <488b51>; task; rspamd_task_write_log: id: @.>, qid: <57DB63A444A>, ip: 78.212.127.89, user: @., from: @.>, (default: F (no action): [-0.10/15.00] [MIME_GOOD(-0.10){text/plain;},ARC_NA(0.00){},ASN(0.00){asn:12322, ipnet:78.192.0.0/11, country:FR;},FREEMAIL_ENVRCPT(0.00){gmail.com;},FREEMAIL_TO(0.00){gmail.com;},FROM_EQ_ENVFROM(0.00){},FROM_HAS_DN(0.00){},MID_RHS_MATCH_FROM(0.00){},MIME_TRACE(0.00){0:+;},NEURAL_SPAM(0.00){0.838;},RCPT_COUNT_ONE(0.00){1;},RCVD_COUNT_ZERO(0.00){0;},TO_DN_NONE(0.00){},TO_MATCH_ENVRCPT_ALL(0.00){}]), len: 425, time: 8.587ms, dns req: 1, digest: , rcpts: @.>, mime_rcpts: @.***> In rspamd ui I have no mapping, it 's normal ?

Regards

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.

guidtz commented 2 years ago

For now I restore rspamd conf from old backup and I have these error

Dec 23 14:09:08 localhost.localdomain docker/mailcowdockerized_rspamd-mailcow_1/cb4610c48603[23576]: 2021-12-23 14:09:08 #40(normal) <75878c>; lua; dkim_signing.lua:105: signing failure: cannot make request to load DKIM selector for domain aukfood.fr: nil
Dec 23 14:09:08 localhost.localdomain docker/mailcowdockerized_rspamd-mailcow_1/cb4610c48603[23576]: 2021-12-23 14:09:08 #40(normal) <75878c>; task; rspamd_task_write_log: id: <25d96ba3-72a4-0d4e-3ae7-e8a673a74833@aukfood.fr>, qid: <B88C13A4455>, ip: 78.212.127.89, user: guillaume@aukfood.fr, from: <guillaume@aukfood.fr>, (default: F (no action): [-26.93/15.00] [MAILCOW_AUTH(-20.00){},LOCAL_FUZZY_WHITE(-3.82){13:8809733a14:0.59:txt;},BAYES_HAM(-3.01){92.77%;},MIME_GOOD(-0.10){multipart/alternative;text/plain;},ARC_NA(0.00){},ASN(0.00){asn:12322, ipnet:78.192.0.0/11, country:FR;},BCC(0.00){},CLAM_VIRUS_FAIL(0.00){failed to scan and retransmits exceed;},DYN_RL_CHECK(0.00){},FROM_EQ_ENVFROM(0.00){},FROM_HAS_DN(0.00){},MAILCOW_DOMAIN_HEADER_FROM(0.00){aukfood.fr;},MID_RHS_MATCH_FROM(0.00){},MIME_TRACE(0.00){0:+;1:+;2:~;},RCPT_COUNT_ONE(0.00){1;},RCVD_COUNT_ZERO(0.00){0;},TO_DN_NONE(0.00){},TO_MATCH_ENVRCPT_ALL(0.00){}]), len: 17162, time: 383.676ms, dns req: 22, digest: <dc24d56dc292339fe3dc6561df943575>, rcpts: <test-5fg51i9p0@srv1.mail-tester.com>, mime_rcpts: <test-5fg51i9p0@srv1.mail-tester.com>
andryyy commented 2 years ago

Did you not post your git diff as asked for in the issue template? :/

Am 23.12.2021 um 14:14 schrieb Chéramy Guillaume @.***>:

 For now I restore rspamd conf from old backup and I have these error

Dec 23 14:09:08 localhost.localdomain docker/mailcowdockerized_rspamd-mailcow_1/cb4610c48603[23576]: 2021-12-23 14:09:08 #40(normal) <75878c>; lua; dkim_signing.lua:105: signing failure: cannot make request to load DKIM selector for domain aukfood.fr: nil Dec 23 14:09:08 localhost.localdomain docker/mailcowdockerized_rspamd-mailcow_1/cb4610c48603[23576]: 2021-12-23 14:09:08 #40(normal) <75878c>; task; rspamd_task_write_log: id: @.>, qid: , ip: 78.212.127.89, user: @., from: @.>, (default: F (no action): [-26.93/15.00] [MAILCOW_AUTH(-20.00){},LOCAL_FUZZY_WHITE(-3.82){13:8809733a14:0.59:txt;},BAYES_HAM(-3.01){92.77%;},MIME_GOOD(-0.10){multipart/alternative;text/plain;},ARC_NA(0.00){},ASN(0.00){asn:12322, ipnet:78.192.0.0/11, country:FR;},BCC(0.00){},CLAM_VIRUS_FAIL(0.00){failed to scan and retransmits exceed;},DYN_RL_CHECK(0.00){},FROM_EQ_ENVFROM(0.00){},FROM_HAS_DN(0.00){},MAILCOW_DOMAIN_HEADER_FROM(0.00){aukfood.fr;},MID_RHS_MATCH_FROM(0.00){},MIME_TRACE(0.00){0:+;1:+;2:~;},RCPT_COUNT_ONE(0.00){1;},RCVD_COUNT_ZERO(0.00){0;},TO_DN_NONE(0.00){},TO_MATCH_ENVRCPT_ALL(0.00){}]), len: 17162, time: 383.676ms, dns req: 22, digest: , rcpts: @.>, mime_rcpts: @.***> — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.

guidtz commented 2 years ago

I think there is a problem with existant domain, if a create a new one with a new dkim key all it's works

Dec 23 15:45:13 localhost.localdomain docker/mailcowdockerized_rspamd-mailcow_1/620998cb804e[23576]: 2021-12-23 15:45:13 #41(normal) <4dda3d>; task; rspamd_task_process: skip learning: <b2769a92c3dcb7794a28a088c8b34c15@cheramy.ovh> contains less tokens than required for bayes classifier: 8 < 11
Dec 23 15:45:13 localhost.localdomain docker/mailcowdockerized_rspamd-mailcow_1/620998cb804e[23576]: 2021-12-23 15:45:13 #41(normal) <4dda3d>; task; rspamd_task_write_log: id: <b2769a92c3dcb7794a28a088c8b34c15@cheramy.ovh>, qid: <2ACF33A4441>, ip: 172.22.1.8, user: guillaume@cheramy.ovh, from: <guillaume@cheramy.ovh>, (default: F (no action): [-22.10/15.00] [MAILCOW_AUTH(-20.00){},NEURAL_HAM_SHORT(-2.00){-1.000;},MIME_GOOD(-0.10){text/plain;},ARC_NA(0.00){},BCC(0.00){},DKIM_SIGNED(0.00){cheramy.ovh:s=dkim;},DYN_RL_CHECK(0.00){},FREEMAIL_ENVRCPT(0.00){gmail.com;},FREEMAIL_TO(0.00){gmail.com;},FROM_EQ_ENVFROM(0.00){},FROM_NO_DN(0.00){},MAILCOW_DOMAIN_HEADER_FROM(0.00){cheramy.ovh;},MID_RHS_MATCH_FROM(0.00){},MIME_TRACE(0.00){0:+;},RCPT_COUNT_ONE(0.00){1;},RCVD_COUNT_ZERO(0.00){0;},TO_DN_NONE(0.00){},TO_MATCH_ENVRCPT_ALL(0.00){}]), len: 321, time: 71.714ms, dns req: 4, digest: <2fac72d84ec879620eff2ec8d9ebebee>, rcpts: <aukfood85@gmail.com>, mime_rcpts: <aukfood85@gmail.com>

How can I recreate dkim keys for all existant domains ? In attached file result of git diff origin/master

diff.log

guidtz commented 2 years ago

@andryyy I removed all keys and regenerate new one and now It's works ...

Oliv4945 commented 1 year ago

Hello @guidtz , I have the same issue. do you remember, and do you mind, sharing the steps to remove the keys and regenerate them? thanks