Wietse Venema via Postfix-users escribió el 13/12/2023 a las 1:59:
Carlos Velasco via Postfix-users:
Thus, the Postfix code that handles header update/delete requests
was still naively skipping the first header, making calls to delete
the prepended Received-SPF: header ineffective, and mis-directing
calls to delete the first Milter-visible Received: header, instead
deleting the invisible Postfix-generated Received: header (wtf).

To maintain protocol compatibility, the Postfix code that handles
header update/delete requests will need to skip the Postfix-generated
Received: header, instead of the first message header.

Once that mess is handled with, we can consider adding a flag to
expose Postfix-generated Received: headers to Milters.

I think you are absolutely correct in your analysis.
I've been looking over the code and, although there is a lot I
still don't understand, your yesterday patch seems more a (good)
workaround to the real problem.
Below is a fix that does not break any of the already existng tests :-)
and that passes some new tests that I added for this specific case.
There is no difference when adding or inserting a header, only when
updating or deleting.

With this, no change is needed to the Postfix SMTP daemon. It is safe
to prepend headers with a Postfix access table or with header/body_checks.
They can be deleted or updated as expected.

The patch does not include changes to Postfix tests.


It works perfectly. Tested in 3.8.3.

Milter sees:
Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2620:137:e000::1:20; 
helo=out1.vger.email; envelope-from=linux-kernel-ow...@vger.kernel.org; 
receiver=<UNKNOWN> *<-- Prepend*
Received: (majord...@vger.kernel.org) by vger.kernel.org via listexpand *<-- 
First Received. Not own/auto header*
        id S232053AbjLMJED (ORCPT <rfc822;u...@domain.com>);
        Wed, 13 Dec 2023 04:04:03 -0500
...

Final email:
Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) * 
<-- Own/auto header*
    by server.domain.com (ESMTP Server) with ESMTP id 58781C00A2
    for <u...@domain.com>; Wed, 13 Dec 2023 10:04:28 +0100 (CET)
Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2620:137:e000::1:20; 
helo=out1.vger.email; envelope-from=linux-kernel-ow...@vger.kernel.org; 
receiver=<UNKNOWN>  *<-- Prepend*
Received: (majord...@vger.kernel.org) by vger.kernel.org via listexpand *<-- 
First Received. Not own/auto header*
        id S232053AbjLMJED (ORCPT <rfc822;u...@domain.com>);
        Wed, 13 Dec 2023 04:04:03 -0500
...

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