| メールサーバーでウィルスチェックの導入(AntiVir MailGete編) |
AntiVir MailGete を使用して、メールサーバー(Postfix)内でウィルスチェックを行います。
ウィルス検出時には、管理者にメールで知らせてくれ、ウィルスメールは配送しません。
| ユーザー登録 |
AntiVirでユーザ登録する
※ ライセンスキーの有効期限が1年から30日に変更されたようです。
参考までに、入力内容を掲示します。
* 印の部分は必須項目です。
入力が終了したら、チェックボックスの上側のみチェックを入れて、send ボタンを押してください。

ユーザー登録時に記載したメールアドレスに、ライセンスキー hbedv.key が届きます。
※注 HBEDV.KEYと大文字の場合がありますがhbedv.keyと小文字に変更して置いてください。
ライセンスキーを root へ移動しておきます。
※ メールが届くまで、少し時間がかかる場合がありますので気長に待ちましょう(^^♪
| インストール |
ダウンロードします # wget http://free-av.de/personal/en/unix/antivir-mailgate-pers.tar.gz # tar zxvf antivir-mailgate-pers.tar.gz ← 解凍します # cd antivir-mailgate-pers* ← 移動 インストールスクリプト編集 # vi install 116GG ← 116行目へ移動 移動したら i キー(入力モード) if [ ! -x "`which $EXEITEM`" ] ←116行目 ↓ if [ ! -x "`/usr/bin/which $EXEITEM`" ] ← whichの場所をVine 用に変更 変更したらEsc キー(コマンドモード):wqで保存 # ./install ← インストールスクリプトを実行 Before installing this software, you must agree to the terms of the license. Press <ENTER> to view the license. ENTERキー 何やら、使用承諾書がいっぱい出てくるのでSPACEキーで流してください Do you agree the LICENSE [n] y [/usr/share/man]: ENTERキー Enter the path to your license file []: ENTERキー Install the automatic internet updater? [n] ENTERキー [linux.xxxxx.com xxxxx.com ]: ENTERキー 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 ←この項目だけは各自の内部ネットワークアドレスを入力してください。 Would you like AvMailGate to start automatically? [n] ENTERキー Then start AntiVir MailGate "/usr/lib/AntiVir/avmailgate start". これが出てくればインストールは終了です。 # cd ← ホームへ戻る # rm -f antivir-mailgate-pers.tar.gz ← ダウンロードしたファイルを削除 # cp antivir-mailgate-pers/avmailgate/init/rc.avgate.redhat /etc/rc.d/init.d/avgate ← 起動スクリプトを移動 # rm -rf antivir-mailgate-pers*/ ← 解凍してできたディレクトリ削除 |
| 設定 |
ライセンスキーを /usr/lib/AntiVir/ へ移動 # mv hbedv.key /usr/lib/AntiVir/ ライセンスキーの所有者をuucpへ変更 # chown uucp:uucp /usr/lib/AntiVir/hbedv.key |
/etc/services を編集
# Local services
antivir 10024/tcp ← 追記 (AntiVir MailGateのポート)
smtp-backdoor 10025/tcp ← 追記 (Postfixのポート)
/etc/avmailgate.conf を編集
# ListenAddress 0.0.0.0 port 25
ListenAddress localhost port antivir ← 追記 (AntiVir MailGateのポート)
# ForwardTo SMTP: localhost port 825
ForwardTo SMTP: localhost port smtp-backdoor ← 追記 (AntiVirからのフォワード先ポート)
/etc/postfix/master.cf を編集
localhost:smtp-backdoor inet n - n - - smtpd -o content_filter= ← 最下部に追記
/etc/postfix/main.cf を編集
content_filter = smtp:127.0.0.1:10024← 最下部に追記
# /etc/rc.d/init.d/avgate start ← AntiVir MailGateの起動 # /etc/rc.d/init.d/postfix restart ← Postfix の再起動 ウィルス定義ファイル最新化 # /usr/lib/AntiVir/antivir --update ← ウィルス定義ファイルの最新化 |
| AntiVir MailGateの動作確認 |
空メールを、メールソフトOutlookExpress(自分) へMail サーバー経由で送信します。
受信メールを右クリックしてプロパティーの詳細タブに以下の内容があれば Mail
サーバーでウィルスチェック済みです。
X-AntiVirus: checked by AntiVir MailGate (version: 2.0.2-8; AVE: 6.27.0.4; VDF: 6.27.0.10; host: server)
今度はこことここからテスト用の無害なウィルスをDLして添付したメールを先ほどの要領で送信します。
自分にはメールが来ず管理者宛に以下の内容のメールが届けば正常にメールサーバーでウィルスが検出されています。
| * * * * * * * * * * * * * * * 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: Eicar-Test-Signatur virus 〜以下省略 |
| 自動起動設定 |
# chkconfig --add avgate ← 起動スクリプトをchkconfigへ追加 # chkconfig avgate on ← 自動起動設定 # chkconfig --list avgate avgate 0:off 1:off 2:on 3:on 4:on 5:on 6:off |
| 定義ファイルの最新化とウィルスメールの削除を自動化 |
/etc/crontab を編集します。
インストール時自動で追加されているので、以下を削除する。
4 * * * * root /usr/lib/AntiVir/antivir --update -q
次にエディタで新規に自動化スクリプトを作製します。
#!/bin/sh AVGATE='/usr/lib/AntiVir/antivir' LOG='/var/log/antivir.log' ← ※1 $AVGATE --update -q > $LOG ← ※2 $AVGATE /var/spool/avmailgate/rejected/ -z -e -del >> $LOG ← ※3 |
※各部説明
※1 ログの保存場所
※2 AntiVirのアップデート
※3 検地したウィルスメールは /var/spool/avmailgate/rejected/ に保存されるので、/var/spool/avmailgate/rejected/のスキャンを行い、保存されているウィルスメールを削除するようにする。
記載できたら antivir.sh と言うファイル名で保存してください。
スクリプトに実行件を与えます。 # chmod +x antivir.sh # crontab -e ← cronの編集 viエディタが開きますので下記のように登録してください。 移動したら iキー(入力モード) 00 04 * * * /root/antivir.sh これで毎日04.00分にスクリプトが実行されます。 記載したら Esc キー(コマンドモード):wqで保存 # /etc/rc.d/init.d/crond restart ←Cron を再起動 |
Copyright c Vine Linuxで自宅サーバー. 2004 All Rights Reserved.