>Viktor Dukhovni wrote:
> Furthermore, because "*" is cached, you really don't want to use
> "*" at all for dynamic transport resolution.
Thanks for your input RE the caching of the special pattern "*" results.

> I answered your question upthread, use:
>     sender_dependent_default_transport_maps
> For some reason you're still looking elsewhere...
I can't use sender_dependent_default_transport_maps because I don't
want to use sender-based static "routes". I'm looking for a "random"
or round-robin-ish split of smtp that provides consistent "helo ..
hostname .. ip .. reverse-dns-lookup"


Anyways, I've got the round-robin working now, using transport_maps
and this script https://gist.github.com/mvsantos/9813415
But I'm finding the solution very ugly. There must be a more elegant
way to do dynamic smtp deliveries...

$ postconf mail_version
mail_version = 2.11.0

# main.cf
transport_maps = tcp:127.0.0.1:9999

# master.cf
127.0.0.1:9999    inet    n       n    n    -    0    spawn
  user=nobody argv=/usr/local/sbin/postfix-smtp-roundrobin.pl

smtp1    unix    -    -    n    -    -    smtp
    -o myhostname=X.mydomain.tld
    -o smtp_helo_name=X.mydomain.tld
    -o smtp_bind_address=1.1.1.1
    -o syslog_name=smtp-1

smtp2    unix    -    -    n    -    -    smtp
    -o myhostname=Y.mydomain.tld
    -o smtp_helo_name=Y.mydomain.tld
    -o smtp_bind_address=2.2.2.2
    -o syslog_name=smtp-2
# End of master.cf


And for every mail sent or received I have 8 extra lines in my logs
(below, not in the correct order) and the time of processing has
increased a bit - not because of the extra logging, but because of the
transport_maps.

Let's see how it performs under load tomorrow, when I make it live...

smtp-roundrobin[1234]: Using: 'smtp2:' transport service. Query: get *
smtp-roundrobin[1234]: Using: 'smtp1:' transport service. Query: get *
smtp-roundrobin[1234]: Using: 'smtp2:' transport service. Query: get
b...@foreign.tld
smtp-roundrobin[1234]: Using: 'smtp1:' transport service. Query: get
f...@mydomain.tld
postfix/qmgr[4567]: smtp1:
default_destination_concurrency_positive_feedback feedback type 0
value at 5: 1
postfix/qmgr[4567]: smtp1:
default_destination_concurrency_negative_feedback feedback type 0
value at 5: 1
postfix/qmgr[4567]: smtp2:
default_destination_concurrency_positive_feedback feedback type 0
value at 5: 1
postfix/qmgr[4567]: smtp2:
default_destination_concurrency_negative_feedback feedback type 0
value at 5: 1

Reply via email to