![Exim 未验证发送电子邮件](https://linux22.com/image/794339/Exim%20%E6%9C%AA%E9%AA%8C%E8%AF%81%E5%8F%91%E9%80%81%E7%94%B5%E5%AD%90%E9%82%AE%E4%BB%B6.png)
我已将 Exim(在 Directadmin 上)更新至版本 4.97.1。在此过程中出现了问题,现在我无法再发送电子邮件。我可以接收电子邮件(远程和使用 LMTP 与 Dovecot)。此外,我今天早上发现本地邮件也运行正常。root -> exim -> dovecot。
当使用远程电子邮件应用程序时,我得到(测试了普通电子邮件和登录电子邮件):
2024-04-15 07:51:01 plain authenticator failed for dynamic.caiway.nl ([192.168.178.2]) [xxx.xxx.xxx.xxx]: 535 Incorrect authentication data ([email protected])
2024-04-14 09:12:29 login authenticator failed for dynamic.caiway.nl ([192.168.178.2]) [xxx.xxx.xxx.xxx]: 535 Incorrect authentication data ([email protected])
使用端口 25 或端口 587 得到不同的结果。但证书没有问题:
telnet server.example.com 25
Trying xx.xx.xx.xxx...
Connected to server.example.com.
Escape character is '^]'.
220 server.example.com ESMTP Exim 4.97.1 Mon, 15 Apr 2024 08:18:19 +0200
ehlo caiway.nl
250-server.example.com Hello dynamic.caiway.nl [xxx.xxx.xxx.xxx]
250-SIZE 52428800
250-8BITMIME
250-PIPELINING
250-PIPECONNECT
250-AUTH PLAIN LOGIN
250-STARTTLS
250 HELP
它显示 STARTTLS 和 AUTH PLAIN LOGIN,所以我认为这很好。但是当通过 openssl 使用 starttls 在端口 587 上连接时,我得到:
openssl s_client -starttls smtp -connect server.example.com:587 -showcerts
CONNECTED(00000003)
仅此而已,当通过端口 25 上的 openssl 连接时,我得到:
openssl s_client -starttls smtp -connect server.example.com:25 -showcerts
CONNECTED(00000003)
depth=2 C = US, ST = New Jersey, L = Jersey City, O = The USERTRUST Network, CN = USERTrust RSA Certification Authority
verify return:1
depth=1 C = GB, ST = Greater Manchester, L = Salford, O = Sectigo Limited, CN = Sectigo RSA Domain Validation Secure Server CA
verify return:1
depth=0 CN = example.com
verify return:1
Server certificate
subject=CN = example.com
issuer=C = GB, ST = Greater Manchester, L = Salford, O = Sectigo Limited, CN = Sectigo RSA Domain Validation Secure Server CA
---
No client certificate CA names sent
Peer signing digest: SHA256
Peer signature type: RSA-PSS
Server Temp Key: X25519, 253 bits
---
SSL handshake has read 6202 bytes and written 434 bytes
Verification: OK
---
New, TLSv1.3, Cipher is TLS_AES_256_GCM_SHA384
Server public key is 4096 bit
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)
---
250 HELP
另外,使用 telnet 时端口 587 上的 EHLO 也会断开连接:
telnet server.example.com 587
Trying xx.xx.xx.xxx...
Connected to server.example.com.
Escape character is '^]'.
ehlo caiway.nl
Connection closed by foreign host.
上述测试的一些日志如下:
2024-04-15 08:19:18 TLS error on connection from dynamic.caiway.nl [xxx.xxx.xxx.xxx] (SSL_accept): (TLSv1.3)
2024-04-15 08:20:21 TLS error (SSL_read): on connection from dynamic.caiway.nl [xxx.xxx.xxx.xxx] error:0A000126:SSL routines::unexpected eof while reading
2024-04-15 08:21:07 TLS error on connection from dynamic.caiway.nl [xxx.xxx.xxx.xxx] (SSL_accept): error:0A000126:SSL routines::unexpected eof while reading
我有点迷茫,一开始我以为是证书问题。但使用 -showcerts 在端口 25 上运行 openssl 显示所有证书都没问题。Exim 正在宣传 AUTH 和 STARTTLS。但通过端口 587 连接时就断开了。
我的 Exim 配置显示了所有正确的值(我相信):
auth_advertise_hosts = ${if or { {eq {$received_port}{465}} {eq {$received_port}{587}} } {*}{}}
auth_advertise_hosts = ${if eq{$tls_cipher}{}{}{*}}
daemon_smtp_ports=25:587:465
tls_on_connect_ports=587:465
编辑----附加信息:从在调试模式下运行 exim 并输出,当我从邮件客户端连接发送电子邮件时,我得到此信息。
19:38:10 111203 login authenticator server_condition:
19:38:10 111203 $auth1 = [email protected]
19:38:10 111203 $auth2 = password
19:38:10 111203 $1 = [email protected]
19:38:10 111203 $2 = password
19:38:10 111203 ╭considering: ${perl{smtpauth}{0}}
19:38:10 111203 ╭considering: smtpauth}{0}}
19:38:10 111203 ├───────text: smtpauth
19:38:10 111203 ├considering: }{0}}
19:38:10 111203 ├──expanding: smtpauth
19:38:10 111203 ╰─────result: smtpauth
19:38:10 111203 ╭considering: 0}}
19:38:10 111203 ├───────text: 0
19:38:10 111203 ├considering: }}
19:38:10 111203 ├──expanding: 0
19:38:10 111203 ╰─────result: 0
19:38:10 111203 Starting Perl interpreter
19:38:10 111203 ├──expanding: ${perl{smtpauth}{0}}
19:38:10 111203 ╰─────result: 0
19:38:10 111203 expanded string: 0
19:38:10 111203 ╭considering: $1
19:38:10 111203 ├──────value: [email protected]
19:38:10 111203 ╰──(tainted)
19:38:10 111203 ├──expanding: $1
19:38:10 111203 ╰─────result: [email protected]
19:38:10 111203 ╰──(tainted)
19:38:10 111203 SMTP>> 535 Incorrect authentication data
这里仍然没有真实世界的信息。
有什么建议吗?我有点迷茫,不知道从哪里开始/看哪里。
答案1
好的,我找到了问题。
显然,配置的登录和普通身份验证方法不再起作用。
我在身份验证器的调试输出中看到 dovecot。这让我思考,然后我找到了这篇文章: Exim 和 Dovecot SASL
改变这一点,它就能完美地运行。