0

Any one the settings to remove hostname and IP address in mail headers sent from Postfix mail server.

Tried, myhostname=domain.com in main.cf but now working as expected.

Any config pls share

Regards Siva

3 Answers 3

2

You cannot remove the hostname or IP. However, you can change them if you don't want to expose the actual hostname.

in the main.cf file:

myhostname=myhostname.mydomain.com
myorigin=mydomain.com (or /etc/mailname and put your domain name in there)
inet_interfaces = <my_alt_IP>

Create a virtual NIC with it's own IP (eg eth0:0). Edit /etc/hosts to add the new IP and alt hostname.

4
  • "you cannot remove.." : Technically wrong. You can change or remove anything you like.. (For example in a smtp header checks.) But you will probably break the email remote delivery. If OP meant a first hop/receive line added (private IP/local machine ONLY/local client LAN IP), that can probably be removed w/o problems. These are not public routable IPs/machine names and consequently shouldn't break remote delivery.
    – B. Shea
    Jun 9, 2017 at 17:29
  • As mentioned below this will technically break RFC - though removing the private IP info should not affect delivery most places. Add /^Received: .*/ IGNORE to your pcre header-check in postfix main.cf. All locally added 'Received:' lines will be stripped except for very first 'relay' to the local SMTP (usually 127.0.0.1).
    – B. Shea
    Jun 9, 2017 at 19:35
  • You could also use "REPLACE" (instead of IGNORE) to change the clients IP and/or hostname to something madeup if it bothers you. (In first receive from). Probably a better choice..
    – B. Shea
    Jun 9, 2017 at 19:37
  • postfix.org/header_checks.5.html
    – B. Shea
    Jun 9, 2017 at 19:39
0

Do you mean that you want to amend or remove the Received: entry placed into an email header by your mail server? If so, note that section 4.4 of RFC 2821 says clearly that

An Internet mail program MUST NOT change a Received: line that was previously added to the message header. SMTP servers MUST prepend Received lines to messages

and moreover that your Received: line

SHOULD contain both (1) the name of the source host as presented in the EHLO command and (2) an address literal containing the IP address of the source, determined from the TCP connection.

In other words, what you ask is an RFC violation. Don't do it, no matter who else thinks it's a good idea.

0
-1

The Received-Header which contains the ip/helo/reverse dns of your postfix server is written by the RECEIVING mail server, not by your postfix, so there is no way to remove this. you could only remove received headers which contain information about the submitting mail client (header checks IGNORE rule)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .