mox icon indicating copy to clipboard operation
mox copied to clipboard

Only create DKIM RSA key(s) by default for new domains, not both RSA and ed25519

Open mjl- opened this issue 10 months ago • 7 comments

All DKIM-verifying software support DKIM RSA keys. Only some (not that many) support ed25519 keys. We currently create both keys for new domains, and sign outgoing messages for that domain with both keys.

If a remote server does not support an algorithm, it has to (and does in practice) ignore that signature, and uses other signatures with algorithms that it does support. However, some of those servers then send DMARC reports that mention a failing DKIM verification. And unfortunately, often with bad diagnostics and/or few details. E.g. missing selector. The same applies to the Authentication-Results headers that they create, which sometimes mention "0-bit" keys. This confuses postmasters, causing them to investigate. It takes time and is a chore. We can probably prevent this by only using RSA keys.

I originally added both on the assumption that there would/should be a move from RSA keys to ed25519 keys for DKIM. But that is probably not happening:

  • Because of all the mail servers with RSA-only support out there, we will need RSA for a long time to come. RSA isn't broken, it works just fine (well, except that the long public keys are annoying, they result in long DNS TXT records, with multiple 255-byte strings, that some DNS provider interfaces botch; but at least we check for in the self-check; ed25519 DKIM DNS TXT records don't have this problem).
  • I think RSA verification is cheaper (in cpu cycles) than RSA signing, while it's the other way around for ed25519. The RSA-case seems more attractive for postmasters. Not sure if this makes an actual difference.
  • An added benefit is that users have to create fewer DNS records when setting up a domain.

mjl- avatar Feb 27 '25 07:02 mjl-

Hi @mjl-, first of all thank you so much for Mox. I just started using Mox and it is amazing.

I configured both DKIM RSA and ed25519 following Mox Quickstart.

Checking the raw sources of the emails sent to Gmail accounts, I noticed that Google returns dkim=neutral (no key) for ed25519 keys:

Authentication-Results: mx.google.com;
       dkim=neutral (no key) [email protected] header.s=2025a;
       dkim=pass [email protected] header.s=2025b header.b=JJTij0ey;

After reading your note, I kept only the DKIM RSA keys.

So far sending emails to Gmail and Outlook is working well. Unfortunately I have some issues with iCloud, but I need to make some more tests.

Eygem avatar Mar 06 '25 17:03 Eygem

Great to hear!

With the commit above, we'll no longer create ed25519 dkim keys by default.

Which errors are you seeing from icloud? I've gotten rejects with the following message: 554 5.7.1 [CS01] Message rejected due to local policy. Please visit https://support.apple.com/en-us/HT204137. I mailed them, never got a reply.

mjl- avatar Mar 07 '25 14:03 mjl-

Hi @mjl- , with iCloud it is rejected exactly with the same message. I tried also sending from my iCloud email and reply, but it is rejected with the same reason. By the way at the second attempt the sender email is temporarily blocked: not delivering to recipient address [email protected]: address is on suppression list, permanent. Next week I will try to contact them, I have an iCloud+ plan (0.99😅) may be it helps to get an answer... (but not optimistic!). Wish you a great weekend!

Eygem avatar Mar 07 '25 18:03 Eygem

Anyway its is not a Mox specific issue. I just reverted back for testing to Postfix/Dovecot and failed to deliver to iCloud as well.

2025-03-08 17:33:54 eygem postfix/bounce[765117]: 9289536010C: sender non-delivery notification: EA53A360111

Some years ago it was working, it may be possible iCloud has become more selective to filter incoming email. Since a couple of months I noticed spam drastically decreased in my iCloud mail.

Eygem avatar Mar 08 '25 17:03 Eygem

Hi @mjl- , just to share that now I can send also to iCloud.

On Sunday I sent an email to Apple iCloud ([email protected]) explaining that the messages sent from my self-hosted email server to my private iCloud email were bounced. I explained that the same emails are delivered to Gmail and Outlook accounts (I annexed the raw sources of two messages). After 2 hours they replied asking my host provider to reach them. I opened a ticket with my host provider (Contabo in my case) and they contacted Apple. Few hours later the iCloud Team informed they made some changes and asked me to try resending. In 36 hours the issue was resolved.

I hope these information can be helpful for others facing the same issue.

Eygem avatar Mar 11 '25 11:03 Eygem

Thanks for the feedback, and glad it was worked out so quickly.

I'm also going to ask my hosting provider to contact them. I sent Apple another message, but did not get a reply. I can understand why Apple wants to talk to the hosting provider, perhaps registering the entire IP range with them or something...

mjl- avatar Mar 20 '25 10:03 mjl-

I also just noticed this. Maybe it would be good to also add instructions for people with existing mail domains, how to remove the ED25519 key retroactively.

mattfbacon avatar Mar 27 '25 19:03 mattfbacon