Exim 表示 DNS 查找成功,但还表示“主机查找未完成”

Exim 表示 DNS 查找成功,但还表示“主机查找未完成”

我正在尝试向我网站的用户发送自动通知电子邮件。这些电子邮件由自定义守护进程通过 exim 4 发送给用户。Exim 的作用只是将邮件转发到与收件人地址关联的邮件服务器。所有外发电子邮件都必须转发。没有本地电子邮件,也没有传入邮件。

但是,当我尝试发送电子邮件时,我的守护进程总是收到以下响应:

com.sun.mail.smtp.SMTPAddressFailedException: 451 Temporary local problem - please try later

/var/log/exim4/mainlog,我有以下几行

2014-09-09 22:30:50 no host name found for IP address 10.0.2.2
2014-09-09 22:30:50 H=(lotp-lanbox) [10.0.2.2] F=<[email protected]> temporarily rejected RCPT <[email protected]>: host lookup did not complete

(请注意,10.0.2.2 是安装发送方守护程序的主机的 IP 地址。)

该消息很奇怪,但缺乏详细信息。这是我启动的另一个调试命令:

user@host:~$ exim4 -bt -d-resolver [email protected]
Exim version 4.82 uid=0 gid=0 pid=14035 D=fbb95cfd
Berkeley DB: Berkeley DB 5.3.28: (September  9, 2013)
Support for: crypteq iconv() IPv6 GnuTLS move_frozen_messages DKIM
Lookups (built-in): lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmjz dbmnz dnsdb dsearch nis nis0 passwd
Authenticators: cram_md5 plaintext
Routers: accept dnslookup ipliteral manualroute queryprogram redirect
Transports: appendfile/maildir/mailstore autoreply lmtp pipe smtp
Fixed never_users: 0
Size of off_t: 8
Compiler: GCC [4.8.2]
Library version: GnuTLS: Compile: 2.12.23
                         Runtime: 2.12.23
Library version: PCRE: Compile: 8.31
                       Runtime: 8.31 2012-07-06
Total 13 lookups
WHITELIST_D_MACROS: "OUTGOING"
TRUSTED_CONFIG_LIST: "/etc/exim4/trusted_configs"
changed uid/gid: forcing real = effective
  uid=0 gid=0 pid=14035
  auxiliary group list: <none>
seeking password data for user "uucp": cache not available
getpwnam() succeeded uid=10 gid=10
changed uid/gid: calling tls_validate_require_cipher
  uid=109 gid=116 pid=14036
  auxiliary group list: <none>
tls_validate_require_cipher child 14036 ended: status=0x0
configuration file is /var/lib/exim4/config.autogenerated
log selectors = 00000ffc 00632001
trusted user
admin user
seeking password data for user "mail": cache not available
getpwnam() succeeded uid=8 gid=8
user name "root" extracted from gecos field "root"
originator: uid=0 gid=0 login=root name=root
sender address = root@dev
Address testing: uid=0 gid=116 euid=0 egid=116
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Testing [email protected]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Considering [email protected]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
routing [email protected]
--------> hubbed_hosts router <--------
local_part=foobar domain=romandie.com
checking domains
expansion of "${if exists{/etc/exim4/hubbed_hosts}{partial-lsearch;/etc/exim4/hubbed_hosts}fail}" forced failure: assume not in this list
hubbed_hosts router skipped: domains mismatch
--------> dnslookup_relay_to_domains router <--------
local_part=foobar domain=romandie.com
checking domains
romandie.com in "@:localhost"? no (end of list)
romandie.com in "*"? yes (matched "*")
romandie.com in "! +local_domains : +relay_to_domains"? yes (matched "+relay_to_domains")
R: dnslookup_relay_to_domains for [email protected]
calling dnslookup_relay_to_domains router
dnslookup_relay_to_domains router called for [email protected]
  domain = romandie.com
DNS lookup of romandie.com (MX) succeeded
dnslookup_relay_to_domains router: defer for [email protected]
  message: host lookup did not complete
[email protected] cannot be resolved at this time: host lookup did not complete
search_tidyup called
>>>>>>>>>>>>>>>> Exim pid=14035 terminating with rc=1 >>>>>>>>>>>>>>>>

这是对我来说特别奇怪的摘录(从该输出的末尾):

dnslookup_relay_to_domains router called for [email protected]
  domain = romandie.com
DNS lookup of romandie.com (MX) succeeded
dnslookup_relay_to_domains router: defer for [email protected]
  message: host lookup did not complete
[email protected] cannot be resolved at this time: host lookup did not complete

DNS 查找怎么可能既成功又不完成?我做错了什么?

我尝试使用dig安装了 exim4 的机器进行 DNS 查找,结果看起来不错:

user@host:~$ dig mx romandie.com
;; Warning: Message parser reports malformed message packet.

; <<>> DiG 9.9.5-3-Ubuntu <<>> mx romandie.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36151
;; flags: qr aa rd ra ad; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: Message has 1 extra bytes at end

;; QUESTION SECTION:
;romandie.com.                  IN      MX

;; ANSWER SECTION:
romandie.com.           3600    IN      A       37.35.105.169
romandie.com.           3600    IN      A       37.35.105.166

;; Query time: 19 msec
;; SERVER: 10.0.2.3#53(10.0.2.3)
;; WHEN: Tue Sep 09 23:14:45 UTC 2014
;; MSG SIZE  rcvd: 63

查找本身看上去不错。

为什么进出口银行一边说自己成功,一边又说自己失败了呢?

答案1

您使用的递归 DNS 解析器( 上的那个10.0.2.3)严重损坏。在您的 dig 命令中,您要求它提供MX记录。但它却发送了一个包含两个记录的答案A。这甚至不是因为该域没有记录MX。我刚刚检查过,MX该域上确实有记录。此外,它dig警告您回复数据包格式不正确WARNING: Message has 1 extra bytes at end

我建议你停止使用那个有问题的 DNS 服务器。尝试将另一个 DNS 解析器放入/etc/resolv.conf。我使用 的经验很好8.8.8.8

答案2

DNS MX 记录必须指向名称,而不是 IP 地址。看来您可能需要 allow_mx_to_ip 选项作为解决方法。

答案3

你有两个具体问题,我将逐一回答:

  1. 讯息未找到 IP 地址 10.0.2.2 的主机名仅仅意味着当主机 10.0.2.2 连接到 exim 服务器上的端口 25 时,exim 对该 IP 地址进行了 rDNS 查找,并且 DNS 以 NXDOMAIN 响应(实际上答案意味着 NXDOMAIN)。这与 Exim 是否接受该消息无关。

  2. 讯息451 临时本地问题Exim 是否告诉您,它配置为在通过它发送电子邮件时执行一些操作,而其中一项操作失败了。您在该域中没有 MX 记录,因此您依赖于所谓的 A 记录回退,根据 RFC 的规定,这是可以的,但这样做是不明智的。最后,Exim 服务器确定该域无法访问。检查您的网络是否设置正确,您是否确实可以访问它提供的 IP 地址。

我可能弄错了,但我认为“DNS 查找成功”消息并不意味着它获得了它所要求的记录。它仅仅意味着 Exim 询问并得到了一个不是拒绝的响应。之后的一行是 Exim 实际分析响应时,由于某种原因确定它没有得到它想要的答案。

相关内容