私は Exim を使っていて、メールを問題なく受信および送信できるメール サーバーを作成しました。今、受信メールごとに SPF チェックを有効にして、Received SPF
これらのメールにヘッダーを追加したいと考えています。しかし、これを行う方法がわかりません。
医者は言う、SPF verification support is built into Exim if SUPPORT_SPF=yes is set in Local/Makefile. The support uses the libspf2 library https://www.libspf2.org/.
しかし、このオプションを yes に設定できるのは、ソースから Exim をビルドしている場合のみだと思います。私は ubuntu パッケージから直接インストールしました (その場合、libspf2 は自動的にインストールされると思います)。その場所がわかりませんLocal/Makefile
。これはかなり簡単に実行できると確信していますが、現時点ではこれについて何もわかりません。
30_exim4-config_check_rcpt
また、Exim config ディレクトリをチェックしたところ、ファイル内に次の関連するコードが見つかりました。
これは、SPF チェックが有効になっていてインストールされている場合、Exim は RCPT コマンドの後に送信者の SPF レコードをチェックすると明確に述べていますspf-tools-perl
。インストールしましたspf-tools-perl
が、まだヘッダーが表示されませんReceived SPF
。そこで、2 つの疑問が生じます。
- このコードの実行を可能にするために SPF チェックを有効にするにはどうすればよいでしょうか?
- ドキュメントには Exim が libspf を使用すると明記されているのに、なぜ spf-tools-perl なのでしょうか。では、なぜライブラリが 2 つあるのでしょうか。
# Use spfquery to perform a pair of SPF checks.
#
# This is quite costly in terms of DNS lookups (~6 lookups per mail). Do not
# enable if that's an issue. Also note that if you enable this, you must
# install "spf-tools-perl" which provides the spfquery command.
# Missing spf-tools-perl will trigger the "Unexpected error in
# SPF check" warning.
.ifdef CHECK_RCPT_SPF
deny
message = [SPF] $sender_host_address is not allowed to send mail from \
${if def:sender_address_domain {$sender_address_domain}{$sender_helo_name}}.
log_message = SPF check failed.
!acl = acl_local_deny_exceptions
condition = ${run{/usr/bin/spfquery.mail-spf-perl --ip \
${quote:$sender_host_address} --identity \
${if def:sender_address_domain \
{--scope mfrom --identity ${quote:$sender_address}}\
{--scope helo --identity ${quote:$sender_helo_name}}}}\
{no}{${if eq {$runrc}{1}{yes}{no}}}}
defer
message = Temporary DNS error while checking SPF record. Try again later.
!acl = acl_local_deny_exceptions
condition = ${if eq {$runrc}{5}{yes}{no}}
warn
condition = ${if <={$runrc}{6}{yes}{no}}
add_header = Received-SPF: ${if eq {$runrc}{0}{pass}\
{${if eq {$runrc}{2}{softfail}\
{${if eq {$runrc}{3}{neutral}\
{${if eq {$runrc}{4}{permerror}\
{${if eq {$runrc}{6}{none}{error}}}}}}}}}\
} client-ip=$sender_host_address; \
${if def:sender_address_domain \
{envelope-from=${sender_address}; }{}}\
helo=$sender_helo_name
warn
log_message = Unexpected error in SPF check.
condition = ${if >{$runrc}{6}{yes}{no}}
.endif```