试图找出在单个EC2上实施DKIM的最佳实践,该EC2将具有多个弹性IPS。
# /etc/opendkim.conf ... 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 ... # /etc/opendkim/KeyTable default._domainkey.example.com example.com:hp-hv-1:/etc/opendkim/keys/default.private default._domainkey.example.com example.com:hp-hv-2:/etc/opendkim/keys/default.private # /etc/opendkim/SigningTable *@example.com default._domainkey.example.com
然后我有两个DNSlogging:
hp-hv-1._domainkey.example.com TXT "v=DKIM1;k=rsa;p=default.txt_key_goes_here" hp-hv-2._domainkey.example.com TXT "v=DKIM1;k=rsa;p=default.txt_key_goes_here"
对于同一个EC2实例上的两个postfix实例,每个都有以下$ myhostname:
# postfixmulti instance #1 myhostname = hp-hv-1 # postfixmulti instance #2 myhostname = hp-hv-2
两个postfix实例在同一个EC2实例上,所以它们都共享相同的default.private / default.txt私钥/公钥对,所以不需要向KeyTable和SigningTable添加更多的行。 据我所知,我只需要添加额外的行到KeyTable和SigningTable,如果我想实现多个域(我不)。
但是,当我testing我的DKIM设置时,我不断收到“通过:中立”的回应,说这些电子邮件没有签名,但他们是,我可以在日志文件中看到:
# snippet from /var/log/maillog Sep 25 15:15:31 service-a-4 opendkim[27420]: 5B4A3625F0: DKIM-Signature field added (s=hp-hv-1, d=example.com)
我错过了什么?
版本:
CentOS 6.5 Postfix v2.6.6 Opendkim v2.9
好吧,我显然感到困惑,我一直认为DKIM签名字段中的“s”应该从后缀configuration中识别$ myhostname,但实际上并不是。 在阅读了关于DKIM密钥轮换的更多信息之后,它终于披上了我,“s”只是从KeyTable,SigningTable和DNS中使用的select器。
检查这个:
# /etc/opendkim/KeyTable # Format: selector(1) domain:selector(2):/path/to/key # selector(1) is used in the /etc/opendkim/SigningTable # selector(2) is built into the DKIM signature for every email sent, which is used to lookup the DNS TXT entry: mail-1_r-1._domainkey.example.com mail-1_r-1._domainkey.example.com example.com:mail-1_r-1:/etc/opendkim/keys/mail-1_r-1.private
现在如果我想旋转键,我会这样做:
# /etc/opendkim/KeyTable # Generate new private/public key pair, and rename accordingly mail-1_r-1._domainkey.example.com example.com:mail-1_r-1:/etc/opendkim/keys/mail-1_r-1.private mail-1_r-2._domainkey.example.com example.com:mail-1_r-2:/etc/opendkim/keys/mail-1_r-2.private
然后在签名表中:
# /etc/opendkim/SigningTable *@shouttag.com mail_r-1._domainkey.example.com *@shouttag.com mail_r-2._domainkey.example.com
那么对于DNS条目,您将拥有以下内容
mail_r-1.domainkey.example.com "v=DKIM1;k=rsa;p=mail_r-1.txt_key_goes_here" mail_r-2.domainkey.example.com "v=DKIM1;k=rsa;p=mail_r-2.txt_key_goes_here"
这些DNS条目是用来帮助validation电子邮件确实是从您的域发送(因此域密钥识别邮件)。 然后在7天左右之后,您可以删除mail_r-1.domainkey.example.com。