cyrusimap / cyrus-imapd

Cyrus IMAP is an email, contacts and calendar server
http://cyrusimap.org
Other
548 stars 150 forks source link

Wrong sieve script is applied when mail is delivered to multiple users #4878

Open stbr4 opened 7 months ago

stbr4 commented 7 months ago

I'm running Cyrus on Debian Bookworm. Cyrus version: 3.6.1-4+deb12u1 (I recently upgraded from version 3.2.6-2~bpo10+1)

It seems that U1's sieve script is also applied to U2 and U2 doesn't receive the email. U3 receives the mail, even if the script doesn't match.

elliefm commented 7 months ago

Interesting. @ksmurchison, any thoughts? If this is something we've already fixed in later versions, I might be able to backport it, but I don't remember seeing anything along these lines. I think Fastmail's MTAs probably send one-mail-per-recipient to lmtpd so we don't see this sort of thing ourselves.

@stbr4 In the meantime, I think you should be able to work around this by configuring your MTA (i.e. postfix, sendmail, exim, etc) to always send one-mail-per-recipient to lmptd. I don't know how to do this for any particular MTA, but presumably your MTA's documentation will say.

stbr4 commented 7 months ago

Thank you @elliefm!

We mitigated the problem for now by putting a dummy sieve script in every mailbox. I will look into configuring postfix to deliver mails one at a time.

ksmurchison commented 7 months ago

I created #4882 to test this and it passes just fine against master. I also don't see any relevant changes between 3.6.1 and master, but maybe a second set of eyes will.

stbr4 commented 7 months ago

Thank you for looking into it, @ksmurchison!

I will try to reproduce it next week. Maybe there is some weird misconfiguration in my setup. Can you suggest anything that i can try to find the cause of this problem?

ksmurchison commented 7 months ago

Does this occur across all users or does it only occur if U1 is one of the recipients?

Are the bytecode scripts/directories for the users somehow linked in your sievedir?

stbr4 commented 7 months ago

U1 has to be one of the recipients. The sieve scripts/bytecode/directories were definitely not linked before the Upgrade. The way sieve scripts are stored changed with this upgrade. I am fairly certain that i checked the directories when i was investigating this problem and didn't find anything unusual. Now there are sieve scripts for every user, so i cannot check now.

We noticed two times that mails went missing. Both times it was a mail with many recipients. Actually one recipient that is forwarded to many mailboxes (recipients are expanded by postfix), if that makes a difference.

Both times it happend like this:

stbr4 commented 7 months ago

I was unable to reproduce this issue.

Attached are anonymized logs of postfix and cyrus from one time where mails were lost. User "bjoF1XbMOLghV7IUkF8ZuQ==" notified us that the mail was not delivered but there were probably more that did not get this mail. There was definitely no sieve script for this user.

postfix.log.txt cyrus.log.txt