Re: [exim] how to detect if address aliased?

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Giuliano Gavazzi
Ημερομηνία:  
Προς: exim-users
Αντικείμενο: Re: [exim] how to detect if address aliased?


On Mon, 12 Dec 2005, Tony Finch wrote:

> On Sat, 10 Dec 2005, Magnus Holmgren wrote:
>> Giuliano Gavazzi skrev:
>
>>> In short, how do I detect that a redirect router has successfully
>>> redirected an address?
>>
>> Suggestion: Set address_data in the redirect routers (make sure that you
>> have preconditions that fail for addresses not handled by the routers),
>
> This is what I do. We have virtual domains in the form of aliases files.
> Some domains have "escape routes" for special case addresses (such as
> ticketing systems) which are only valid internally to our mail hub and by
> arrangement with the target system. E.g. there might be an escape route in
> the botolph.cam.ac.uk domain for rt.botolph.cam.ac.uk.

[...]
>> If you use address_data for other purposes it becomes more complicated,
>> of course.
>
> If you add keyword/value pairs to address_data then you can use ${extract
> to pull out the various parts. If you are careful you can then use if for
> multiple purposes.


Tony, thank you you too! I modified the routers last night but I am not
too happy about that complication, maybe I need to think about it with a
clear mind. I too have alias based virtual domains (I like being able
to add a domain simply adding a new directory built from a template).
Also, as I wrote before, I have three (yes, three) redirect routers
just for aliases, one for special case foo-whatever,
another for foo[-optional] local parts, and a third for the system
wide aliases. This is what I got (with a better naming system):

# domain aliases, for optionally suffixed local_parts
domain_aliases_unspec:
driver = redirect
allow_fail
allow_defer
domains = +local_domains
address_data = ${extract{field}{$address_data}} aliased=\
${lookup{$local_part}lsearch{DOMAINS_DIR/$domain/alias}{$value}fail}
data = ${extract{aliased}{$address_data}}
file_transport = address_file
pipe_transport = address_pipe

# domain aliases, catch all suffixes
domain_aliases:
driver = redirect
allow_fail
allow_defer
domains = +local_domains
local_part_suffix_optional
local_part_suffix = -* : +*
address_data = ${extract{field}{$address_data}} aliased=\
${lookup{$local_part}lsearch{DOMAINS_DIR/$domain/alias}{$value}fail}
data = ${extract{aliased}{$address_data}}
file_transport = address_file
pipe_transport = address_pipe


# common aliases
system_aliases:
driver = redirect
allow_fail
allow_defer
domains = +local_domains
local_part_suffix_optional
local_part_suffix = -* : +*
address_data = ${extract{field}{$address_data}} aliased=\
${lookup{$local_part}lsearch{GLOBAL_DIR/alias}{$value}fail}
data = ${extract{aliased}{$address_data}}
file_transport = address_file
pipe_transport = address_pipe


here I preserve an eventual field=value field that might be also stored in
address_data. Also, I fail when the lookup fails so that address_data is
not reset (normally at least one of these aliases will fail to lookup)..

The localuser router then checks that the aliased field is not empty::

localuser:
driver = accept
debug_print = \n\n\n***************
\ndebug:$address_data\n***************\n\n\n
check_local_user
domains = +local_domains
local_part_suffix_optional
local_part_suffix = -* : +*
condition = ${if !eq {${extract{aliased}{$address_data}}}{} {1}{0}}
transport = local_delivery
headers_remove = X-Spam-Report:X-Spam-Score:X-Spam-Score-Int:\
X-XPoint-AntiAbuse:X-Spam-Status:X-Spam-Level:\
X-Spam-Checker-Version:X-Fortune:X-Disclaimer


I do not like it that much but it works. And it all works so well with the
local sender verify (called by a sender verify for authenticated users)::

local_sender_verify:
driver = redirect
# verify_only
verify_sender
allow_fail
allow_defer
data = $local_part@$domain
local_part_suffix_optional
local_part_suffix = -* : +*
domains = +local_domains
condition = ${if eq{$local_part}{$authenticated_id}{no}{yes}}
fail_verify_sender

but this is the topic for another post...

Thanks again

Giuliano