今ならXeonも搭載可能なPCサーバー「PowerEdge SC440」が2万円台から買える!

マウスコンピューター」ならWindows抜きでもPCが買える。Linuxサーバーとしての利用に最適!

トップページ

  • tarの使い方
  • rpmの使い方
  • psコマンドでプロセスを確認
  • /etc/crontabを編集してアプリを自動実行
  • chkconfigコマンドでプロセスを自動起動

メールサーバーのウイルス対策ソフト

2005年2月13日 掲載

※AntiVir MailGateは無料版の提供がなくなり、1カ月の試用だけができるようになりました。このページの情報は古くなりましたので、近日中に削除か内容の見直しを行う予定です。

 今ではどのパソコンでもウイルス対策ソフトをインストールしているだろうが、さらに念を入れてメールサーバーにウイルス対策ソフトを導入しておこう。メールサーバーを経由するメールがすべてチェックされ、ウイルスを含んだメールを通さないようにしてくれる。ウイルスによってメールを送受信できなかったときは、ユーザーにウイルスが発見されたというメールが届く。

AntiVir MailGateのインストール

 なんと無料で利用できるサーバー用のウイルス対策ソフトがある。「AntiVir MailGate」というソフトでこのページからダウンロードできる。だが、その前にこちらのページからユーザー登録を行って、個人使用のライセンスキーを手に入れよう。AntiVir MailGateは個人使用に限って無料で利用できるのだ。ライセンスキーは登録したメールアドレスあてに送られてくる。
 AntiVir MailGateのプログラムファイルは、WindowsのパソコンでダウンロードしてからFTPでサーバーに転送してもいいし、サーバーからwgetでダウンロードしてもいい。wgetを使う場合は次のようにする。ダウンロードしたファイルは展開し、インストールプログラムを使ってインストールを行う。対話式でインストールを進めていくが、赤字で示したように答えていくのがおすすめだ。

$ wget http://dl.antivir.de/dateien/antivir/release/antivir-mai
lgate-prof-2.0.2.tar.gz
--22:49:27--  http://dl.antivir.de/dateien/antivir/release/antivir-mailgate-prof
-2.0.2.tar.gz
           => `antivir-mailgate-prof-2.0.2.tar.gz'
dl.antivir.de をDNSに問いあわせています... 217.11.63.11
dl.antivir.de[217.11.63.11]:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 11,834,158 [application/x-tar]

100%[====================================>] 11,834,158   189.60K/s    ETA 00:00

22:50:28 (191.25 KB/s) - `antivir-mailgate-prof-2.0.2.tar.gz' を保存しました [11
834158/11834158]

$ tar xvzf antivir-mailgate-prof-2.0.2.tar.gz
antivir-mailgate-prof-2.0.2/
antivir-mailgate-prof-2.0.2/avmailgate/
antivir-mailgate-prof-2.0.2/avmailgate/man/
antivir-mailgate-prof-2.0.2/avmailgate/man/avmailgate.8
antivir-mailgate-prof-2.0.2/avmailgate/man/avmailgate.conf.5
antivir-mailgate-prof-2.0.2/avmailgate/doc/
  :
  :
$ su -
Password:
# cd antivir-mailgate-prof-2.0.2
# ./avinstall.pl
(使用許諾契約書が数ページにわたって表示される) 「Space」
Do you agree the LICENSE [n]y 「y」「Enter」
Shutting down processes...
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.
      Shall I create it? [y] y 「y」「Enter」

Enter the path where manual pages will be located
(default is: /usr/share/man): 「Enter」

Enter the path to your license file: 「Enter」

An automatic internet updater of AntiVir for UNIX is available.
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.

Install the automatic internet updater? [n] y 「y」「Enter」

Installing updater script to /usr/lib/AntiVir

Would you like the automatic updater to start automatically? [y] 「Enter」
Installing queuemanager script
Installing new /usr/lib/AntiVir/antivir with version: 6.29.0.2
Installing new /usr/lib/AntiVir/antivir.vdf with version: 6.29.0.1
Installing new /usr/sbin/avgated with version: 2.0.2-10+gui
Installing new /usr/sbin/avgatefwd with version: 2.0.2-10+gui
Installing config file /etc/avmailgate.conf
Installing config file /etc/antivir.conf
Installing ignore file for addressfilter /etc/avmailgate.ignore
Installing scan file for addressfilter /etc/avmailgate.scan
Installing warn file /etc/avmailgate.warn

Enter the hosts and/or domains that are local:
(default is: localhost ): 「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.0.0/24」

Installing config file /etc/avmailgate.acl

Would you like AvMailGate to start automatically? [n] y 「y」「Enter」

Installing /usr/share/man/man5/avmailgate.conf.5
Installing /usr/share/man/man8/avmailgate.8

Would you like to enable GUI support?
The GUI allows you to monitor realtime activity, view logs, and configure MailGa
te. [y] n 「n」「Enter」

AntiVir MailGate is now installed. Please read the installation
description in the directory avmailgate and follow the
instructions in INSTALL.sendmail, INSTALL.qmail,
INSTALL.postfix or INSTALL.exim.
Then start AntiVir MailGate "/usr/lib/AntiVir/avmailgate start".
#

AntiVir MailGateの設定

 AntiVir MailGateではSMTPサーバーが受信したメールをそのまま保存せずにAntiVir MailGateに転送する。そこでウイルスがないか確認し、ウイルスがなかったときにふたたびSMTPサーバーへと転送し、ユーザーのメールボックスに保存する。そのための設定がPostfixに必要となる。ちょっと面倒な作業だが、どこか一カ所でも設定を間違えるとメールの送受信ができなくなってしまう。注意深く設定を進めていこう。

  1. /etc/servicesを編集して、AntiVir MailGate用のサービスを追加する。下の3行を追加するのだが、場所はどこでもかまわない。分かりやすいようにいちばん下に追加するといいだろう。

    # Content Filter for postfix
    antivir        10024/tcp  #Port for avgated
    smtp-backdoor  10025/tcp  #Port for postfix backdoor
  2. AntiVir MailGateの設定ファイルを編集する。設定ファイルは/etc/avmailgate.confである。設定が必要なのは次の項目だ。

    # MyHostName: FQDN of the local host.
    # The default value, if not set in configuration file, is that
    # obtained by gethostname(2), or if this fails, "localhost".
    MyHostName jitaku-server.net
    
    # Select interface and port, the smtp daemon will listen on.
    # Port may be given as a number or a service name.
    ListenAddress localhost port antivir
    
    # Select how mail should be forwarded.
    # Send mail by piping it thru sendmail (this is the default)
    #ForwardTo /usr/sbin/sendmail -oem -oi
    # Or if you want the mail to be sent by SMTP
    ForwardTo SMTP: localhost port smtp-backdoor
  3. /etc/postfix/master.cfに次の記述を追加する。これもいちばん下に追加すればいい。

    # service type private unpriv chroot wakeup maxproc command + args
    # (yes) (yes) (yes) (never) (50)
    smtp     inet   n        -      n       -      -     smtpd
    
    # For AntiVir maildaemon
    localhost:smtp-backdoor inet n - n - - smtpd -o content_filter=
  4. /etc/postfix/main.cfを編集して、AntiVir MailGateのフィルタの設定を追加する。これも場所は最後でいい。

    # AntiVir MailGate
    content_filter = smtp:127.0.0.1:10024
  5. メールで受け取ったライセンスキーを/usr/lib/Antivirディレクトリにavmgate.keyという名前でコピーし、所有者をuucpに変更する。

    # cp hbedv.key /usr/lib/AntiVir/avmgate.key
    # chown uucp:uucp /usr/lib/AntiVir/avmgate.key

 ここまでの設定を終えたら、AntiVir MailGateを起動して、Postfixも再起動をかける。AntiVir MailGateの起動スクリプトは「/etc/rc.d/avgate」になるので注意してほしい。また、AntiVir MailGateを起動したときにウイルスのパターンファイル「antivir.vdf」が古いと言われたときは必ずパターンファイルのアップデートを行おう。

/usr/lib/AntiVir/avmailgate start
Initializing SMTP port. (avgated)

Warning: the file "antivir.vdf" is more than 14 days old
# /etc/rc.d/init.d/postfix restart
Postfixを停止中:                                  [  OK  ]
Postfixを起動中:                                  [  OK  ]
# /usr/lib/AntiVir/antivir --update
AntiVir / Linux Version 2.1.3-1 +gui
Copyright (c) 1994-2004 by H+BEDV Datentechnik GmbH.
All rights reserved.

Warning: the file "antivir.vdf" is more than 14 days old
checking for updates

06.29.00.01 <=> 06.29.00.119 [vdf database, loaded]
06.29.00.01 <=> 06.29.00.119 [vdf database, on-disk]
06.29.00.02 <=> 06.29.00.11 [scan engine, running]
06.29.00.02 <=> 06.29.00.11 [scan engine, on-disk]
antivir.vdf 100% |***************************| 2488 KB    7.70 KB/s   0:00 ETA
antivir 100% |*******************************|  482 KB   15.03 KB/s   0:00 ETA
06.29.00.119 <=> 06.29.00.119 [vdf database, on-disk]
06.29.00.11 <=> 06.29.00.11 [scan engine, on-disk]
reloading AntiVir mail scanner ... OK

scan engine  06.29.00.02 --> 06.29.00.11 (/usr/lib/AntiVir/antivir)
vdf database 06.29.00.01 --> 06.29.00.119 (/usr/lib/AntiVir/antivir.vdf)

AntiVir updated successfully

#

 設定の最後の仕上げとして、パターンファイルのアップデートを自動実行させる。/etc/crontabに次の一行を追加すればいい。例は毎日午前4時5分にアップデートを実行するときの設定だ。

05 4 * * * root /usr/lib/AntiVir/antivir --update -q

AntiVir MailGateの動作確認

 すべての設定が終わったら、ちゃんとウイルスが検出されるかどうかを確認してみる。このサイトではテスト用のウイルスを配布している。検証用に作られたものでウイルスとして動作するわけではないので安心してダウンロードしてほしい。
 このファイルを添付して自分のメールサーバーからほかのアドレスに送信してみる。また、反対に外部のメールサーバーから自分あてに送信してみる。どちらも自分のメールサーバーの部分でウイルスがブロックされてメールは届かない。かわりに「AntiVir ALERT」という件名の報告メールが届く。


 
掲示板 管理者のサイト トップページへ

お問い合わせや間違いのご指摘はyasu@center-left.comまでメールください。