Hi,

I have postfix-3.5.2 on fedora and trying to strip internal submission
headers using the cleanup service and can't get it working.

In master.cf:
auth-cleanup   unix n       -       -       -       0       cleanup
   -o syslog_name=postfix/auth-cleanup
   -o header_checks=pcre:/etc/postfix/auth_header_checks.pcre

submission inet n       -       n       -       -       smtpd
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
  -o milter_macro_daemon_name=ORIGINATING
  -o receive_override_options=$submission_overrides
  -o syslog_name=postfix/submission
  -o cleanup_service_name=auth-cleanup

In /etc/postfix/auth_header_checks.pcre I've tried a number of different
approaches.
/^\s*(Received: from)[^\n]*(.*for <.*@(?!inside.mydomain.com).*)/ REPLACE
$1 [127.0.0.1] (localhost [127.0.0.1])$2
/^Received:.*\(Authenticated sender:/ IGNORE
/^Received:.*/ IGNORE
/^Received:.*from sage/   IGNORE
/^Received:.*from juggernaut/   IGNORE
/^Received:.*from orion/   IGNORE
/^Received:.*from sage\.inside\.mydomain\.com
\(sage\.inside\.mydomain\.com/ REPLACE
/^Received:\s+.*/ REPLACE hello
/^Received:.*\(Authenticated sender:/ IGNORE

The first one works when using postmap -q directly:
$ postmap -q "Received: from sage.inside.mydomain.com (
sage.inside.mydomain.com [192.168.1.7])"
pcre:/etc/postfix/auth_header_checks.pcre
REPLACE Received: from 127.0.0.1

Headers from a sample email:

Received: from sage.inside.mydomain.com (sage.inside.mydomain.com [192.168.1.7])
        (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
         key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest 
SHA256)
        (Client did not present a certificate)
        (Authenticated sender: john)
        by orion.guardiandigital.com (Postfix) with ESMTPSA id 5B4DD8078BF4
        for <rem...@remotedomain.com>; Sat,  1 Aug 2020 14:19:45 -0400 (EDT)

Entry from /var/log/maillog for the auth-cleanup service:
Aug  1 14:49:56 orion postfix/auth-cleanup/cleanup[4080207]: D14C08078BF4:
message-id=<20200801184956.d14c08078...@orion.mydomain.com>

What am I doing wrong?

Reply via email to