On Mon, Jul 30, 2012 at 11:56:05PM -0500, Russell Jones wrote:

> The source IP is defined based on the sender's domain. This is what
> I need to achieve: "Recently there have been requests for sending
> mail with source IP addresses that depend on the envelope sender."
> (http://www.mail-archive.com/postfix-users@postfix.org/msg18419.html)

The source IP address of an outbound delivery is controlled by the
kernel IP stack, but can be pre-empted by the SMTP delivery agent.

To send *from* 192.0.2.1, instead of configuring an inbound listeners
on 192.0.2.1 and setting the transport:nexthop to smtp:192.0.2.1,
which means delivering *to* that IP address, you need a master.cf
entry (a transport), which sends from that IP address:

  master.cf:
    foo_smtp      unix  -       -       -       -       -     smtp
      -o smtp_bind_address=$foo_smtp_bind_address
    bar_smtp      unix  -       -       -       -       -     smtp
      -o smtp_bind_address=$bar_smtp_bind_address
    ...

  main.cf:
        indexed = ${default_database_type}:${config_directory}/
        sender_dependent_default_transport_maps = ${indexed}def-xprt
        ...
        foo_smtp_bind_address = 192.0.2.1
        bar_smtp_bind_address = 192.0.2.2
        ...

  def-xprt:
        @example.com    foo_smtp
        @example.net    bar_smtp


> I understand that having it deliver to itself is a
> silly task to attempt to undertake - my attempt was to get it to
> send from that IP/service.

But you have not taken the time to understand what either the
default_transport parameter or its sender-dependent behaviour mean.
Hence, re-read the documentation until these are actually clear.

> This was simple to achieve in Exim. Re-reading the same man pages is
> futile, and buying a book to achieve what should be a simple goal
> seems like overkill.

Since you've chosen Postfix, something else you want is easier to
achieve in Postfix, all designs have trade-offs. Choose the MTA
that best meets your needs. Study it well, a lot of effort goes
into comprehensive documentation of Postfix, and the books expand
on this with extensive analysis of use cases that expand your
understanding.

Rereading is rarely futile, each time I re-read technical material
that introduces new concepts I learn something new unless/until I
am as expert as the author on the topic at hand. The trick is to
read carefully and to take the time to test one's knowledge with
exercises (in the case of Postfix test configurations that that
prove to yourself that your mental model matches reality).

-- 
        Viktor.

Reply via email to