Postfix:建立了不受信任的 TLS 连接 - 如何解决此错误?

Gil*_*tes 5 debian postfix

Postfix与 Lets Encrypt 结合使用来传输 TLS 加密的电子邮件。

以下参数/etc/postfix/main.cf是相关的:

smtp_tls_key_file = /etc/letsencrypt/live/foo.bar/privkey.pem
smtp_tls_cert_file = /etc/letsencrypt/live/foo.bar/fullchain.pem
smtp_tls_CAfile = /etc/letsencrypt/live/foo.bar/fullchain.pem
Run Code Online (Sandbox Code Playgroud)

我可以毫无问题地发送电子邮件,但收到警告消息,指出 Postfix 无法验证接收站点的证书:

postfix/smtp[10736]: Untrusted TLS connection established to example.com[xxx.xxx.xxx.xxx]:25: TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)
Run Code Online (Sandbox Code Playgroud)

我怀疑这是因为 Postfix 无法使用此参数访问其证书存储:

smtp_tls_CAfile = /etc/letsencrypt/live/foo.bar/fullchain.pem
Run Code Online (Sandbox Code Playgroud)

更改smtp_tls_CAfile = /etc/ssl/certs将破坏我的整个 TLS 配置。

我需要配置什么才能使 Postfix 能够通过 Lets Encrypt 发送加密消息并检查接收方的证书?

Gil*_*tes 12

解决了。该问题是我的系统上缺少CA 证书。因此 Postfix 无法验证客户端的发行者。

通过安装解决

sudo apt install ca-certificates -y
Run Code Online (Sandbox Code Playgroud)

然后将 Postfix 指向新安装的 CA 证书:

sudo postconf -e 'smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt'
sudo postfix reload
Run Code Online (Sandbox Code Playgroud)

结果:

tail -f /var/log/mail.log
postfix/smtp[11023]: Trusted TLS connection established to ...
Run Code Online (Sandbox Code Playgroud)