OpenARC

提供: ArchWiki
2024年6月27日 (木) 22:20時点におけるKusanaginoturugi (トーク | 投稿記録)による版 (→‎Configuration: 飜訳)
ナビゲーションに移動 検索に移動

OpenARC は、実験的な Authenticated Received Chain (ARC) メール認証システムのオープンソース実装であり、メーリングリストや転送サービスのような中間メールサーバーが、メールの元の認証結果に署名できるように設計されています。

ARC は、Microsoft、Google、Fastmail、Proton Mail を含む、ほとんどの一般的なメールプロバイダーによってサポートされています。

概念

DMARC は、送信者のドメインが SPF および/または DKIM によって保護されたメッセージを示し、メッセージの SPF および/または DKIM のチェックに失敗した場合に受信サーバーがどのような措置を取るべきかを示します(たとえば、受信サーバーはメッセージを拒否することができます)。

しかし、メールがメーリングリストやメールフォワーダーを通じて送信される場合、中間サーバーがメッセージに加えた変更のために DKIM または SPF のチェックが失敗する可能性があります。合法的なメッセージのこのような失敗を防ぐために、ARC が作成されました。

ARC は ARC ヘッダーを使用してメッセージに再署名します。これらのヘッダーにより、誰がメッセージを変更したか、および中間サーバーによる変更前の認証状態を知ることができます。

中間サーバーによるメッセージの変更後に SPF および/または DKIM のチェックが失敗する場合(上記参照)、有効な ARC チェーンがあれば、受信サーバーはそれを信頼していれば、メッセージを通過させることができます。ARC チェーンにより、受信メールサーバーは(古い)SPF および DKIM の結果を抽出してチェックに合格させることができます。

詳細については RFC 8617 を参照してください。

インストール

openarcAUR パッケージをインストールしてください。

設定

署名サービスのメイン設定ファイルは /etc/openarc/openarc.conf です。

  • 空の設定ファイル /etc/openarc/openarc.conf を作成するか、サンプル設定ファイル /usr/share/doc/openarc/openarc.conf.sample/etc/openarc/openarc.conf にコピーまたは移動し、以下のオプションを変更または追加します(詳細は openarc.conf(5) を参照):
/etc/openarc/openarc.conf
PidFile /run/openarc/openarc.pid
UserID  openarc:openarc
Socket  local:/run/openarc/openarc.sock

Mode                    sv
Canonicalization        relaxed/simple
Domain                  example.com
Selector                myselector
KeyFile                 /etc/openarc/keys/myselector.private
  • ソケットアドレスは /etc/postfix/main.cf で指定されているものです。これが /etc/postfix/main.cf に含まれるべき内容です:
/etc/postfix/main.cf
smtpd_milters = unix:/run/opendkim/opendkim.sock
    unix:/run/openarc/openarc.sock
non_smtpd_milters = $smtpd_milters
milter_default_action = accept
  • 秘密署名キーを生成するには、メールを送信するドメインと、キーを参照するために使用するセレクタを指定します。セレクタは任意の値です。RFC で詳細が説明されていますが、英数字の文字列で問題ありません:
# opendkim-genkey -D /etc/openarc/keys -r -s myselector -d example.com
# chown -R openarc /etc/openarc/keys
  • syslog へのロギングを有効にする場合は、次のようにします:
/etc/openarc/openarc.conf
...
Syslog  yes
...
  • OpenARC に署名するヘッダーを設定するには、例えば次のようにします:
/etc/openarc/openarc.conf
...
SignHeaders to,subject,message-id,date,from,mime-version,dkim-signature,arc-authentication-results
...
  • PeerList には、このフィルターによって署名または検証されるべきではない IP アドレス、CIDR ブロック、ホスト名、またはドメイン名のリストが含まれています。これは、例えば、あなたのローカルメールを除外するために使用することができます。このファイルは、存在しない場合に作成する必要があります。
/etc/openarc/openarc.conf
...
PeerList /etc/openarc/PeerList
...
  • その他の設定オプションも利用可能です。ドキュメントを必ず読んでください。
  • openarc.serviceEnable/startしてください。

Postfix integration

To integrate ARC using unix sockets, add the postfix user to the openarc group and edit the OpenARC and Postfix configuration files as follows:

/etc/openarc/openarc.conf
UserID  openarc:openarc
Socket  local:/run/openarc/openarc.sock
/etc/postfix/main.cf
smtpd_milters = unix:/run/opendkim/opendkim.sock
    unix:/run/openarc/openarc.sock
non_smtpd_milters = $smtpd_milters
milter_default_action = accept

Security

ノート: This section is copied from the OpenDKIM#Security

The default configuration for the OpenARC daemon is less than ideal from a security point of view (all those are minor security issues):

  • The OpenARC daemon does not need to run as root at all (the configuration suggested earlier will have OpenARC drop root privileges by itself, but systemd can do this too and much earlier).
  • If your mail daemon is on the same host as the OpenARC daemon, there is no need for localhost tcp sockets, and unix sockets may be used instead, allowing classic user/group access controls.
  • OpenARC is using the /tmp folder by default whereas it could use its own folder with additional access restrictions.

The following configuration files will fix most of those issues (assuming you are using Postfix) and drop some unnecessary options in the systemd service unit. First, create a missing directory:

# mkdir /var/lib/openarc

Then:

/etc/openarc/openarc.conf
BaseDirectory           /var/lib/openarc
Domain                  example.com
KeyFile                 /etc/openarc/keys/myselector.private
Selector                myselector
Socket                  local:/run/openarc/openarc.sock
Syslog                  Yes
TemporaryDirectory      /run/openarc
/etc/systemd/system/openarc.service
[Unit]
Description=OpenARC daemon
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
User=openarc
Group=openarc
ExecStart=/usr/bin/openarc -c /etc/openarc/openarc.conf
RuntimeDirectory=openarc
RuntimeDirectoryMode=0700

[Install]
WantedBy=multi-user.target

Edit /etc/postfix/main.cf accordingly to make Postfix listen to this unix socket:

/etc/postfix/main.cf
smtpd_milters = unix:/run/opendkim/opendkim.sock
    unix:/run/openarc/openarc.sock
non_smtpd_milters = $smtpd_milters

See also