Postfix Hide Client (MUA) System IP Address / Hostname

Posted on in Categories , , , , , , , , , last updated June 17, 2009

I‘ve central mail server gateway. All of our internal systems through this box. How do I remove or hide the hostnames and IP addresses of our internal systems from the messages headers before they go out to other users for security purpose?

Postfix MTA can filter headers using header_check (built-in content inspection) directive. Open file, enter:
# vi /etc/postfix/
Now, turn on local recipient checking in the SMTP server, specify the header_checks parameter specifies an optional table with patterns:

header_checks = regexp:/etc/postfix/header_checks

Save and close the file. Create /etc/postfix/header_checks file, enter:
# vi /etc/postfix/header_checks
Ignore, and 192.168.0.[0-9] IP address (regex) from the headers :

/^Received:.*\[127\.0\.0\.1/      IGNORE
/^Received:.*\[10\.24\.55\.1/ IGNORE
/^Received:.*\[192\.168\.0\.[0-9]/      IGNORE

# postmap /etc/postfix/header_check
# service postfix reload

# service postfix restart
See header_check(5) man page for further details.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

5 comment

  1. Hi Expert,
    In my case, i want to remove (Postfix) pattern to hide my mail system brand
    ===by (Postfix) with ESMTPSA id 7C24D5E37B===
    How can i change to:
    ===by with ESMTPSA id 7C24D5E37B===

    Received: from Simon-Vs-MBCuiPap.local (unknown [])
    (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits))
    (No client certificate requested)
    (Authenticated sender: [email protected])
    by (Postfix) with ESMTPSA id 7C24D5E37B
    for ; Wed, 16 May 2012 15:40:33 +0800 (SGT)

    1. Hi Simon

      Currently i am having same issues.if you do have fixed it please let me know.
      But as i check my log file it shows my relaymail server hostname and its ip address.
      or do you have idea how do i check my postfix config is working?

Leave a Comment