Postfix Hide Client (MUA) System IP Address / Hostname

September 8, 2019

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

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:.*[      IGNORE
/^Received:.*[ 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: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Article Tags:
Article Categories:
How To

Comments are closed.