Re: [exim] ACL rewrite

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Searcher
Datum:  
To: exim-users
Betreff: Re: [exim] ACL rewrite
I was 'hinting' because I already asked once quite specifically but there
were no takers for the question so I figured I'd ask something easier and go
from there..

1. I have a list of clients
2. When an email arrives for a client from this list the $h_To gets
rewritten to use a different domain
3. When an email arrives with multiple recipients where few are from the
list and others are not I want to rewrite the same header only for the
existing clients and leave it intact for others (obviously)

So I added into acl/30_exim4-config_check_rcpt

  defer
        message       = only one recipient at a time
        condition     = ${if def:acl_m0 {1}{0}}


And in rewrite/31_exim4-config_rewriting I have
*@*
${lookup{$h_To:}lsearch{/etc/exim4/sc_clients}{$value}fail}
Ffrsq

Which works for a single recipients but not for multiple ones..


I will try to work out something from your suggestions below but if you can
advise anything better/further I'm all ears

Thanks


-----Original Message-----
From: exim-users-bounces@??? [mailto:exim-users-bounces@exim.org] On
Behalf Of W B Hacker
Sent: Wednesday, May 14, 2008 23:47
To: exim users
Subject: Re: [exim] ACL rewrite

Searcher wrote:
> Thanks for the reply Bill,
>
> The problem here is that I need to rewrite the headers for multiple
> recipients so the only way how to separate them (AFAIK) is to get in

emails
> one by one and check the rcpt_to value.
>
> Since I can't touch the headers yet I need to set some flags or variables,
> understood
>
> Could you please provide some simple syntax for doing so? Checking rcpt_to
> against a list of users and adding a flag at SMTP time and checking this
> flag at DATA (or later) time and modifying the headers? Or just point me

to
> some papers which deal with this thing specifically (I found few but maybe
> you know more readable ones)
>
> Can I perhaps use this new variable even in the rewrite part?
>
> Thank you either way
>


'Later' is the operative word.

Routers are the first 'as shipped' place that Exim processes traffic in
a 'fully' recipient-unique manner. smtp protocol doesn't support it any
earlier (unless you have courier-mta at BOTH ENDS of session, but that
is not Exim relevant).

As per-recipient information is already available in another header, you
can add a single 'flag' header OR acl_m variable value that *when
combined* with the recipient identity (AND ALSO perhaps another
lookup...) provides the unique trigger you seek.

You can use a complex conditional/lookup in a single router, ELSE a
longish chain of single-purpose routers that trigger only when their
simpler condition is met.

But I say again - the specific end result you seek (still not explained
to us) has probably already been done, and more than once, and in more
than one way.

We can't get very far in pointing you to a fitting example if all you
give us is a 'hint' at how you want to set up the first step...

What do you need to accomplish as an END result?

Bill

>
> Searcher wrote:
>> Hi there,
>>
>> how would I go about an ACL SMTP time header rewrite?
>> I need to check RCPT TO, that's not in the headers so can't use regular
>> rewrite/31_exim4-config_rewriting
>>
>> Thanks
>> -src-
>>
>>
>
> At RCPT TO you don't yet have any headers....
>
> Prior to DATA, all an smtp session has is a 'negotiation' situation.
>
> Your MTA and the distant sender are introducing themselves, exchanging
> credentials, describing what is available and what is wanted (connect,
> helo, mail_from, rcpt_to).
>
> Ever see two dogs meeting for the first time?
>
> Much the same.
>
> You can *prepare* headers to be substituted or appended later, and can
> set flags to cause whatever you have prepped to be actioned. Or NOT.
>
> But DATA is the earliest you are transferred the message and its headers
> and attachments (if any).
>
> That said, a flag, value, or string carried in an acl_m variable might
> serve you better than header alteration.
>
> Bill
>
>



--
## List details at http://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/