安装opendkim

==============================================================================================

http://stevejenkins.com/blog/2010/09/how-to-get-dkim-domainkeys-identified-mail-working-on-centos-5-5-and-postfix-using-opendkim/


1. 下载安装 EPEL

1)wget http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

2)rpm -ivh epel-release-5-4.noarch.rpm


2.  安装opendkim

yum install opendkim

3. 生成签名

cd  /etc/opendkim/keys/

mkdir /etc/opendkim/keys/lili.com

/usr/bin/opendkim-genkey -D /etc/opendkim/keys/lili.com/ -d lili.com -s default

chown -R opendkim:opendkim /etc/opendkim/keys/lili.com

mv /etc/opendkim/keys/lili.com/default.private /etc/opendkim/keys/lili.com/default


4. 编辑配置文件

1) /etc/opendkim.conf

AutoRestart             Yes

AutoRestartRate         10/1h

Canonicalization        relaxed/simple

ExternalIgnoreList      refile:/etc/opendkim/TrustedHosts

InternalHosts           refile:/etc/opendkim/TrustedHosts

KeyTable                refile:/etc/opendkim/KeyTable

LogWhy                  Yes

Mode                    sv

PidFile                 /var/run/opendkim/opendkim.pid

SignatureAlgorithm      rsa-sha256

SigningTable            refile:/etc/opendkim/SigningTable

Socket                  inet:8891@localhost

Syslog                  Yes

SyslogSuccess           Yes

TemporaryDirectory      /var/tmp

UMask                   022

UserID                  opendkim:opendkim




2) /etc/opendkim/KeyTable 

default._domainkey.lili.com lili.com:default:/etc/opendkim/keys/lili.com/default


3)/etc/opendkim/TrustedHosts

127.0.0.1

mail.lili.com

lili.com


4)/etc/opendkim/SigningTable

*@moko.cc default._domainkey.moko.cc


5)/etc/postfix/main.cf

smtpd_milters           = inet:127.0.0.1:8891

non_smtpd_milters       = $smtpd_milters

milter_default_action   = accept

milter_protocol   = 2

local_recipient_maps =

alias_maps = hash:/etc/aliases


5. 启动

/etc/init.d/opendkim start

/etc/init.d/postfix restart


6. 加入DNS记录

加入整个内容/etc/opendkim/keys/example.com/default.txt


7. 发送邮件

mail [email protected]


8. 查看邮件日志

1)tail -f /var/log/maillog


2)OpenDkim启动时,正常工作输出

opendkim[4397]: OpenDKIM Filter: mi_stop=1

opendkim[4397]: OpenDKIM Filter v2.4.2 terminating with status 0, errno = 0

opendkim[27444]: OpenDKIM Filter v2.4.2 starting (args: -x /etc/opendkim.conf)


3)当发邮件时,正常签名时输出

opendkim[22254]: 53D0314803B: DKIM-Signature header added