Multi-IP address machine make postfix HELO name match the reverse DNS of the source IP that is bound to

postfix

On a Centos 6.6 server we have typically 3-4 Failover IP's that we distribute among our domains. In this way postfix, when sending outgoing email, binds to the IP linked for the domain separtating the reputation status of each IP.

The only problem is that postfix uses the hostname value as HELO-name and that hostname value does not correspond to the reverse DNS of the IP address actually used.

The way we distribute binding IP's is through the sender_dependent_transport_maps by which we define a series of smtp transport daemons in /etc/postfix/master.cf and we map the different domains to the transports with a berkeley_db. This technique is very well explained here:
http://wied.it/blog/sender-dependent-default-transport-maps-with-postfix-the-easy-way.html

In our case, the master.cf line for the SMTP daemon looks like the following:

outgoing-10.10.10.20- unix - n n - - smtp -o smtp_bind_address=10.10.10.20 -o smtp_bind_address6= -o smtp_address_preference=ipv4

We need two improvements with this approach:

  1. The smtp_helo_name should be generated dynamically from a reverse DNS lookup (everytime postfix or the smtp daemon starts) and not hardcoded in a configuration file.

  2. The master.cf line is also generated automatically from our panel software without the smtp_helo_name option. Ideally we would like to have this assignment defined in main.cf and be propagated to all smtp daemons.

Is there a way to assign the smtp_helo_name from reverse DNS lookup of the bound address and ideally at main.cf?

Best Answer

Postfix doesn't support those kinds of functionality (smtp_helo_name based on reverse IP). You need manually hardcoded it in master.cf.

In fact, postfix rarely use DNS lookup as source of information (except for several cases Mail routing via MX record and DNSBL restriction). You need to workaround it by

  1. Patching postfix or issue feature request to its author, Wietse Venema or
  2. Dynamically re-generate master.cf when you restart postfix, perhaps via wrapper script
Related Topic