
複数の柔軟な IPS を備えた単一の EC2 に DKIM を実装するためのベスト プラクティスを見つけようとしています。
# /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
次に、2 つの DNS レコードがあります。
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 に行を追加する必要があります。
しかし、DKIM 設定をテストすると、メールが署名されていないことを示す「pass: neuron」応答が返され続けますが、ログ ファイルでは署名されています。
# 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
答え1
わかりました、私は明らかに混乱していました。DKIM署名フィールドの「s」は、postfix設定から$myhostnameを識別するものだと思っていましたが、実際にはそうではありませんでした。DKIM キーローテーションようやく理解できましたが、「s」は単に KeyTable、SigningTable、および DNS から使用するセレクターです。
これをチェックして:
# /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 エントリは、メールが実際に自分のドメインから送信されたことを確認するために使用されます (したがって、ドメイン キー識別メールと呼ばれます)。その後、約 7 日後に、mail_r-1.domainkey.example.com を削除できます。