「OpenDKIM」:修訂間差異

出自Gea-Suan Lin's Wiki
跳至導覽 跳至搜尋
本頁面具有訪問限制。如果您看見此訊息,這代表您沒有訪問本頁面的權限。
 
(未顯示同一使用者於中間所作的 5 次修訂)
行 11: 行 11:
== 設定 ==
== 設定 ==


 先產生key pair,其中的<code>-s mail</code>為[[DKIM]]的selector,預設會產生2048 bit RSA key pair:
 先產生key pair,其中的<code>-s mail</code>為[[DKIM]]的selector,預設會產生2048 bit RSA key pair ,產生出來的<code>mail.txt</code>是DNS的<code>TXT</code> record的內容


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
sudo mkdir /etc/opendkim; cd /etc/opendkim; sudo opendkim-genkey -t -s mail -d example.com; sudo chown -R opendkim:opendkim .
cd /etc/dkimkeys; sudo opendkim-genkey -t -s mail -d my.example.com
</syntaxhighlight>
</syntaxhighlight>


  產生出來的<code>mail.txt</code> 是DNS的<code>TXT</code> record的內容。
  <code>/etc/opendkim.conf</code>內加上:
 
<syntaxhighlight lang="apache">
Domain          my.example.com
Selector         mail
KeyFile         /etc/dkimkeys/mail.private
</syntaxhighlight>
 
然後改Socket設定,只開8891/tcp:
 
<syntaxhighlight lang="apache">
Socket          inet:8891@localhost
</syntaxhighlight>


=== Postfix ===
=== Postfix ===
行 28: 行 40:
smtpd_milters = inet:localhost:8891
smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
non_smtpd_milters = inet:localhost:8891
</syntaxhighlight>
然後重啟服務:
<syntaxhighlight lang="bash">
sudo service opendkim restart; sudo postfix reload
</syntaxhighlight>
</syntaxhighlight>



於 2023年6月30日 (五) 07:51 的最新修訂

OpenDKIM是一套實作DKIM的軟體。

安裝

Ubuntu內可以直接安裝:

sudo apt install -y opendkim; sudo apt clean

設定

先產生key pair,其中的-s mailDKIM的selector,預設會產生2048 bit RSA key pair,產生出來的mail.txt是DNS的TXT record的內容:

cd /etc/dkimkeys; sudo opendkim-genkey -t -s mail -d my.example.com

/etc/opendkim.conf內加上:

Domain                  my.example.com
Selector                mail
KeyFile                 /etc/dkimkeys/mail.private

然後改Socket設定,只開8891/tcp:

Socket                  inet:8891@localhost

Postfix

/etc/postfix/main.cf內加上:

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

然後重啟服務:

sudo service opendkim restart; sudo postfix reload

相關連結

外部連結