●Qmail Scannerのインストール

 Qmail Scannerをインストールするためには,あらかじめリスト1のツールを導入しておく必要がある。ここではQmail本体およびunzipについては,すでにインストールされている前提で解説するが,Qmail Scannerを導入するためには,Qmailにパッチをあてて再コンパイルする必要がある。それについては後述する。

リスト1■Qmail Scannerをインストールするために必要なツール

・Qmailhttp://www.qmail.org/
・アンチウイルスソフト
(ここでは前回インストールしたSophos Anti Virusを利用する)
・unzip
・Perl 5.005_03+以上
・reformime(MailDrop 1.3.7よりインストール)
・Time::HiRes(Perlモジュール)
・TNEF
(application/ms-tnef MIME添付ファイルのデコードに使用する)

・reformimeのインストール

 Qmail Scannerのインストールには,メールフィルタ「MailDrop」からメールの添付ファイルを展開するために「reformime」が必要になる。ここでは「MailDrop」はインストールせず,reformimeのみを「/usr/local/bin」にコピーする。

$ wget http://download.sourceforge.net/courier/maildrop-1.3.7.tar.gz
$ tar xzvf maildrop-1.3.7.tar.gz
$ cd maildrop-1.3.7
$ ./configure
$ make
$ su
Password:(パスワードを入力)
# cp ./rfc2045/reformime /usr/local/bin

・Time::HiResのインストール

 次にPerlモジュールの「Time::HiRes」をインストールする。PerlモジュールはCPANから入手できる。

$ wget http://www.cpan.org/modules/by-module/Time/Time-HiRes-01.20.tar.gz
$ tar xzvf Time-HiRes-01.20.tar.gz
$ cd Time-HiRes-01.20
$ perl Makefile.PL
$ make
$ make test
$ su
Password:(パスワードを入力)
# make install

※「# perl -e 'use CPAN; install Time::HiRes'」でもインストールできる

 なお,インストールされているPerlのバージョンは「Perl 5.005_03+」以上である必要があるので,あらかじめ「perl -v」コマンドで確認しておこう。

$ perl -v

This is perl, v5.6.0 built for i386-linux

Copyright 1987-2000, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.

・TNEFのインストール

 引き続き,TNEFをインストールする。

$ wget http://world.std.com/~damned/tnef-1.1.1.tar.gz
$ tar xvzf tnef-1.1.1.tar.gz
$ cd tnef-1.1.1
$ ./configure
$ make
$ su
Password:(パスワードを入力)
# make install

・Qmailにパッチをあて再コンパイル

 最後に,Qmailにqmailqueue-patchをあてて再コンパイルする。事前にQmailを停止してからmake setupを行えばよい。

$ wget http://cr.yp.to/software/qmail-1.03.tar.gz
$ tar xvzf qmail-1.03.tar.gz
$ wget http://www.qmail.org/qmailqueue-patch
$ cd qmail-1.03
$ patch < ../qmailqueue-patch
patching file Makefile
patching file qmail.c
$ su
Password:(パスワードを入力)
# make setup

・Qmail Scanner本体のインストール

 Qmail Scannerのインストールは,「--install」オプションをつけて行えば,対話形式でのインストールが開始される。ウイルスに感染したメールをスキャンした際に,サーバ名や通知先(root)は自動的に設定される。デフォルト以外のものに,通知する宛先やドメイン名を指定する場合は「--admin」および「--domain」をつけてインストールする。

 まず,perlスクリプトをsetuidで実行できるようにするため,下記のように設定を行う。

# chown root /usr/bin/suidperl
# chmod 4711 /usr/bin/suidperl

 そして,Qmail Scannerをインストールする。

$ wget http://prdownloads.sourceforge.net/qmail-scanner/qmail-scanner-1.01.tgz
$ tar zxvf qmail-scanner-1.01.tgz
$ cd qmail-scanner-1.01
$ su
Password:(パスワードを入力)
# ./configure --install

※もしくは./configure --admin 管理者アドレス --domain ドメイン名 --install とすればよい。
例:./configure --admin root --domain example.com --install

 「--install」オプションにより,以下のように問いに答えながら対話形式でインストールすることが可能だ。

Qmail-Scanner doesn't have language translations for ja_JP.eucJP,
- so defaulting to english...

[Hit <RETURN> to continue] ←リターンキーを押す

This script will search your system for the virus scanners it knows
about, and will ensure that all external programs
qmail-scanner-queue.pl uses are explicitly pathed for performance
reasons.

It will then generate qmail-scanner-queue.pl - it is up to you to install it
correctly.

Continue? ([Y]/N) ←「y」を選択

/usr/bin/uudecode works as expected on system...

The following binaries and scanners were found on your system:

reformime=/usr/local/bin/reformime
uudecode=/usr/bin/uudecode
unzip=/usr/bin/unzip
tnef=/usr/local/bin/tnef

Content/Virus Scanners installed on your System

sweep=/usr/local/bin/sweep

Qmail-Scanner details.

log-details=0
fix-mime=1
debug=1
notify=sender,admin
virus-admin=root@example.com
local-domains='example.com'
scanners="sweep_scanner"

If that looks correct, I will now generate qmail-scanner-queue.pl
for your system...

Continue? ([Y]/N) ←「y」を選択

Hit RETURN to create initial directory structure under /var/spool/qmailscan,
and install qmail-scanner-queue.pl under /var/qmail/bin:

 ここでリターンキーを押すとqmail-scanner-queue.plが「/var/qmail/bin」以下にインストールされる。

perlscanner: generate new DB file
perlscannner: total of 6 entries.

Finished installation of initial directory structure for Qmail-Scanner
under /var/spool/qmailscan and qmail-scanner-queue.pl under /var/qmail/bin.

Finished. Please read README(.html) and then go over the script
(/var/qmail/bin/qmail-scanner-queue.pl) to check paths/etc.

"/var/qmail/bin/qmail-scanner-queue.pl -r" should return some well-known virus
definitions to show that the internal perlscanner component is working.

That's it!

〜(以下省略)〜

・Qmail起動スクリプトの編集

 Qmail起動スクリプト(/etc/rc.d/init.d/qmailなど)に,リスト2の部分を追加し編集する。編集が終わったらQmailを再起動する。

リスト2■起動スクリプトに加える部分

echo -n "qmail-smtpd, "
QMAILQUEUE="/var/qmail/bin/qmail-scanner-queue.pl" export QMAILQUEUE

PREV 2/6 NEXT