Re: [Exim] Conditions

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Juha Saarinen
Ημερομηνία:  
Προς: exim-users@exim.org
Αντικείμενο: Re: [Exim] Conditions
On Tue, 14 May 2002, Philip Hazel wrote:

> Yes. I think. :-)


Heh. That condition was generated by convert4r4.

> A simpler condition would be
>
>    condition = ${lookup{$local_part}lsearch{/etc/exim/$domain.aliases}{yes}{no}}


It is indeed.

> Another possibility:
>
>    domains = right.domain : ...  (or a lookup of some kind - dsearch may be useful)
>    local_parts = lsearch;/etc/exim/$domain.aliases


I've got "domains" set already.

> You may want to add no_more to that.


Wouldn't that stop the chain of processing? I'm trying to accomplish this:

Incoming message ->     Router A
            Is it for domain A?
            Yes -> Transport A
            No
            |
            Router B
            Is it for domain B?
            Yes -> Transport B
            No
            |
            Router C
            Is it for domain C?
            Yes -> Local delivery
            No
            |
            Bounce message


Only domain C users have system accounts.

Here are the routers I have, in this order:

dnslookup:
driver = dnslookup
domains = ! +local_domains
transport = remote_smtp
ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
no_more


system_aliases:
driver = redirect
allow_fail
allow_defer
data = ${lookup{$local_part}lsearch{/etc/aliases}}
# user = exim
file_transport = address_file
pipe_transport = address_pipe

domainA:
driver = accept
condition =
${lookup{$local_part}lsearch{/etc/exim/${domain}.aliases}{yes}{no}}
domains = domainA
local_parts = lsearch;/etc/exim/$domain.aliases
retry_use_local_part
transport = domainA

domainB:
driver = accept
condition =
${lookup{$local_part@$domain}lsearch{/etc/exim/${domain}.aliases}{yes}{no}}
domains = domainB
local_parts = lsearch;/etc/exim/$domain.aliases
retry_use_local_part
transport = domainB

userforward:
driver = redirect
check_local_user
file = $home/.forward
no_verify
no_expn
check_ancestor
# allow_filter
file_transport = address_file
pipe_transport = address_pipe
reply_transport = address_reply


# This router matches local user mailboxes.

localuser:
driver = accept
domains = domainC
check_local_user
transport = local_delivery


/etc/exim/domains contains:

domainA
domainB

/etc/exim/domainA.aliases contains:

juha:
postmaster:    juha@???



/etc/exim/domainB.aliases contains:

juha:
postmaster:    juha@???


(Don't think this will work as an aliases file, but never mind about that
for now.)


Address testing:

$ exim -d -bt juha@domainA > debug 2>&1

<snipped for brevity>

Testing juha@domainA
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Considering juha@domainA
active address juha@domainA
local_part=juha domain=domainA
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

routing juha@domainA

-------> dnslookup router <--------
local_part=juha domain=domainA
checking domains
domainA in "@ : domainC : domainB : domainA"?
yes (matched "domainA")
domainA in "! +local_domains"? no (matched "! +local_domains")
cached lookup data = NULL
dnslookup router skipped: domains mismatch

[Why does it complain about domains mismatch here?]

<snip>

system_aliases router declined for juha@domainB

[correct]


--------> domainA router <--------
local_part=juha domain=domainA
checking domains
domainA in "domainA"? yes (matched "domainA")
checking local_parts
search_open: lsearch "/etc/exim/domainA.net.aliases"
search_find: file="/etc/exim/domainA.aliases"
key="juha" partial=-1
LRU list:
8/etc/exim/domainA.aliases
8/etc/aliases
End
internal_search_find: file="/etc/exim/domainA.aliases"
type=lsearch key="juha"
file lookup required for juha
in /etc/exim/domainA.aliases
lookup yielded:
juha in "lsearch;/etc/exim/domainA.aliases"? yes (matched
"lsearch;/etc/exim/domainA.aliases")
checking "condition"
search_open: lsearch "/etc/exim/domainA.aliases"
cached open
search_find: file="/etc/exim/domainA.aliases"
key="juha" partial=-1
LRU list:
8/etc/exim/domainA.aliases
8/etc/aliases
End
internal_search_find: file="/etc/exim/domainA.aliases"
type=lsearch key="juha"
cached data used for lookup of juha
in /etc/exim/domainA.aliases
lookup yielded:
calling domainA router
domainA router called for juha@domainA
domain = domainA
set transport domainA
queued for domainA transport: local_part = juha
domain = domainA
errors_to=NULL
domain_data=NULL localpart_data=
routed by domainA router
envelope to: juha@domainA
transport: domainA
search_tidyup called
>>>>>>>>>>>>>>>>>> Exim pid=10320 terminating with rc=0 >>>>>>>>>>>>>>>>>>

juha@domainA
router = domainA, transport = domainA

[Correct routing/delivery, although with some redundant searching]

[DomainB doesn't work however: ]

$ exim -d -bt juha@domainB > debug 2>&1

Testing juha@domainB
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Considering juha@domainB
active address juha@domainB
local_part=juha domain=domainB
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

routing juha@domainB
--------> dnslookup router <--------
local_part=juha domain=domainB
checking domains
domainB in "@ : domainC : domainB : domainA"? yes
(matched "domainB")
domainB in "! +local_domains"? no (matched "! +local_domains")
cached lookup data = NULL
dnslookup router skipped: domains mismatch

--------> system_aliases router <--------
system_aliases router declined for juha@domainB

--------> domainA router <--------
local_part=juha domain=domainB
checking domains
domainB in "domainA"? no (end of list)
domainA router skipped: domains mismatch
--------> domainB router <--------
local_part=juha domain=domainB
checking domains
domainB in "domainB"? yes (matched "domainB")
checking local_parts
search_open: lsearch "/etc/exim/domainB.aliases"
search_find: file="/etc/exim/domainB.aliases"
key="juha" partial=-1
LRU list:
8/etc/exim/domainB.aliases
8/etc/aliases
End
internal_search_find: file="/etc/exim/domainB.aliases"
type=lsearch key="juha"
file lookup required for juha
in /etc/exim/domainB.aliases
lookup yielded:
juha in "lsearch;/etc/exim/domainB"? yes (matched
"lsearch;/etc/exim/domainB.aliases")
checking "condition"
search_open: lsearch "/etc/exim/domainB.aliases"
cached open
search_find: file="/etc/exim/domainB.aliases"
key="juha@domainB" partial=-1
LRU list:
8/etc/exim/domainB.aliases
8/etc/aliases
End
internal_search_find: file="/etc/exim/domainB.aliases"
type=lsearch key="juha@domainB"
file lookup required for juha@domainB
in /etc/exim/domainB.aliases
lookup failed
domainB router skipped: condition failure

[Why??? The lookup succeeds for domainA!]

--------> userforward router <--------
userforward router declined for juha@domainB

--------> localuser router <--------
local_part=juha domain=domainB
checking domains
domainB in "domainC"? no (end of list)
localuser router skipped: domains mismatch
no more routers
search_tidyup called
>>>>>>>>>>>>>>>>>> Exim pid=10384 terminating with rc=2 >>>>>>>>>>>>>>>>>>

juha@domainB is undeliverable:
Unrouteable address

Arrgh...

--
Juha Saarinen