主页 > 建站 > postfix添加DKIM和dmarc

postfix添加DKIM和dmarc

2015年4月18日 postfix添加DKIM和dmarc无评论 阅读: 10,447 次

spf主要在dns服务器上进行配置,这里主要讲现有的postfix系统如何添加DKIM

安装

yum install opendkim

修改opendkim 配置文件/etc/opendkim.conf:
AutoRestart Yes
AutoRestartRate 10/1h
LogWhy Yes
Syslog Yes
SyslogSuccess Yes
Mode sv
Canonicalization relaxed/simple
ExternalIgnoreList refile:/etc/opendkim/TrustedHosts
InternalHosts refile:/etc/opendkim/TrustedHosts
KeyTable refile:/etc/opendkim/KeyTable
SigningTable refile:/etc/opendkim/SigningTable
SignatureAlgorithm rsa-sha256
Socket inet:8891@localhost
PidFile /var/run/opendkim/opendkim.pid
UMask 022
UserID opendkim:opendkim
TemporaryDirectory /var/tmp

 

创建密钥(将下述iytc.net改成你的域名)
mkdir /etc/opendkim/keys/iytc.net
opendkim-genkey -D /etc/opendkim/keys/iytc.net/ -d iytc.net -s default

chown -R opendkim: /etc/opendkim/keys/iytc.net

如下语句添加到 /etc/opendkim/KeyTable 中
default._domainkey.iytc.net iytc.net:default:/etc/opendkim/keys/iytc.net/default.private

添加 /etc/opendkim/SigningTable
*@iytc.net default._domainkey.iytc.net

到 /etc/opendkim/keys/iytc.net/default.txt 可以找到你的 key ,将default._domainkey修改为default._domainkey.iytc.net

在dns服务器上添加txt记录
host为default._domainkey ,txt记录内容就是 default.txt 里面从 v=DKIM1 开始的内容。

添加dmarc,在dns服务器上添加txt记录

host为_dmarc ,txt记录内容:v=DMARC1; p=none

 

打开 Postfix 的 main.cf 配置文件,到达底部,添加如下内容

smtpd_milters = inet:127.0.0.1:8891
non_smtpd_milters = inet:127.0.0.1:8891
milter_protocol = 2
milter_default_action = accept

启动DKIM

service opendkim start
#正常返回应为 Starting OpenDKIM Milter: [ OK ]

重启postfix
postfix reload
如果没有错误的话,现在应该可以开始发送了

有问题查看/var/log/maillog

 可以通过如下站点验证配置是否正确:
12

向10分的完美成绩努力吧:

发表评论

新用户的评论需审核后才会显示;

电子邮件地址不会被公开;
必填项已用*标注