I have configured postfix to remove certain header fields from outgoing mail, such as the first received line that contains the User-Agent string and the IP address of the sending client as described in this answer on Ask Ubuntu.

I have also set up OpenDKIM and OpenDMARC to verify incoming mail and configured OpenDMARC to reject mails that fail DMARC evaluation. Unfortunately, mails that fail DMARC evaluation are not rejected by Postfix when the subcleanup service is enabled and configured as in Ask Ubuntu answer mentioned above. When I disable the subcleanup service and essentially revert the changes from the Ask Ubuntu answer, then postfix is correctly rejecting mails that fail DMARC evaluation again.

When subcleanup is disabled and mails get rejected, the postfix log says something like this:

Feb 28 15:21:38 mx0.domain.tld postfix/cleanup[1234]: AA11111A1A: milter-reject: END-OF-MESSAGE from foobar.com[2000:aa:aaaa:aaaa:aaaa:aaaa:aaaa:aaaa]: 5.7.1 rejected by DMARC policy for someotherdomain.com; from=<user@someotherdomain.com> to=<user@domain.tld> proto=ESMTP

So the cleanup service is involved in rejecting incoming mails that were rejected by milters. I believe that the subcleanup service somehow overwrites the cleanup service and therefore does not reject incoming mail that failed DMARC evaluation.

Question: How can I configure the subcleanup service (with the goal to remove sensitive information such as IP addresses and UA strings from outgoung outgoing mail) and make postfix correctly use the cleanup service to reject incoming mail that failed DMARC evaluation.


I have disabled/enabled the service and restarted postfix a few times and now it is working, even though the configuration is exactly the same as before. This is weird.

Please close or remove this question, as it might be user error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.