Stripping Headers in Postfix
How to hide Received headers when relaying emails - handy when you trust an authenticated user who shares an IP with a known spammer.
I've been given a Nokia 6120, and have a three PAYG SIM card in it, with which I plan to use the £5 for 2GB within a month addon every month. However, SpamAssassin gave all emails from my phone a high spam rating. A closer look revealed that three's internet access NAT gateway IPs are on spam blacklists, therefore I needed to strip the Received: header containing three's gateway IP.
In Debian, first apt-get install postfix-pcre
Then add to the end of /etc/postfix/main.cf the line:header_checks = pcre:/etc/postfix/header_checks
The file /etc/postfix/header_checks should contain Perl regular expressions and what they should be rewritten to. The following rule will satisfy SpamAssassin by changing the Received header to an X-Received:/^(Received: .*mia\.three\.co\.uk.*)/ REPLACE X-$1
However, there may be badly implemented spam filtering software that just greps all headers for bad IPs, so to be on the safe side I stripped the recieved line totally:/^(Received: .*mia\.three\.co\.uk.*)/ REPLACE X-Recieved: Authenticated phone or internet dongle on three network
This is a white lie though, as any email from three's mobile internet access gets this header, not just 'authenticated' ones, but since I'm not an open relay, the only people who can recieve these messages are users on my local box. A small price to pay to enable emails that I send on mobile to not me put in Junk. It might well be a good idea to implement this whatever your mobile internet provider is, a single bad customer could put your shared IP there on a blacklist




comments