Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1163
  • Last Modified:

Postfix - Binding IP based on sender

Hi all,

I've been dealing with a specific postfix setup for the past few days involving postfix (mail_version = 2.9.5) and the sender_dependent_default_transport_maps directive to make postfix use different bindings for different mailings based on sender envelope. I've postmapped all files, reloaded and restarted postfix, even restarted the server after these changes.

After sending many test emails playing around with the headers, etc. the server always sends email out via 10.1.1.1 (eth0) and not the alias interfaces that i've
binded.

I'm running CentOS 6.3 64bit if it makes any difference. Only thing i can think of is trying with Fedora, SuSE, Ubuntu or any other distro because i ran out of ideas. Is there any debugging that can be enabled to figure out how postfix is deciding what interface to use?



ifconfig:

eth0      Link encap:Ethernet  HWaddr 00:50:56:XX:XX:XX
          inet addr:10.1.1.1  Bcast:10.1.1.255  Mask:255.255.255.0
          inet6 addr: fe80::250:ffff:ffff:ffff/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:23083 errors:0 dropped:0 overruns:0 frame:0
          TX packets:19581 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3062523 (2.9 MiB)  TX bytes:3775988 (3.6 MiB)

eth0:0    Link encap:Ethernet  HWaddr 00:50:56:XX:XX:XX
          inet addr:10.1.1.2  Bcast:10.1.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

eth0:1    Link encap:Ethernet  HWaddr 00:50:56:XX:XX:XX
          inet addr:10.1.1.3  Bcast:10.1.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

eth0:2    Link encap:Ethernet  HWaddr 00:50:56:XX:XX:XX
          inet addr:10.1.1.4  Bcast:10.1.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

Open in new window



postconf -m:
btree
cidr
environ
fail
hash
internal
ldap
memcache
nis
pcre
proxy
regexp
static
tcp
texthash
unix

Open in new window



stuff added to /etc/postfix/master.cf:

onecom  unix - - - - - smtp
   -o smtp_bind_address=10.1.1.2
   -o smtp_helo_name=mail.one.com

twocom  unix - - - - - smtp
   -o smtp_bind_address=10.1.1.3
   -o smtp_helo_name=mail.two.com

threecom  unix - - - - - smtp
   -o smtp_bind_address=10.1.1.4
   -o smtp_helo_name=mail.three.com

Open in new window


main.cf

...
myhostname = server.domain.com
mydomain = $myhostname
myorigin = $mydomain
inet_interfaces = all
relayhost =
...
sender_dependent_default_transport_maps = hash:/etc/postfix/sender_transport

Open in new window


/etc/postfix/sender_transport
user@one.com onecom:
user@two.com twocom:
user@three.com threecom:

Open in new window


postmap -q user@one.com hash:/etc/postfix/sender_transport
onecom:

Open in new window


postmap -q user@two.com hash:/etc/postfix/sender_transport
twocom:

Open in new window


postmap -q user@three.com hash:/etc/postfix/sender_transport
threecom:

Open in new window

0
ddiazp
Asked:
ddiazp
1 Solution
 
ddiazpAuthor Commented:
This same config works on OpenSUSE 12 with a minor change on sender_transport (without the colon at the end):

user@one.com onecom
user@two.com twocom
user@three.com threecom

That change didn't fix it for CentOS. An OS thing I suppose...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now