大网数据广告活动
服务器运维问答

Why is exim not adding the DKIM header to emails?

· 52CE 我爱测

My emails used to be getting signed with DKIM in the header. Now if you check the email source it is not signing. Whatis wrong? How can I debug, what logs can I look at? cat /etc/exim4/conf.d/main/00_local_macros Returns: DKIM_CA…

问题原文

原帖链接 · tread · CC BY-SA 3.0

My emails used to be getting signed with DKIM in the header. Now if you check the email source it is not signing.

Whatis wrong? How can I debug, what logs can I look at?

cat /etc/exim4/conf.d/main/00_local_macros 

Returns:

DKIM_CANON = relaxed
DKIM_SELECTOR = mail
DKIM_DOMAIN = ${sg{${lc:${domain:$h_from:}}}{^www\.}{}}
DKIM_FILE = /etc/exim4/keys/${dkim_domain}/mail.private
DKIM_PRIVATE_KEY = ${if exists{DKIM_FILE}{DKIM_FILE}{0}}

The location of the keys:

ls -la /etc/exim4/keys/example.co.za/

Returns:

-rwxr-x--- 1 Debian-exim Debian-exim  887 Mar  7 17:26 mail.private
-rwxr-x--- 1 Debian-exim Debian-exim  305 Mar  7 17:26 mail.txt

已采纳解答

原帖链接 · BillThor · CC BY-SA 3.0

Check your mainlog to verify which transport is delivering your mail (T= lines). The only standard transport that signs email is remote_smtp. If mail, is being delivered by a different transport, it won't be signed.

EDIT: I believe this maybe where your problem is as ${dkim_domain} likely doesn't contain the value of DKIM_DOMAIN :

DKIM_DOMAIN = ${sg{${lc:${domain:$h_from:}}}{^www\.}{}}
DKIM_FILE = /etc/exim4/keys/${dkim_domain}/mail.private

Try:

DKIM_DOMAIN = ${sg{${lc:${domain:$h_from:}}}{^www\.}{}}
DKIM_FILE = /etc/exim4/keys/{DKIM_DOMAIN}/mail.private

Although I would recommend not sending from www domains so you could define DKIM_DOMAIN as follows. You could use domain rewriting to remove the www portion of the domain, although I would try to avoid getting it there in the first place.

DKIM_DOMAIN = ${lc:${domain:$h_from:}}

I prefer to use a split configuration, although the single file configuration works if you only have simple modifications. Any changes I make are new files, with new names. I have a couple of modified versions of Exim provided configuration files modified to my needs. This method retains my changes when an Exim upgrade includes configuration changes. In either case, consider using a revision control system to track your changes.

The user id running exim needs to be able to read the key files, and all directories leading to the files. However, it should not be able to write or replace the keys. If you have keys in dedicated directory you can protect it by change the mode to 750, changing the owner to root and the group to Debian-exim or whatever group Exim runs as. Protect the keys likewise, but set the mode to 440 or 640.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-04-21)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。