opendkim-testkey 返回“无效数据集类型”,而如果我指定域和选择器,我得到“Key OK”

opendkim-testkey 返回“无效数据集类型”,而如果我指定域和选择器,我得到“Key OK”

我遇到了一个问题,除非我将域和选择器传递给命令,否则 opendkim testkey 会返回错误“无效数据集类型”。为什么会发生这种情况?详情如下:

没有域和选择器:

root@condor1796 /etc/opendkim # sudo -u opendkim opendkim-testkey -vvvv
opendkim-testkey: using default configfile /etc/opendkim.conf
opendkim-testkey: invalid data set type
root@condor1796 /etc/opendkim # 

指定域和选择器:

root@condor1796 /etc/opendkim # sudo -u opendkim opendkim-testkey -vvvv -d numbeo.com -s mail
opendkim-testkey: using default configfile /etc/opendkim.conf
opendkim-testkey: checking key 'mail._domainkey.numbeo.com'
opendkim-testkey: key not secure
opendkim-testkey: key OK

密钥不安全输出是,正如我在另一个线

“密钥不安全”并不表示错误。这是不使用 DNSSSEC 的预期结果。

这是我的配置文件:

root@condor1796 /etc/opendkim # cat /etc/opendkim.conf
OversignHeaders     From
TrustAnchorFile       /usr/share/dns/root.key

AutoRestart             Yes
AutoRestartRate         10/1h
UMask                   002
Syslog                  yes
SyslogSuccess           Yes
LogWhy                  Yes

Canonicalization        relaxed/simple

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

Mode                    sv
PidFile                 /var/run/opendkim/opendkim.pid
SignatureAlgorithm      rsa-sha256

UserID                  opendkim:opendkim

Socket                  inet:12301@localhost

以下是引用的文件:

root@condor1796 /etc # sudo -u opendkim cat /etc/opendkim/KeyTable
mail._domainkey.numbeo.com numbeo.com:mail:/etc/opendkim/keys/numbeo.com/mail.private
root@condor1796 /etc # sudo -u opendkim head -n 2 /etc/opendkim/keys/numbeo.com/mail.private
-----BEGIN RSA PRIVATE KEY-----
MIICXgIBAAKBgQDPqBmXSBbSXdmDIOqriDqI7/HJz1AqJNjK+Jqd0EQHEmXS5BHB
root@condor1796 /etc # sudo -u opendkim cat /etc/opendkim/SigningTable 
*@numbeo.com mail._domainkey.numbeo.com

如果我没有指定域和选择器,为什么会出现 opendkim-testkey 错误?

答案1

我已经解决了这个问题。这个帖子有帮助:

OpenDKIM 未签署邮件

opendkim.conf 必须有此行

KeyTable                /etc/opendkim/KeyTable

(无 refile:/ 前缀)

现在可行了:

root@condor1796 /etc # sudo -u opendkim opendkim-testkey -vvvv 
opendkim-testkey: using default configfile /etc/opendkim.conf
opendkim-testkey: record 0 for 'numbeo.com' retrieved
opendkim-testkey: checking key 'numbeo.com'
opendkim-testkey: key numbeo.com: OK
opendkim-testkey: key numbeo.com not secure
opendkim-testkey: 1 key checked; 1 pass, 0 fail

相关内容