Solved

Postfix - Binding IP based on sender

Posted on 2013-01-22
1
1,156 Views
Last Modified: 2013-01-23
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
Comment
Question by:ddiazp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 10

Accepted Solution

by:
ddiazp earned 0 total points
ID: 38810932
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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Utilizing an array to gracefully append to a list of EmailAddresses
The new Gmail Phishing Scam going around is surprising even the savviest of users with its sophisticated techniques.
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Suggested Courses

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question