▼ [Postfix] PostfixとAMaViSでウイルススキャン
2007/07/22 8:04
方針
- *:25で待ち受けているPostfixはプロクシとして動作して、受け取ったメールを 127.0.0.1:10024 で待ち受けている AMaViS へ引き渡す。
- 127.0.0.1:24 で待ち受けている AMaViS は、ClamAVやSpamAssassinで処理を行い、問題が無ければ 127.0.0.1:10025 で待ち受けている Postfix へ引き渡す。(ウイルスが含まれていれば、接続元 (Postfix) に対してエラーを返す。
- 127.0.0.1:10025 で待ち受けているPostfixは、受け取ったメールを適切に配送する。(127.0.0.1 から受け取る以外、通常の動作と変わりが無い。)
これを図に表したものを以下に示す:
the net
|
v
+---------+ +----------+ +---------+
| *:25 | -----> | L:10024 | --> | L:10025 | --> (deliver)
| Postfix | proxy | AMaViS | | Postfix |
+---------+ +----------+ +---------+
^ ^
| |
v v
+---------+ +--------------+
| L:3310 | | perl module |
| ClamAV | | SpamAssassin |
+---------+ +--------------+
* "L" は 127.0.0.1 を表す
導入するべきパッケージ (ports)
- mail/postfix
- security/amavisd-new
- security/clamav
設定手順
- 正常に Postfix が動作するように設定する。
- /usr/local/etc/amavisd.conf に下記の設定を行う。これにより、127.0.0.1:10024 で AMaViS が動作する。
$inet_socket_port = 10024; $final_virus_destiny = D_REJECT;
- AMaViSを再起動する。
# /usr/local/etc/rc.d/amavisd restart
- master.cf中、smtpの項目を下記の通り修正:
smtp inet n - y - - smtpd -o smtpd_proxy_filter=127.0.0.1:10024 -o smtpd_client_connection_count_limit=10
- master.cfに下記内容を追加:
127.0.0.1:10025 inet n - y - - smtpd -o content_filter= -o local_recipient_maps= -o relay_recipient_maps= -o smtpd_restriction_classes= -o smtpd_client_restrictions= -o smtpd_helo_restrictions= -o smtpd_sender_restrictions= -o smtpd_recipient_restrictions=permit_mynetworks,reject -o mynetworks=127.0.0.0/8 -o strict_rfc821_envelopes=yes
- Postfixを再起動する。
# /usr/local/etc/rc.d/postfix reload
- テストする。ここで本文で送っている文字列は試験用のウイルスであり、実害は無い。
% telnet localhost smtp Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 pluto.ansi.co.jp ESMTP Postfix HELO pluto.ansi.co.jp 250 pluto.ansi.co.jp MAIL FROM:<postmaster@asuka.net> 250 2.1.0 Ok RCPT TO:<postmaster@asuka.net> 250 2.1.5 Ok DATA 354 End data with
. To: postmaster From: postmaster Subject: test Date: Date: Sun, 22 Jul 2007 11:22:33 +0900 (JST) X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H* . 554 5.7.0 Reject, id=18885-14 - VIRUS: Eicar-Test-Signature QUIT 221 2.0.0 Bye Connection closed by foreign host.
注意点
content_filter を利用して AmaViSを呼び出すことは推奨しない。これは、一度Postfixがメールを受け取りキューに入った時点で呼び出されるため、送信者 (多くの場合、無関係な第三者) へのエラーメールを発生させるためである。
▼ コメント(0件)
- TB-URL(確認後に公開) http://diary.asuka.net/015/tb/
