AntiVir MailGateの設定

ウイルスメール対策としてsendmailにAntiVir MailGateを導入します。サーバー側にインストールしてウイルスメールをクライアント側PCにウイルスメールを届かないようにするソフトになります。このソフトは個人または非商用に限り無料で使用できるソフトです。
PRODUCTSのAntiVir MailserverからAntiVir MailGate Linux(avlxmgt.tgz)をダウンロードします(2004年9月現在のバージョンは2.0.2-8になります)。
あと、個人利用は無料ですが、ライセンスキーを取得する必要がありますのでユーザー登録します。自分のメールアドレスは間違いなく入力してください。ライセンスキーが送られて来るまで多少時間がかかるかもしれません。
Sendmailを使用してAntiVir MailGateの設定になります。
■AntiVir Mailgate for Linuxのインストールと設定
ここでは、ダウンロード先を /usr/local/src とします。
カレントディレクトリを /usr/local/src に移動します。

# cd /usr/local/src

最初にダウンロードしたファイル avlxmgt.tgz を解凍します。
# tar zxfv avlxmgt.tgz
ファイルが展開されますので、展開されたディレクトリに移動します。
# cd avmailgate-2.0.2-8  ←バージョンによって番号は変わります。
次にavinstall.plでインストールしますが perl スクリプトが動作することが条件になります。
# ./avinstall.pl
インストールが開始されますが、99%まで一回々Enterで実行してインストールしていきます。
あと、99%から以下のように実行します。
(99%)provided the Licensee has quoted its UST/VAT-ID number.
Do you agree the License (y/n): y ←ここでは必ず「y」を入力してEnterを実行

Enter the path of init directory
(default is: /etc/rc.d):Enter ← または /etc/rc.d/init.d

Enter the path where AntiVir MailGate binaries will be located
(default is: /usr/sbin): Enter

Enter the path where scan engine and virus definition file will be located
(default is: /usr/lib/AntiVir): Enter

The directory /usr/lib/AntiVir doesn't exists. Try again!
Should I create it? (y/n): y

Enter the path where manual pages will be located
(default is: ): Enter

Enter the path to your license file: Enter

The automatic internet updater will check every hour
if a new update is available.
Default is yes. Install the automatic internet updater? (y/n): y

Creating directory /usr/local/antivir
Installing config file /etc/avmailgate.conf
Installing config file /etc/antivir.conf

Enter the hosts and/or domains that are local:
(default is: localhost): abcde.com ←自ドメインを入力

Enter the hosts and networks that are allowed to relay:
(default is: 127.0.0.1/8 192.168.0.0/16): 127.0.0.1/8 192.168.1.0/24 ←自ネットワークにあわせます

以上で完了します。
メールで送られてきたライセンスキーファイルhbedv.keyを/usr/lib/AntiVir/にコピーして、所有者をuucpに変更します。
# cp hbedv.key /usr/lib/AntiVir
# chown uucp:uucp /usr/lib/AntiVir/hbedv.key
■Sendmailの設定
sendmailの設定をします。
/etc/servicesにsmtp-backdoor 825/tcpを追加します。(追加場所はポート番号の並び順でいいと思います。)
# vi /etc/services
smtp-backdoor        825/tcp
設定ファイル/etc/avmailgate.conf で # ForwardTo SMTP: localhost port 825の行を探し編集します。
# vi /etc/avmailgate.conf
# ForwardTo SMTP: localhost port 825
ForwardTo SMTP: localhost port smtp-backdoor ←赤部分を編集します。

# (NO is only available in commercial mode)
# ExposeRecipientAlerts LOCAL
ExposeRecipientAlerts    YES ←受信者のほうにも検出メールを送りたい場合
sendmailの /etc/sendmail.cf の、DaemonPortOptions行の以下を書き換えます。
#O DaemonPortOptions=Name=MTA
O DaemonPortOptions=Name=MTA,Port=smtp-backdoor
# vi /etc/sendmail.cf
#O DaemonPortOptions=Name=MTA
O DaemonPortOptions=Name=MTA,Port=smtp-backdoor ←赤部分を追加します。
ファイルをアップデートします。以下のような表示があればアップデートはOKです。
# /usr/lib/AntiVir/antivir --update

AntiVir / Linux Version 2.1.0-22
Copyright (C) 1994-2004 by H+BEDV Datentechnik GmbH.
All rights reserved.

checking for updates

06.25.00.46 <=> 06.25.00.46 [vdf, loaded]
06.25.00.03 <=> 06.25.00.03 [engine, running]
02.01.00.22 <=> 02.01.00.22 [program, running]

AntiVir is up-to-date
ウィルス定義ファイルの更新でデフォルトでは、毎時15分に定義ファイルの更新を行うように /etc/crontab に追加されていますが作業時間によって時間が変わってきます(アップデートの時間変更は自由です)。
# vi /etc/crontab
15 * * * * root /usr/sbin/antivirupdater -q ←毎時15分に定義ファイルの更新
       ↓一日一回にしたい場合
15 01 * * * root /usr/sbin/antivirupdater -q ←毎日1:55分に定義ファイルの更新
動作確認のため、sendmailを再起動した後、AntiVirを起動します。
# service sendmail restart または# killall -HUP sendmail または # /etc/rc.d/init.d/sendmail restart
# /etc/rc.d/avgate start 変更した場合 # etc/rc.d/init.d/avgate start
動作確認は、自分宛にメールを出して受け取ったメールヘッダーに受信したメールのプロパティ(詳細タブ)に以下の行があれば正常に動作しています。
X-AntiVirus: checked by AntiVir MailGate (version: 2.0.2-8; AVE: 6.27.0.6; VDF: 6.27.0.37; host: xxxxxx.xxxxxx.co.jp)
受信したウイルスメールを削除するようする
AntiVir MailGateで検知したウィルスメールは/var/spool/avmailgate/rejected/に保存されるため、定期的に削除するように以下を追加します。
毎日1:20にシステムのウイルスチェックをしてAntiVir MailGateで検知したウィルスメールが自動的に削除されるようになる。
# vi /etc/crontab
20 01 * * * /usr/lib/AntiVir/antivir /var/spool/avmailgate/rejected/ -q -z -e -del
各パラメーターの意味
パラメータ
説明
/
/以下の全てのディレクトリをスキャン。未指定時は/rootのみ。
-q
バックグラウンドで動作。(Quiet)
-s
サブディレクトリ以下もスキャンする。未指定時は、メインディレクトリのみスキャン。
-z
圧縮ファイルをスキャンする。未指定時は、圧縮ファイルはスキャンされない。
-e
感染ファイルのリペアを試みる。
-del
リペアできなければ削除する。上記オプションがなければいきなり削除される。
--allfiles
全てのファイルをスキャンする。
管理者宛に駆除したメールの案内です。
* * * * * * * * * * * * * * * AntiVir ALERT * * * * * * * * * * * * * * *

This version of AntiVir is licensed for private and non-commercial use.

AntiVir has detected the following in a mail sent through your server:

Worm/Netsky.D.Dam worm

The mail was not delivered.

It has been quarantined with the following queue id:

08740-75EC8420

Mail-Info:
--8<--

From: xxxxx@xxx.xxxxxx.co.jp
To: nobody@xxxxx.co.jp
Date: Sun, 29 Aug 2004 19:27:12 +0900
Subject: Re: Excel file
Mail-From: xxxxx@xxx.xxxxxx.co.jp
Rcpt: nobody@xxxxx.co.jp
Queue-Id: 08740-75EC8420
Status: The mail was not delivered!

--8<--
Log-File:
--8<--

checking file "/var/spool/avmailgate/incoming/df-08740-75EC8420"

--8<--
This version of AntiVir is licensed for private and non-commercial use.

--
AntiVir for UNIX
Copyright (c) 1994-2004 by H+BEDV Datentechnik GmbH.
All rights reserved.
For more information see http://www.antivir.de/ or http://www.hbedv.com/
送信者には、以下のように「ウィルス発見」のメールが自動的に送信される。
* * * * * * * * * * * * * * * AntiVir ALERT * * * * * * * * * * * * * * *

This version of AntiVir is licensed for private and non-commercial use.

AntiVir has detected the following in a mail from your address:

Worm/Netsky.D.Dam worm

The mail was not delivered.

Please remove any potential malicious software from your computer before

sending a new mail with attachments.

Mail-Info:

--8<--
Message-Id: <20040817182638.5029477b.***@abcde.com>
From: webmaster <*****@abcde.com>
To: *****@yahoo.co.jp
Date: Sat, 17 Aug 2004 18:26:38 +0900
Subject: test of Virus
--8<----

AntiVir for UNIX
Copyright (C) 1994-2002 by H+BEDV Datentechnik GmbH. All rights reserved.
For more information see http://www.antivir.de/ or http://www.hbedv.com/


戻る