I've got a project coming up which needs some careful IP accounting for
traffic into/out of the system. The trickiest part of this strikes me
as being differentiating outbound SMTP data so that traffic from
particular sources can be measured seperately.
Outbound SMTP traffic will be submitted to mail.abc.com, mail.def.com,
..., mail.xyz.com depending on user in question. Mail.*.com will be a
virtual server. The various mail.*.com virtual servers will all be
served by the same set of real hosts behind a load-balancer.
To keep traffic measurement simple I'd like to measure this traffic at
an IP level - either from individual (sub-)interfaces, or from the
load-balancer. My preference is the latter. In order to associate the
outbound traffic with the correct virtual-server I'll need the outbound
SMTP sessions, to originate connections from particular IP addresses.
I can accomplish this by running multiple instances of postfix, each
with its own configuration and queues, but I'd rather find a more elegant
approach. What I ideally need is some may of setting the smtp_bind_address
for a relayed message based on the interface upon which smtpd received the
I've had a look at using one postfix instance, and binding smtpd on
different addresses / ports, but I can't see how I can enfore a particular
source address for outbound messages. I've tried '-o smtp_bind_address'
in the master.cf definition of each smtpd listener, but it doesn't appear
to work (not surprisingly, it's an SMTP client option, not a daemon
Another possibility might be to try and put messages from each of the
various smtpd listeners into different queues, which are then delivered
by smtp clients configured with queue-specific source addresses, but I
haven't looked into that properly yet.
Just to complicate matters even more, content filtering will be thrown
into the loop as well, but that's another story...
Has anybody done this before? Are multiple postfix instances the only
way to achieve it? Might something other than postfix be a better fit?
Thanks in advance,