Email

Exim4 Rejected RCPT: Unrouteable address when using data lookup

  • March 9, 2020

我正在嘗試將最初發送到 的電子郵件重定向hello@example.commrxxx@example.com.

我有aliases文件:

hello: mrxxx@example.com

以及以下路由器

local_router:
 driver = accept
 domains = +local_domains
 local_parts = mrxxx
 transport = local_dst
 cannot_route_message = Unknown mailbox
 no_more

aliases_router:
 driver = redirect
 data = ${lookup{$local_part}lsearch{/etc/aliases}}
 cannot_route_message = Unknown mailbox
 allow_defer
 allow_fail
 no_more

local_dst 運輸如下所示:

local_dst:
 driver = appendfile
 directory = /var/mail/$local_part/Maildir
 delivery_date_add
 envelope_to_add
 return_path_add
 maildir_format
 mode_fail_narrower = false

根據調試資訊,它應該可以正常工作:

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Testing hello@example.com
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Considering hello@example.com
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
routing hello@example.com
--------> local_router router <--------
local_part=hello domain=example.com
checking domains
example.com in "@ : example.com"? yes (matched "example.com")
example.com in "+local_domains"? yes (matched "+local_domains")
checking local_parts
hello in "mrxxx"? no (end of list)
local_router router skipped: local_parts mismatch
--------> aliases_router router <--------
local_part=hello domain=example.com
calling aliases_router router
rda_interpret (string): '${lookup{$local_part}lsearch{/etc/aliases}}'
search_open: lsearch "/etc/aliases"
search_find: file="/etc/aliases"
  key="hello" partial=-1 affix=NULL starflags=0
LRU list:
  2/etc/aliases
  End
internal_search_find: file="/etc/aliases"
  type=lsearch key="hello"
file lookup required for hello
  in /etc/aliases
lookup yielded: mrxxx@example.com
expanded: 'mrxxx@example.com'
file is not a filter file
parse_forward_list: mrxxx@example.com
extract item: mrxxx@example.com
aliases_router router generated mrxxx@example.com
 errors_to=NULL transport=NULL
 uid=unset gid=unset home=NULL
routed by aliases_router router
 envelope to: hello@example.com
 transport: <none>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Considering mrxxx@example.com
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
routing mrxxx@example.com
--------> local_router router <--------
local_part=mrxxx domain=example.com
checking domains
example.com in "@ : example.com"? yes (matched "example.com")
example.com in "+local_domains"? yes (matched "+local_domains")
checking local_parts
mrxxx in "mrxxx"? yes (matched "mrxxx")
calling local_router router
local_router router called for mrxxx@example.com
 domain = example.com
set transport local_dst
queued for local_dst transport: local_part = mrxxx
domain = example.com
 errors_to=NULL
 domain_data=NULL localpart_data=NULL
routed by local_router router
 envelope to: mrxxx@example.com
 transport: local_dst
mrxxx@example.com
   <-- hello@example.com
 router = local_router, transport = local_dst
search_tidyup called
>>>>>>>>>>>>>>>> Exim pid=16 (main) terminating with rc=0 >>>>>>>>>>>>>>>>

但是電子郵件被拒絕:

2020-03-08 21:24:20.079 [14] H=mail-oi1-f173.google.com [209.85.167.173]:43081 I=[192.168.144.7]:25 X=TLS1.3:TLS_AES_128_GCM_SHA256:128 CV=no SNI="mail.example.com" F=<jane.doe@gmail.com> rejected RCPT <hello@example.com>: Unrouteable address

有任何想法嗎?

# exim --version
Exim version 4.93 #3 built 18-Dec-2019 19:58:53
...

編輯:

在調試模式下執行exim守護程序顯示了一些不同的畫面,似乎我aliases_router的被跳過並繼續在dnslookup路由器中進行收件人驗證?

13 sender jane.doe@gmail.com verified ok
13 require: condition test succeeded in ACL "acl_check_rcpt"
13 processing "accept" (/etc/exim/exim.conf 470)
13 check hosts = +relay_from_hosts
13 host in ""? no (end of list)
13 host in "+relay_from_hosts"? no (end of list)
13 accept: condition test failed in ACL "acl_check_rcpt"
13 processing "accept" (/etc/exim/exim.conf 479)
13 check authenticated = *
13 accept: condition test failed in ACL "acl_check_rcpt"
13 processing "require" (/etc/exim/exim.conf 485)
13   message: nice hosts say HELO first
13 check condition = ${if def:sender_helo_name}
13                 = true
13 require: condition test succeeded in ACL "acl_check_rcpt"
13 processing "require" (/etc/exim/exim.conf 492)
13   message: relay not permitted
13 check domains = +local_domains : +relay_to_domains
13 cached yes match for +local_domains
13 cached lookup data = NULL
13 example.com in "+local_domains : +relay_to_domains"? yes (matched "+local_domains" - cached)
13 require: condition test succeeded in ACL "acl_check_rcpt"
13 processing "require" (/etc/exim/exim.conf 501)
13 check verify = recipient
13 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
13 Verifying hello@example.com
13 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
13 Considering hello@example.com
13 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
13 routing hello@example.com
13 --------> local_router router <--------
13 local_part=hello domain=example.com
13 checking domains
13 cached yes match for +local_domains
13 cached lookup data = NULL
13 example.com in "+local_domains"? yes (matched "+local_domains" - cached)
13 checking local_parts
13 hello in "mrxxx"? no (end of list)
13 local_router router skipped: local_parts mismatch
13 --------> aliases_router router <--------
13 local_part=hello domain=example.com
13 aliases_router router skipped: verify 2 0 0
13 --------> dnslookup router <--------
13 local_part=hello domain=example.com
13 checking domains
13 cached yes match for +local_domains
13 cached lookup data = NULL
13 example.com in "! +local_domains"? no (matched "! +local_domains" - cached)
13 dnslookup router skipped: domains mismatch
13 no more routers
13 ----------- end verify ------------
13 require: condition test failed in ACL "acl_check_rcpt"

我的正確設置aliases_router結果如下(幾乎是來自 Exim docs的複制/粘貼):

aliases_router:
 driver = redirect
 data = ${lookup{$local_part}lsearch{/etc/aliases}}
 cannot_route_message = Unknown mailbox

我不確定為什麼no_moreno_verify(如評論中所述)在這裡出現了流氓設置。allow_defer並且allow_fail似乎沒有阻止任何東西,因為它們僅用於啟用 Exim 過濾器中的某些功能。

如果您有關於no_moreno_verify設置的解釋,請發表評論或發布答案,我很樂意接受。

引用自:https://serverfault.com/questions/1006127