Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I run a web application on Amazon EC2 and, because of the shortcomings with AWS and reverse DNS, I direct email to a dedicated SMTP server running Postfix at a different provider.

Unfortunately the system adds the orginating EC2 info to the header, and some ISPs are blacklisting all EC2 IP ranges. Is there any way to have Postfix ignore or strip the EC2 information? I'm assuming this will help with deliverablity. I've included a sample header below. Thanks!

Received: from mail.smtp-server.com (localhost [127.0.0.1])
    by mail.smtp-server.com (Postfix) with ESMTP id 7EB305
    for <user@somedomain.com>; Thu, 24 Sep 2009 16:11:37 +0000 (UTC)
Received: from www.EC2domain.com (ec2-IPaddress.compute-1.amazonaws.com [EC2 Static IP address])
    by mail.smtp-server.com (Postfix) with ESMTPSA id 56A865
    for <user@somedomain.com>; Thu, 24 Sep 2009 16:11:37 +0000 (UTC)
share|improve this question

1 Answer 1

A good way to do this is with postfix header_checks:

  1. Install or compile postfix-pcre to get Perl compatible regular expression evaluation into Postfix, if your postfix doesn't have it compiled in already.
  2. Add info main.cf:

    header_checks = pcre:/etc/postfix/header_checks

  3. Add the following into /etc/postfix/header_checks:

    /^(Received: .*IP\.ADD\.RE\.SS.*)/ IGNORE

The IGNORE line will tell it to drop that line from the header of the email. I haven't tested this regex, so you might want to test with WARN. You can also use REPLACE, as seen here.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.