大网数据广告活动
服务器运维问答

Exim4 Rejected RCPT: Unrouteable address when using data lookup

· 52CE 我爱测

I'm trying to redirect emails originally sent to [email omitted] , to the [email omitted] . I have aliases file: hello: [email omitted] And the following routers : local_router: driver = accept domains = +local_domains local_part…

问题原文

原帖链接 · NarūnasK · CC BY-SA 4.0

I'm trying to redirect emails originally sent to [email omitted], to the [email omitted].

I have aliases file:

hello: [email omitted]

And the following routers:

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 transport looks like the following:

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

According to the debug info it all should work just fine:

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Testing [email omitted]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Considering [email omitted]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
routing [email omitted]
--------> 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: [email omitted]
expanded: '[email omitted]'
file is not a filter file
parse_forward_list: [email omitted]
extract item: [email omitted]
aliases_router router generated [email omitted]
  errors_to=NULL transport=NULL
  uid=unset gid=unset home=NULL
routed by aliases_router router
  envelope to: [email omitted]
  transport: <none>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Considering [email omitted]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
routing [email omitted]
--------> 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 [email omitted]
  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: [email omitted]
  transport: local_dst
[email omitted]
    <-- [email omitted]
  router = local_router, transport = local_dst
search_tidyup called
>>>>>>>>>>>>>>>> Exim pid=16 (main) terminating with rc=0 >>>>>>>>>>>>>>>>

However emails get rejected:

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=<[email omitted]> rejected RCPT <[email omitted]>: Unrouteable address

Any ideas?

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

EDIT:

Running exim daemon in the debug mode revealed a bit different picture, it seems that my aliases_router is skipped and it continues recipient verification in the dnslookup router??

13 sender [email omitted] 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 [email omitted]
13 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
13 Considering [email omitted]
13 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
13 routing [email omitted]
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"

已采纳解答

原帖链接 · NarūnasK · CC BY-SA 4.0

The correct setup in my aliases_router turned out the following (pretty much a copy/paste from the Exim docs):

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

I'm not sure why no_more and no_verify (as mentioned in the comments) turned out the rogue settings in here. allow_defer and allow_fail doesn't seem to block anything, as these are only used to enable some features in Exim's filters.

If you have an explanation regarding no_more and no_verify settings, please leave a comment or post an answer and I'll happily accept it.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-03-08)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。