OK!

On Sat, Dec 01, 2007, Mary Gardiner wrote:
> 1. mx.example.com should deliver mail for local users in the usual manner.
> If local delivery is impossible (one case is when amavis, which is
> specified as the content_filter, is down) it should queue it.

This can probably be done via the mydestinations variable in
/etc/postfix/main.cf, but since I'm going to have to use transport maps,
I'll do it all in one place.

/etc/postfix/main.cf:
transport_maps = hash:/etc/postfix/transport

/etc/postfix/transport:
localhost               :                                                       
                
localhost.localdomain   :                                                       
        
example.com             :

> 2. mx.example.com should deliver mail to example.org to
> finaldest.example.org, and if finaldest.example.org fails, it should
> queue it (mx.example.com is a MX for example.org, and if
> finaldest.example.org is down for long periods of time, I'd like to be
> able to get at the mails in the queue). I'm currently achieving this via
> a transport_maps line:
> example.org smtp:[finaldest.example.org]

I still do this this way:

/etc/postfix/transport:
# use the standard smtp transport, send via finaldest.example.org
example.org             smtp:[finaldest.example.org]

> 3. mx.example.com should deliver all other mail (from the internal network)
> to relay.example.com port 10025 (this bypasses a second amavis check on
> relay.example.com and this is good since relay.example.com is not overly
> endowed with resources). However, if relay.example.com it should deliver
> mail to isp-relay.example.com, port 25.

This is still a pain in the neck, but has actually been accomplished.

First, our new transport with smtp_fallback_relay set:

/etc/postfix/master.cf:
custom-outgoing        unix    -       -       -       -       -       smtp -o 
smtp_fallback_relay=[isp-relay.example.com]:25

(The :25, being the default port, is optional here)

Then, we specify the *default* relay via transport_maps, and tell it to
use the "outgoing" transport, as set up above, and to sned via
relay.example.com if it can:

/etc/postfix/transport:
# underneath all the other entries, since this is a catch-all
*                       custom-outgoing:[relay.example.com]:10025

This way ONLY non-local, non-example.org mail even goes anywhere near
the smtp_fallback_relay setting, which is a good thing since it seems to
apply overly-much (eg, it was applying to LOCAL mail when amavis was
down!)

What didn't work
----------------

For #3, something to avoid:

/etc/postfix/master.cf:
outgoing        unix    -       -       -       -       -       smtp -o 
relayhost=[relay.example.com]:10025 -o 
smtp_fallback_relay=[isp-relay.example.com]:25

/etc/postfix/transport:
*   outgoing:

I really liked the idea of this one, since it didn't spread my
configuration of outgoing mail across two files. However, it turns out
that passing "relayhost" to "smtp" doesn't work, as "relayhost" is
actually an argument to the trivial-rewrite transport, not the smtp
transport. According to the Postfix mail if you can't set a global
relayhost the only options you have are:
 - set it in transport maps (as I've done)
 - run entirely separate Postfix processes if for some reason transport
   maps aren't powerful enough for you (usually because they only accept
   *one* relay)
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to