Wietse Venema via Postfix-users escribió el 10/12/2023 a las 15:53:
Carlos Velasco via Postfix-users:
2. Duplicated SMTP Access Policy Delegation
This issue is related to headers too.
I'm using pypolicyd-spf as policy daemon to check SPF. It is working fine.
The execution happens before milter. This is ok.
Prepended "Received-SPF" header by pypolicyd-spf show up in the milter. This is 
ok.
But in the final email, the one received by the IMAP server,
"Received-SPF" header is duplicated, one in the location shown at
the milter process (heder callback), but another new one, just
above the "own Postfix-prepended Received: header". This is weird.
If the milter adds Received-SPF twice, then you are processing a message
twice with that Milter.

Output from:

postconf -n
postconf -Mf

Is requuired fo further support.

I have collected the postconfs (see below), but I I've done some tests and I 
think I know what's happening.
Please note that "Received-SPF" is not coming from milter, it comes from policy 
daemon (inside smtpd_recipient_restrictions: check_policy_service 
unix:private/policyd-spf).

So, policyd-spf is executed first, along all smtpd_recipient_restrictions. After, in the 
milter, the first header to show up in header callback is this "Received-SPF".
Now comes the "weird thing"... If I don't touch headers in the milter, all is fine, 
"Received-SPF" is not duplicated, but note that, in the final email, this header is 
located *above* own Received (the one missing in milter, that is, my point 1).

Test 1: If I delete this "Received-SPF" header in the milter (with chgheader 
with index 1 and undef), the header still show up in the final email, again, above own 
Received.
Test 2: Delete this "Received-SPF" header in the milter (chgheader) and recreate again 
(with addheader). Then duplicated "Received-SPF" headers show up in the final email, one 
above own Received and another one in the placer inserted by the milter.

So, I think there is a "ghost" Received-SPF header coming from policyd that 
doesn't works well with the milter.

Info: the reason to delete/add headers is because the filter can, sometimes, 
change the whole mail, so the headers are first deleted and then recreated, 
this is how I hit this weird issue.

As a workaround, I can just ignore/delete the "Received-SPF" header in the 
milter, as it is *always* there in the final mail, above own Received.

postconf -n:
https://pastebin.com/y3auzWHy

postconf -Mf
https://pastebin.com/a2t3jdgm

Regards,
Carlos Velasco
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to