无法在 OpenDKIM 中加载密钥 权限被拒绝

Zae*_*las 7 email postfix-mta dkim server

之前运行的 Dovecot/Postfix/DKIM 设置具有多个域,可正常运行数月。

我尝试添加新域名。回顾我为原始作品所做的事情。一旦我解决了大多数问题,并且所有配置文件、密钥、文本记录等都正常工作,我就可以毫无问题地接收电子邮件,但无法在新电子邮件/域上发送电子邮件。

收到以下错误:

Mar 23 02:48:49 MainFrame-2017 opendkim[4225]: can't load key from /etc/opendkim/keys/zaehlas.com/mail.private: Permission denied
Mar 23 02:48:49 MainFrame-2017 opendkim[4225]: DF0CF5C4CC0: error loading key 'mail._domainkey.zaehlas.com'
Run Code Online (Sandbox Code Playgroud)

安装了以下版本:

Distributor ID: Ubuntu
Description:    Ubuntu 16.04.6 LTS
Release:        16.04
Codename:       xenial
root@MainFrame-2017:/etc/opendkim/keys/zaehlas.com# dpkg -s opendkim | grep '^Version:'
Version: 2.10.3-3build1
root@MainFrame-2017:/etc/opendkim/keys/zaehlas.com# dpkg -s postfix | grep '^Version:'
Version: 3.1.0-3ubuntu0.3
Run Code Online (Sandbox Code Playgroud)

我检查了权限和配置文件。完美适用于 4 个域,不适用于最后一个域。最后按照我能找到的(许多)指南上的建议重置所有权限,重新启动整个服务器,重新启动多个服务,现在我的域都不会使用 DKIM 发送电子邮件

我的 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
Run Code Online (Sandbox Code Playgroud)

opendkim 和密钥文件中的权限

root@MainFrame-2017:/etc/opendkim# ls -l
total 16
drw------- 9 opendkim opendkim 4096 Mar 23 00:31 keys
-rw-r--r-- 1 opendkim opendkim  772 Mar 23 02:10 KeyTable
-rw-r--r-- 1 opendkim opendkim  394 Mar 23 00:28 SigningTable
-rw-r--r-- 1 opendkim opendkim  286 Mar 23 02:42 TrustedHosts
root@MainFrame-2017:/etc/opendkim# namei -l /etc/opendkim/keys/zaehlas.com/mail.private
f: /etc/opendkim/keys/zaehlas.com/mail.private
drwxr-xr-x root     root     /
drwxr-xr-x root     root     etc
drwxr-xr-x opendkim opendkim opendkim
drw------- opendkim opendkim keys
drw------- opendkim opendkim zaehlas.com
-rw------- opendkim opendkim mail.private
Run Code Online (Sandbox Code Playgroud)

密钥表文件:

mail._domainkey.zaehlas.com zaehlas.com:mail:/etc/opendkim/keys/zaehlas.com/mail.private
mail._domainkey.bglancesglass.com bglancesglass.com:mail:/etc/opendkim/keys/bglancesglass.com/mail.private
mail._domainkey.millenniumlarp.com millenniumlarp.com:mail:/etc/opendkim/keys/millenniumlarp.com/mail.private
mail._domainkey.pittsburghglassclub.com pittsburghglassclub.com:mail:/etc/opendkim/keys/pittsburghglassclub.com/mail.private
mail._domainkey.pittsburghglassclub.org pittsburghglassclub.org:mail:/etc/opendkim/keys/pittsburghglassclub.org/mail.private
mail._domainkey.chataboutdg.com chataboutdg.com:mail:/etc/opendkim/keys/chataboutdg.com/mail.private
mail._domainkey.lostvalleylegacy.com lostvalleylegacy.com:mail/etc/opendkim/keys/lostvalleylegacy.com/mail.private
Run Code Online (Sandbox Code Playgroud)

DKIM 测试有效:

root@MainFrame-2017:/etc/opendkim# opendkim-testkey -d zaehlas.com -s mail -vvv
opendkim-testkey: using default configfile /etc/opendkim.conf
opendkim-testkey: checking key 'mail._domainkey.zaehlas.com'
opendkim-testkey: key not secure
opendkim-testkey: key OK
Run Code Online (Sandbox Code Playgroud)

我已经完全没有想法了。以前有用,但现在不行了,而且没有什么重要的改变。我尝试了几种不同的权限,已验证 opendkim 使用正确的组和用户名。

提前感谢您提供我错过的一些内容,或者提到一些其他指南都没有提到的内容来检查。

小智 6

我遇到了同样的问题,并通过使密钥和配置文件(KeyTable、SigningTable 等)可执行来修复它。

sudo chmod -R ug+x /etc/opendkim
Run Code Online (Sandbox Code Playgroud)


Zae*_*las 0

我备份了我的配置文件。apt-get 清除了 opendkim,重新安装了 opendkim,恢复了我的确切配置文件,并且它起作用了。

我不知道为什么。

PFM