Opendkim 和 Postfix:并非所有外发邮件都经过验证

Opendkim 和 Postfix:并非所有外发邮件都经过验证

我配置了一个仅发送的 postfix 服务器来发送邮件,但不监听来自外界的传入连接。我正在运行 Grafana 实例,postfix 的存在只是为了让 Grafana 可以发送密码提醒等。为了确保这些邮件不会被困在用户的垃圾邮件文件夹中,我设置了 SPF 和 DKIM。

使用以下命令与本地非 root 用户发送邮件会发送正确签名的邮件:

echo "This is the body of the email" | mail -s "This is the subject line" [email protected]

但是当 Grafana 发送邮件时,它没有被签名,我想知道为什么。日志中没有任何错误:

Apr 13 21:09:12 monitoring postfix/pickup[14383]: 64492408BBD8: uid=1000 from=<myuser>
Apr 13 21:09:12 monitoring postfix/cleanup[14540]: 64492408BBD8: message-id=<[email protected]>
Apr 13 21:09:12 monitoring opendkim[5416]: 64492408BBD8: DKIM-Signature field added (s=key1, d=example.com)
Apr 13 21:09:12 monitoring postfix/qmgr[5518]: 64492408BBD8: from=<[email protected]>, size=574, nrcpt=1 (queue active)
Apr 13 21:09:14 monitoring postfix/smtp[14543]: 64492408BBD8: to=<[email protected]>, relay=gmail-smtp-in.l.google.com[74.125.133.26]:25, delay=2.1, delays=0.03/0.02/1.5/0.57, dsn=2.0.0, status=sent (250 2.0.0 OK 1492110554 w75si32240747wrc.239 - gsmtp)
Apr 13 21:09:14 monitoring postfix/qmgr[5518]: 64492408BBD8: removed

看起来不错。但这是 Grafana 发送邮件的部分:

Apr 13 21:10:24 monitoring postfix/smtpd[14549]: connect from localhost[::1]
Apr 13 21:10:24 monitoring postfix/smtpd[14549]: A5975408BBD8: client=localhost[::1]
Apr 13 21:10:24 monitoring postfix/cleanup[14540]: A5975408BBD8: message-id=<[email protected]>
Apr 13 21:10:24 monitoring postfix/smtpd[14549]: disconnect from localhost[::1]
Apr 13 21:10:24 monitoring postfix/qmgr[5518]: A5975408BBD8: from=<[email protected]>, size=20682, nrcpt=1 (queue active)
Apr 13 21:10:25 monitoring postfix/smtp[14543]: A5975408BBD8: to=<[email protected]>, relay=gmail-smtp-in.l.google.com[2a00:1450:400c:c07::1b]:25, delay=0.44, delays=0/0/0.15/0.28, dsn=2.0.0, status=sent (250 2.0.0 OK 1492110625 c19si37462413wre.200 - gsmtp)
Apr 13 21:10:25 monitoring postfix/qmgr[5518]: A5975408BBD8: removed

有任何想法吗?

答案1

您是否已检查是否正确配置了 TrustedHosts 文件?您的 opendkim.conf 文件中应该包含以下内容:

ExternalIgnoreList      refile:/etc/opendkim/TrustedHosts
InternalHosts           refile:/etc/opendkim/TrustedHosts

并且在此文件中,您应该允许主机发送和签名(就您而言,似乎您正在使用 localhost IPV6)

127.0.0.1
::1

如果连接ip不被允许,则进程不会签名

相关内容