Re: [exim] Forwarding to destination / SRS / SPF

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Rob Gunther
Datum:  
To: exim-users, Rob Gunther
Alte Treads: Re: [exim] Forwarding to destination / SRS / SPF
Betreff: Re: [exim] Forwarding to destination / SRS / SPF
Finally I've had some success. You email explain it perfectly, but for an
exim newbie it was still a challenge. I got it working, but have come up
with something that is not so nice.

Here is the flow of what I am doing.

1) In ACL where I accept message I execute:

set acl_m_delivery =
${lookup{$local_part}nwildlsearch{/etc/domains/$domain/deliverydat}}

2) Then in a redirect router I decide if I should do an SRS rewrite of the
errors_to address:

condition = ${if == {${extract{srs}{$acl_m_delivery}}}{1}}
condition = ${if match{${lookup dnsdb{>\n;
defer_never,txt=$sender_address_domain}}}{\N(?m)^v=spf1\s\N} {1}{0}}
address_data = ${readsocket{/tmp/srsd}\
{FORWARD $sender_address_local_part@$sender_address_domain k2.com\n}\
{5s}{\n}{:defer: SRS daemon failure}}
errors_to = ${quote_local_part:${local_part:$address_data}}@
${domain:$address_data}

3) My final action takes place in a manualroute:

route_data = ${extract{smarthosts}{$acl_m_delivery}}


All well and good, it works. Read the configuration from a file and act on
it. Perfect.

The potential problem I am seeing is a user provides (via web page) their
destination server, which
is incorrect. I am reading from the deliverydat file (along with SRS
action).

Since I am reading the deliverydata in the ACL, which is only executed when
the message is first received I can end up with stuck messages. The user
provides bad destination server info, I read it... message stuck.

If I was to read the deliverydat file in the router will the file be read
every time the message is
processed? That way if the server information is corrected, EXIM will
automatically have access to it.

I tried reading in the router, storing it in address_data but that caused a
conflict. Is there another
variable I can use to store the data from my deliverydat file in the router?



Thanks,

Robert G.



On Thu, Sep 5, 2013 at 4:12 AM, Phil Pennock <exim-users@???>wrote:

> On 2013-09-02 at 22:08 +0900, Rob Gunther wrote:
> > dns:aspmx.l.google.com::25:alt1.aspmx.l.google.com::25
> > payments:aspmx.l.google.com::25:alt1.aspmx.l.google.com::25
> > postmaster:aspmx.l.google.com::25:alt1.aspmx.l.google.com::25
> > r:aspmx.l.google.com::25:alt1.aspmx.l.google.com::25
> > sales:aspmx.l.google.com::25:alt1.aspmx.l.google.com::25
>
> > I currently read the values of these files in my exim router and
> associate
> > the parts to local_parts and route_list.
> >
> > Can I have exim use the data read from that file to make decisions?
> Maybe
> > something like this:
> >
> > dns:0:aspmx.l.google.com::25:alt1.aspmx.l.google.com::25
> > payments:0:aspmx.l.google.com::25:alt1.aspmx.l.google.com::25
> >
> > So could I get the router to check if that value is a 0, do not use SRS?
> >
> > Am I totally confused? I feel totally confused.
>
> You might want to look into the ${extract...} expansion item and the
> address_data variable and router option.
>
> dns: spf="0" smarthosts="aspmx.l.google.com:25; alt1.aspmx.l.google.com:25
> "
>
> Then you might use:
>
> address_data =
> ${lookup{$sender_address_local_part}lsearch{/path/to/file}}
>
> This will be available in subsequent routers, and in transports. You
> might instead use an $acl_m_foo variable, set in an ACL. Just note that
> you can't meaningfully reference $address_data in a *pre-condition* in
> the same Router which might later set it. (Well, not unless you're doing
> hideously complicated chaining of value setting.)
>
> You can then get the 'spf' field with:
>
> ${extract{spf}{$address_data}}
>
> and you might use the smarthosts with:
>
> route_data = <; ${extract{smarthosts}{$address_data}}
>
> (I think route_data will use list separator changers, to avoid needing
> to double colons for ports, but I might be misremembering)
>
> -Phil
>