Exim 将 SMTP 认证邮件的域名加倍

Exim 将 SMTP 认证邮件的域名加倍

我正在设置一个 Exim 4.87 邮件服务器,其中虚拟域存储在 MySQL 数据库中。该机器的主机名为athena.example.com(example.com 当然是虚构的)。我希望能够发送[电子邮件保护]

本地交付到这些虚拟用户是可行的,所以我知道表格被正确读取。我将其添加到我的 /etc/exim/config 中:

domainlist local_domains = @:localhost:${lookup mysql{SELECT domain FROM domains WHERE type='local' AND domain='${quote_mysql:${domain}}'}} 

..正如在许多例子中所见。

+------------+-----------------------+------+-----+---------+-------+
| Field      | Type                  | Null | Key | Default | Extra |
+------------+-----------------------+------+-----+---------+-------+
| domain     | char(128)             | NO   | MUL |         |       |
| type       | enum('local','relay') | NO   |     | local   |       |
| relay_host | char(128)             | NO   |     |         |       |
+------------+-----------------------+------+-----+---------+-------+

现在,当向远程主机发送邮件时,会发生一些奇怪的事情:

$ /usr/lib/sendmail [email protected]
Subject: Test 1

foo
.

日志:

2016-08-21 00:56:41 1bbFBm-0005ZL-0D <= [email protected] U=jeroen P=local S=382
2016-08-21 00:56:43 1bbFBm-0005ZL-0D => [email protected] R=dnslookup T=remote_smtp H=mx3.xs4all.nl [194.109.24.134] X=TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256 CV=yes C="250 2.0.0 mxdrop302.xs4all.net accepted message u7KMuf8f017179"
2016-08-21 00:56:43 1bbFBm-0005ZL-0D Completed

[email protected]正如预期的那样,这将通过 From: 来传递。

$ /usr/lib/sendmail [email protected]
Subject: Test 2
From: [email protected]

foo
.

日志(与第一个类似)

2016-08-21 00:57:32 1bbFCT-0005ZT-O5 <= [email protected] U=jeroen P=local S=427 
2016-08-21 00:57:35 1bbFCT-0005ZT-O5 => [email protected] R=dnslookup T=remote_smtp H=mx1.xs4all.nl [194.109.24.132] X=TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256 CV=yes C="250 2.0.0 mxdrop301.xs4all.net accepted message u7KMvW6N012011" 
2016-08-21 00:57:35 1bbFCT-0005ZT-O5 Completed

这是通过 From: of 传递的[email protected],没有“athena”部分。到目前为止一切顺利。

现在,当我尝试使用经过身份验证的 SMTP 发送邮件时,FQDN 会添加到邮件中!最终结果是

"[email protected]"@athena.example.com

当然会被拒绝。引号也会被添加(是的,它在我的邮件客户端中设置正确)。

日志:

2016-08-21 00:38:27 1bbEuJ-0005Yb-S0 <= "[email protected]"@athena.example.com H=([IPv6:2001:xx:yy:zz]) [2001:xx:yy:zz] P=esmtpsa X=TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128 CV=no A=plain:[email protected] S=2822 [email protected]
2016-08-21 00:38:29 1bbEuJ-0005Yb-S0 ** [email protected] R=dnslookup T=remote_smtp H=mx2.xs4all.nl [194.109.24.138] X=TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256 CV=yes: SMTP error from remote mail server after RCPT TO:<[email protected]>: 554 5.7.1 invalid routing in sender address <"[email protected]"@athena.example.com>
2016-08-21 00:38:29 1bbEuL-0005Yi-HO <= <> R=1bbEuJ-0005Yb-S0 U=exim P=local S=4489
2016-08-21 00:38:29 1bbEuJ-0005Yb-S0 Completed
2016-08-21 00:38:29 1bbEuL-0005Yi-HO ** [email protected]@athena.example.com <"[email protected]"@athena.example.com>: Unrouteable address
2016-08-21 00:38:29 1bbEuL-0005Yi-HO Frozen (delivery error message)

所以此刻我陷入了困境...知道可能出了什么问题吗?

答案1

好吧...它藏在谷歌的某个角落,但有人遇到了同样的问题:

电子邮件地址已附加主要主机。

事实证明,需要将一个选项添加到其中一个 ACL 中(/域=部分)

accept  hosts         = +relay_from_hosts
      control       = submission/domain=
      control       = dkim_disable_verify

accept  authenticated = *
      control       = submission/domain=
      control       = dkim_disable_verify

虽然我怀疑第一个“接受”部分是否需要它,但它可能不会有什么坏处......

答案2

看来您有一个重写规则,它将域附加到整个地址而不是本地部分。尝试从命令行测试您的重写:

exim -brw [email protected]

查看地址重写Exim 规范的章节作为指导。

相关内容