irulan.net

How to Remove Sensitive Header Information With Postfix

Create /usr/local/etc/postfix/header_checks:

/^Received:.*with ESMTPSA/  IGNORE
/^X-Originating-IP:/        IGNORE
/^X-Mailer:/                IGNORE
/^Mime-Version:/            IGNORE
/^User-Agent:/              IGNORE

Add this to /usr/local/etc/postfix/main.cf:

mime_header_checks = regexp:/usr/local/etc/postfix/header_checks
header_checks = regexp:/usr/local/etc/postfix/header_checks

Evaluate the file and reload Postfix:

postmap /usr/local/etc/postfix/header_checks
service postfix reload

Now, local IP information of your internet connection used to send emails is stripped out as well as your email client identifier and other possibly interesting information. This does not affect the deliverability of your emails.