On 24/07/2024 10:48, Rosario Esposito via dovecot wrote:
Hi John,
I'm not sure the DB lookup key includes the username ("resposit" in my case)
I tried to see what gets written in .dovecot.lda-dupes but it looks like a binary file (doveadm dump does not help). This is what I see after sending the same message to both aliases:
[root@imap1 ~]# hexdump -C /mail/resposit/.dovecot.lda-dupes 00000000 02 00 00 00 5f c9 a0 66 10 00 00 00 1b 00 00 00 |...._..f........| 00000010 bc 34 2f 26 82 bd 69 6d e7 a0 79 da 28 d7 4a 82 |.4/&..im..y.(.J.| 00000020 72 6f 73 61 72 69 6f 2e 65 73 70 6f 73 69 74 6f |rosario.esposito| 00000030 40 6e 61 2e 69 6e 66 6e 2e 69 74 5f c9 a0 66 10 |@na.infn.it_..f.| 00000040 00 00 00 13 00 00 00 bc 34 2f 26 82 bd 69 6d e7 |........4/&..im.| 00000050 a0 79 da 28 d7 4a 82 72 65 73 70 6f 73 69 74 40 |.y.(.J.resposit@| 00000060 6e 61 2e 69 6e 66 6e 2e 69 74 |na.infn.it| 0000006a
It doesn't seem "resposit" appears in it.
Yes, you're right, it was the point I was trying to make. The dovecot user (which in this case is equivalent to the email address arriving in the MAIL FROM command of the lmtp session) is what is stored in the duplicates db. Dovecot is not programmed to realize that these users can both read each others messages and will not recognize them as duplicates no more than if they were two completely separate users with no mail location in common.
Doveadm fetch shows the messages has the same message-id but I still get two copies with different guid/uid:
[root@imap1 ~]# doveadm -f table fetch -u resposit 'guid uid hdr.message-id date.received' mailbox INBOX | grep 2024-07-24 60525f254fbba0666221000091d3cd3c 18010 8803feb5-7c3e-4f04-b8ea-62761787e865@gmail.com 2024-07-24 10:29:03 28e634264fbba0666221000091d3cd3c 18011 8803feb5-7c3e-4f04-b8ea-62761787e865@gmail.com 2024-07-24 10:29:03
Doing what you suggest (manage aliases in the MTA rather than dovecot/ldap) would not be so easy in my case as it requires a lot of changes on a production system.
Currently I have a Proxmox Mail Gatway server (based on Postfix) which gets mail from outside, applies filters (greylisting, antispam, antivirus etc...) and delivers anything directed to my domain to a Dovecot server via LMTP transport. Dovecot knows LDAP aliases/usernames.
Do you think there might be any other workarounds to make the duplicate sieve extension work properly ?
Thanks,
Rosario
Il 19/07/2024 22:37, John Fawcett via dovecot ha scritto:
On 18/07/2024 15:37, Rosario Esposito via dovecot wrote:
Hi,
On a dovecot server (2.3.21) I have a simple sieve script:
require ["duplicate"]; # rule:[duplicate] if duplicate { discard; stop; }
I use virtual users with mail aliases on a LDAP backend.
I have user "resposit" having 2 mail aliases:
- resposit@na.infn.it
- rosario.esposito@na.infn.it
If I send a single message to both aliases I still receive 2 copies as you can see from the attached log.
Is the "duplicate" sieve extension supposed to work this way ?
Any help would be much appreciated !
I don't know how well Dovecot supports aliases where (I am presuming) you use the same mail location for multiple email addresses. I personally have all aliases defined at MTA level so all email addresses arriving in lmtp are one to one mappings with dovecot users.
I dont' know your configuration so I am a bit reluctant to suggest any changes. My only suggestion would be to look into returning a "user" field from your ldap userdb lookup to override the one received from lmtp. If you define the same override for both aliases (presumably resposit), that will be used as the user in the duplciates db and hopefully produce a match regardless of which alias is used.
John