yum install opendkim
# 修改以下設定 Mode sv Domain {your-domain} # 新增以下設定 AutoRestart Yes AutoRestartRate 10/1h LogWhy Yes Syslog Yes SyslogSuccess Yes 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
mkdir /etc/opendkim/keys/{your-domain} opendkim-genkey -D /etc/opendkim/keys/{your-domain}/ -d {your-domain} -s default chown -R opendkim: /etc/opendkim/keys/{your-domain} mv /etc/opendkim/keys/{your-domain}/default.private /etc/opendkim/keys/{your-domain}/default
vi /etc/opendkim/KeyTable # 新增以下設定 default._domainkey.{your-domain} {your-domain}:default:/etc/opendkim/keys/{your-domain}/default.private
vi /etc/opendkim/SigningTable # 新增以下設定 *@{your-domain} default._domainkey.{your-domain}
# 將 {your-domain} 改為你的網域 export domain={your-domain} mkdir /etc/opendkim/keys/$domain cd /etc/opendkim/keys/$domain opendkim-genkey -d $domain -s default chown -R opendkim:opendkim /etc/opendkim/keys/$domain echo "default._domainkey.$domain $domain:default:/etc/opendkim/keys/$domain/default.private" >> /etc/opendkim/KeyTable echo "*@$domain default._domainkey.$domain" >> /etc/opendkim/SigningTable
vi /etc/opendkim/TrustedHosts # 新增以下設定 {your-domain} host.{your-domain}
vi /etc/postfix/main.cf # 新增以下設定 smtpd_milters = inet:127.0.0.1:8891 non_smtpd_milters = $smtpd_milters milter_default_action = accept milter_protocol = 2
service opendkim restart chkconfig opendkim on service postfix restart
{your-domain}. 14400 IN TXT "v=spf1 a mx ~all"