邮箱服务使用DKIM签名,但OpenDKIM无法启动,如何解决?

邮箱服务已经可以正常使用,不过还缺dkim签名的部分,参考了以下文章进行安装。
https://blog.csdn.net/yetugeng/article/details/83996397

不过opendkim始终没有启动,导致发信时并未进行签名。
在mail.log中显示会产生相关报错

Aug  8 14:27:19 saikano postfix/smtpd[105588]: warning: connect to Milter service inet:127.0.0.1:8891: Connection refused

查看opendkim的运行状况则是

[root@saikano ~]# sudo service opendkim status
Redirecting to /bin/systemctl status opendkim.service
× opendkim.service - DomainKeys Identified Mail (DKIM) Milter
     Loaded: loaded (/usr/lib/systemd/system/opendkim.service; enabled; preset: disabled)
     Active: failed (Result: exit-code) since Tue 2023-08-08 15:29:23 CST; 1s ago
   Duration: 15ms
       Docs: man:opendkim(8)
             man:opendkim.conf(5)
             man:opendkim-genkey(8)
             man:opendkim-genzone(8)
             man:opendkim-testadsp(8)
             man:opendkim-testkey
             http://www.opendkim.org/docs.html
    Process: 108304 ExecStart=/usr/sbin/opendkim -f $OPTIONS (code=exited, status=78)
   Main PID: 108304 (code=exited, status=78)
        CPU: 11ms

Aug 08 15:29:23 saikano.top systemd[1]: opendkim.service: Main process exited, code=exited, status=78/CONFIG
Aug 08 15:29:23 saikano.top systemd[1]: opendkim.service: Failed with result 'exit-code'.
Aug 08 15:29:23 saikano.top systemd[1]: opendkim.service: Scheduled restart job, restart counter is at 5.
Aug 08 15:29:23 saikano.top systemd[1]: Stopped DomainKeys Identified Mail (DKIM) Milter.
Aug 08 15:29:23 saikano.top systemd[1]: opendkim.service: Start request repeated too quickly.
Aug 08 15:29:23 saikano.top systemd[1]: opendkim.service: Failed with result 'exit-code'.
Aug 08 15:29:23 saikano.top systemd[1]: Failed to start DomainKeys Identified Mail (DKIM) Milter.

看运行状态的话一开始没有注意,它这边显示的是"saikano.top"这是我博客的域名,而我的邮箱服务并没有用这个域名,这两个都架设在同一个服务器,不知是否与该问题有关。

我也检查过一些地方,配置是否有写错,是否有权限问题,尽量检查修改了。

image.png

各位大神是否有办法呢!如果网络上有这方面的讲解或者这个问题的其他解法,请麻烦告诉我也可以节省时间重复回答。辛苦了!


重新试了两次依然存在问题,第一次依旧参考原本的指南。第二次一切从简,并去除所有注释,先能跑通再说,参考 https://tm.root-n.com/tec:opendkim:setup

/etc/opendkim/opendkim.conf

Mode                    sv
Socket                  inet:8891@localhost
KeyTable                /etc/opendkim/KeyTable
SigningTable            refile:/etc/opendkim/SigningTable
ExternalIgnoreList      refile:/etc/opendkim/TrustedHosts
InternalHosts           refile:/etc/opendkim/TrustedHosts

/etc/opendkim/KeyTable

default._domainkey.###.com ###.com:default:/etc/opendkim/keys/###.com/default.private

/etc/opendkim/SigningTable

*@###.com default._domainkey.###.com

/etc/opendkim/TrustedHosts

127.0.0.1
::1

找到了类似问题,同样报错为配置错误。
https://forum.virtualmin.com/t/dkim-setup-failed/117124/2

opendkim.service: Main process exited, code=exited, status=78/CONFIG

有回答建议使用 journalctl -u opendkim.service 查看原因,但是结果我很惊讶,文件不存在。

Aug 08 13:55:41 saikano.top systemd[1]: opendkim.service: Failed with result 'exit-code'.
Aug 08 13:55:41 saikano.top systemd[1]: opendkim.service: Scheduled restart job, restart counter is at 3.
Aug 08 13:55:41 saikano.top systemd[1]: Stopped DomainKeys Identified Mail (DKIM) Milter.
Aug 08 13:55:41 saikano.top systemd[1]: Started DomainKeys Identified Mail (DKIM) Milter.
Aug 08 13:55:41 saikano.top opendkim[103885]: /etc/opendkim/keys/default.private: open(): No such file or directory
Aug 08 13:55:41 saikano.top opendkim[103885]: opendkim: /etc/opendkim.conf: /etc/opendkim/keys/default.private: open(): No such file or directory
Aug 08 13:55:41 saikano.top systemd[1]: opendkim.service: Main process exited, code=exited, status=78/CONFIG

原先/etc/opendkim/KeyTable的配置是以下这样,按理来说不应该这样。

default._domainkey.###.com ###.com:default:/etc/opendkim/keys/###.com/default.private

后来修改为以下这样,并把秘钥放到/etc/opendkim/keys/default.private依旧不行。

default._domainkey.###.com ###.com:default:/etc/opendkim/keys/default.private
阅读 3.2k
1 个回答
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏