OpenDKIM 不签署邮件

ana*_*10n 9 postfix opendkim debian-jessie

所以我在让 OpenDKIM 对我的消息进行签名时遇到了麻烦,但我对可能导致它的原因感到困惑:

在 Debian Jessie 上,使用 Postfix 和 OpenDKIM。

我的/etc/opendkim.conf

Syslog                  yes
SyslogSuccess           Yes
LogWhy yes
UMask                   002
Canonicalization        relaxed/simple
Mode                    sv
SubDomains              no
#ADSPAction             continue
AutoRestart             Yes
AutoRestartRate         10/1h
Background              yes
DNSTimeout              5
SignatureAlgorithm      rsa-sha256
UserID                  opendkim:opendkim
Socket                  inet:12301@localhost
KeyTable        refile:/etc/opendkim/KeyTable
SigningTable    refile:/etc/opendkim/SigningTable
ExternalIgnoreList      refile:/etc/opendkim/TrustedHosts
InternalHosts   refile:/etc/opendkim/TrustedHosts
Run Code Online (Sandbox Code Playgroud)

我的/etc/opendkim/KeyTable

default._domainkey.example.com example.com:default:/etc/opendkim/keys/example.com/default.private
Run Code Online (Sandbox Code Playgroud)

我的/etc/opendkim/SigningTable

example.com default._domainkey.example.com
Run Code Online (Sandbox Code Playgroud)

在 SigningTable 上尝试了以下变体,但禁用了我的 SMTP:

*@example.com default._domainkey.example.com
Run Code Online (Sandbox Code Playgroud)

在 my 中取消注释以下行/etc/default/opendkim

SOCKET="inet:12345@localhost
Run Code Online (Sandbox Code Playgroud)

在我的中有以下内容/etc/postfix/main/cf

# DKIM
milter_default_action = accept
milter_protocol = 6
smtpd_milters = inet:localhost:12345
non_smtpd_milters = inet:localhost:12345
Run Code Online (Sandbox Code Playgroud)

这是什么opendkim-testkey -d example.com -s default -vvv返回:

opendkim-testkey: using default configfile /etc/opendkim.conf
opendkim-testkey: checking key 'default._domainkey.example.com'
opendkim-testkey: key not secure
opendkim-testkey: key OK
Run Code Online (Sandbox Code Playgroud)

我的日志中似乎没有与 opendkim 相关的任何错误,但是当我尝试验证签名时,mail-tester.com 报告没有 DKIM 签名,check-auth@verifier.port25.com 返回 DKIM 检查:none。

任何帮助查明我所缺少的东西都将不胜感激。谢谢。

Ger*_*der 7

我看到的问题:

  • 您使用refile
    来自文档

    如果字符串以“refile:”开头,则假定字符串的其余部分指定包含一组模式(每行一个)及其关联值的文件。该模式被视为第一个空格的行开头,该空格之后的部分被视为匹配该模式时要使用的值。模式是简单的通配符模式,匹配除星号 ("*") 字符被视为通配符之外的所有文本。如果一个值包含多个条目,则条目应以冒号分隔。

    KeyTable 不遵循该模式,因此它不需要refile关键字。也许它不痛,我不知道。我没有在我的配置中使用它,它对我有用。

    KeyTable        /etc/opendkim/KeyTable
    SigningTable    refile:/etc/opendkim/SigningTable
    
    Run Code Online (Sandbox Code Playgroud)
  • 你的密钥表

    这些行应该以域开头,而不是以 domainkey 记录开头:

    example.com example.com:default:/etc/opendkim/keys/example.com/default.private
    
    Run Code Online (Sandbox Code Playgroud)
  • 签名表

    签名表应将电子邮件地址映射到域。它应该是这样的:

    *@example.com example.com
    
    Run Code Online (Sandbox Code Playgroud)

    这里refile需要关键字。

我不知道ExternalIgnoreListand InternalHosts,因为我不使用它们。其余的配置对我来说看起来不错。

  • 我认为您的 KeyTable/Signingtable 评论不正确;该行以键名称开头,在您的例子中现在是“example.com”。指定的名称“default._domainkey.example.com”是完全合理的。然后 SigningTable 将电子邮件地址映射到键名,而不是域。 (2认同)