「AntiVir MailGate」の設定

※現在、「AntiVir MailGate」は無償では無くなりましたので、 無償のものを利用するのであれば、「Clam AV」 + 「amavisd-new」等を利用することになります。

AntiVir MailGateにより、メールサーバでウィルスメールを駆除するようにします。
「AntiVir MailGate」は非商用利用では無償で利用できます。
まずはここからユーザ登録をします。
情報を入力後、非商用利用ならば一番下の
「Herewith I assure that I use AntiVir for Linux / FreeBSD / OpenBSD exclusively for private, non-commercial purposes」
にチェックを入れます。
登録後、登録したメールアドレスにライセンスキーが添付されて送信されます。
Linux版のダウンロードはここから行います。

「AntiVir MailGate」のインストール

ダウンロードしたファイルを展開します。

[root@CentOS ~]# tar zxf antivir-mailgate-prof-2.0.3-25.tar.gz

インストールスクリプトを実行してインストールします。

[root@CentOS ~]# cd antivir-mailgate-prof-2.0.3-25/ <= 展開してできたディレクトリへ移動
[root@CentOS antivir-mailgate-prof-2.0.3-25]# ./install <= インストールスクリプト実行

※使用許諾書が出力されますのでSPACEキーを押して画面を進めます。

ここで色々と聞かれますが、自分は以下のように答えました。
Do you agree to the license terms? [n] y


creating /usr/lib/AntiVir ... done
1) installing AntiVir Engine
checking for existing /etc/antivir.conf ... not found
copying bin/antivir to /usr/lib/AntiVir/ ... done

NOTICE: This system has a prelinker. Prelinking the
        antivir binary will not work correctly. Either
        disable prelinking or add /usr/lib/AntiVir as an
        excluded prelink path.

        For example, add '-b /usr/lib/AntiVir'
        to /etc/prelink.conf

copying vdf/antivir.vdf to /usr/lib/AntiVir/ ... done
copying etc/antivir.conf to /etc/ ... done

Enter the path to your key file: [] <= 空ENTER
no key file will be installed
copying script/configantivir to /usr/lib/AntiVir/ ... done
linking /usr/bin/antivir to /usr/lib/AntiVir/antivir ... done
installation of AntiVir Engine complete


2) installing automatic internet updater
An automatic internet updater is available with version 2.0.3-25 of
AntiVir MailGate. This is a daemon that will run in the background
and automatically check for updates (internet access is required).
You may also manually check for updates using:

     antivir --update

You do not need to install the automatic internet updater in order
to manually check for updates. Please read the README file for more
information on updates and how they can best suit you.

Would you like to install the automatic internet updater? [n] y
copying script/avupdater to /usr/lib/AntiVir/ ... done

Would you like to create a link in /usr/sbin for avupdater ? [y] <= 空ENTER
linking /usr/sbin/avupdater to /usr/lib/AntiVir/avupdater ... done

Would you like the internet updater to start automatically? [y] <= 空ENTER
setting up startup script ... done
installation of automatic internet updater complete


3) installing main program
copying doc/avmailgate_de.pdf to /usr/lib/AntiVir/ ... done
copying bin/avgated to /usr/lib/AntiVir/ ... done
copying bin/avgatefwd to /usr/lib/AntiVir/ ... done
copying script/avq to /usr/lib/AntiVir/ ... done
copying script/rc.avgate.redhat to /usr/lib/AntiVir/avmailgate ... done
creating /usr/lib/AntiVir/templates ... done
copying doc/MANUAL to /usr/lib/AntiVir/MANUAL.avmailgate ... done
copying etc/avmailgate.ignore to /etc/ ... done
copying etc/avmailgate.scan to /etc/ ... done
copying etc/avmailgate.warn to /etc/ ... done
creating /var/spool/avmailgate ... done
creating /var/spool/avmailgate/incoming ... done
creating /var/spool/avmailgate/outgoing ... done
creating /var/spool/avmailgate/rejected ... done

Enter the path where the manual pages will be located:
[/usr/share/man]: <= 空ENTER
copying doc/man/avmailgate.conf.5 to /usr/share/man/man5/ ... done
copying doc/man/avmailgate.8 to /usr/share/man/man8/ ... done

Enter the hosts and/or domains that are local:
[]:  <= CentOS.crimson-snow.net crimson-snow.net(ホスト名・ドメイン名を指定)

Enter the hosts and networks that are allowed to relay:
[127.0.0.1/8 192.168.0.0/16]: <= 空ENTER

Would you like to create a link in /usr/sbin for avmailgate ? [y] <= 空ENTER
linking /usr/sbin/avmailgate to /usr/lib/AntiVir/avmailgate ... done

Would you like AvMailGate to start automatically? [y] <= 空ENTER
setting up startup script ... done
installation of main program complete


4) installing GUI (+ SMC support)

Note: The AntiVir Security Management Center (SMC) requires this
      feature, even if you do not intend to use the GUI.

This product comes with a GUI that allows you to monitor realtime
activity, view logs, and configure the product. This tool is optional
(not required) for the product to run.

The GUI requires Java 1.4.0 or higher.

Would you like to install the GUI (+ SMC support)? [n] <= 空ENTER
checking for existing /etc/avmailgate.conf ... not found
copying etc/avmailgate.conf to /etc/ ... done
GUI will NOT be installed


Installation of the following features complete:
     AntiVir Engine
     AntiVir Automatic Internet Updater
     AntiVir MailGate


If you have any license key files, please copy them to /usr/lib/AntiVir
before running the software. Without a valid license key, it will
run in DEMO mode.

Note: It is highly recommended that you perform an update now to
      ensure up-to-date protection. This can be done by running:

      antivir --update

Be sure to read the README file for additional information.
Thank you for your interest in AntiVir MailGate.
「prelink」への対処

ソフトの高速化をはかるprelinkというソフトは実行ファイルを書き換えてしいます。
その為、「AntiVir MailGat」による自身の書き換えのチェックによりエラーとなってしまいます。
そこで、 「AntiVir MailGate」を「prelink」対象外ディレクトリへ移動し、 移動先ディレクトリへ元の名前でリンクを貼ることで対処します。

[root@CentOS ~]# mv /usr/lib/AntiVir/ /usr/local/lib/ <= 「prelink」対象外ディレクトリへ移動
[root@CentOS ~]# mv /usr/sbin/avgated /usr/local/sbin/ <= 「prelink」対象外ディレクトリへ移動
[root@CentOS ~]# mv /usr/sbin/avgatefwd /usr/local/sbin/ <= 「prelink」対象外ディレクトリへ移動
[root@CentOS ~]# ln -s /usr/local/lib/AntiVir /usr/lib/AntiVir <= 「prelink」対象外ディレクトリから元のディレクトリへリンク
[root@CentOS ~]# ln -s /usr/local/sbin/avgated /usr/sbin/avgated <= 「prelink」対象外ディレクトリから元のディレクトリへリンク
[root@CentOS ~]# ln -s /usr/local/sbin/avgatefwd /usr/sbin/avgatefwd <= 「prelink」対象外ディレクトリから元のディレクトリへリンク
「AntiVir MailGate」の設定

入手したライセンスキーの設定をします。

[root@CentOS ~]# mv HBEDV.KEY /usr/lib/AntiVir/hbedv.key <= ライセンスキーを/usr/lib/AntiVir/へ移動
[root@CentOS ~]# chown uucp:uucp /usr/lib/AntiVir/hbedv.key <= ライセンスキーの所有者をuucpへ変更

サービスポート設定ファイルを編集します。

[root@CentOS ~]# vi /etc/services <= 設定ファイルの編集
# Local services
antivir         10024/tcp #Port for avgated <= 追加(AntiVir MailGateのポート)
smtp-backdoor   10025/tcp #Port for postfix backdoor <= 追加(Postfixのポート)

「AntiVir MailGate」の設定ファイルを編集します。

[root@CentOS ~]# /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からのフォワード先ポート
「Postfix」の設定

「master.cf」と「main.cf」の2つのファイルを編集します。

[root@CentOS ~]# vi /etc/postfix/master.cf <= 「master.cf」の編集
localhost:smtp-backdoor inet n - n - - smtpd -o content_filter= <= 追加


[root@CentOS ~]# vi /etc/postfix/main.cf <= 「main.cf」の編集
content_filter = smtp:127.0.0.1:10024 <= 追加
「AntiVir MailGate」の起動

オリジナルの起動スクリプトをコピーします。

[root@CentOS ~]# cp antivir-mailgate-prof-2.0.3-25/script/rc.avgate.redhat /etc/rc.d/init.d/avgate

「Postfix」を再起動し、「AvtiVir MailGate」を起動します。

[root@CentOS ~]# /etc/rc.d/init.d/postfix restart
[root@CentOS ~]# /etc/rc.d/init.d/avgate start

「AntiVir MailGate」の自動起動

CentOSを起動した際、「AntiVir MailGate」も起動するようにします。
ただし、インストール時に自動起動するように設定した場合、この作業は必要ありません。

[root@CentOS ~]# chkconfig --add avgate
[root@CentOS ~]# chkconfig avgate on

展開したディレクトリは不要になりますので、削除します。

[root@CentOS ~]# rm -rf antivir-mailgate-prof-2.0.2-15/
ウィルス定義ファイルの最新化
[root@CentOS ~]# /usr/lib/AntiVir/antivir --update -q
ウィルス定義ファイルの最新化と検出したウィルスメールの削除を行うスクリプトの作成
[root@CentOS ~]# vi avgate.sh <= スクリプトファイルの新規作成
#!/bin/sh

/usr/lib/AntiVir/antivir --update -q > /var/log/avgate.log
/usr/lib/AntiVir/antivir /var/spool/avmailgate/rejected/ -z -e -del >> /var/log/avgate.log

作成したスクリプトに実行権限を与えます。

[root@CentOS ~]# chmod 755 avgate.sh

スクリプトの自動実行

作成したスクリプトを毎日4:30に自動実行するようにします。

[root@CentOS ~]# crontab -e <= cronの編集
30 04 * * * /root/avgate.sh <= 追加
▲ページのトップへ