●content_filterを利用した送受信メールのウイルススキャン

 Postfixのcontent_filterを利用した送受信メールのウイルススキャンは,下記のように「configure」時に「--enable-smtp」と「--enable-postfix」オプションを加えてインストールを行う(図2)。初期設定のポートを「10025」からほかのポート番号へ変更したい場合は,「--with-smtp-port=ポート番号」で指定する。「X-Virus-Scanned: by AMaViS perl-11」ヘッダを付加したくない場合は「--disable-x-header」をつける。

図2■送受信時にメールスキャンする
図2
送受信されるメールのウイルススキャンを行うためにcontent_filterを利用する

$ wget http://www.amavis.org/dist/perl/amavis-perl-11.tar.gz
$ tar xzvf amavis-perl-11.tar.gz
$ cd amavis-perl-11
$ ./configure --enable-smtp --enable-postfix

(中略)

** Configuration summary for amavis perl-11 2001-04-07:

Install amavis as:/usr/sbin/amavis
Configured for use with:postfix
Relay configuration:no
Enable SMTP:yes
Use SMTP port:10025
Use virus scanner(s): Sophos Sweep
Scanner runs as:vscan
Logging to syslog:yes
Quarantine directory: /var/virusmails
Max. recursion depth: 20
Add X-Virus-Scanned header: yes
Display AMaViS credits: no
Warn sender:yes
Reports sent to:virusalert
Reports sent by:postmaster

※Configuration summaryを参照し,Enable SMTP:がyesであることを確認する

To accept the above, type "make"
$ make
$ make check

PASS: config
PASS: novirus-msg
PASS: virus-msg
PASS: xheader
==================
All 4 tests passed
==================

$ su
password;
# make install

 ウイルススキャンのためのディレクトリ設定を行う。「/var」にあるamavisおよびvirusmailsの所有ユーザー,グループをvscanとし,パーミッションを確認しておく。

# cd /var
# chown -R vscan.vscan amavis virusmails
# chmod 700 amavis virusmails

 次に「/etc/postfix/」にあるPostfixの設定ファイルmain.cfとmaster.cf の編集を行う。viを起動して,main.cfには

content_filter = vscan:

master.cfには

vscanunix- n n - 10 pipe user=vscan
argv=/usr/sbin/amavis ${sender} ${recipient}
localhost:10025 inetn-n--smtpd
-o content_filter=

をそれぞれ追加して保存する。そして

# /usr/postfix/bin/postfix reload

とし,Postfixを再起動させて変更を反映させれば,送受信メールのウイルススキャンが可能になる。

PREV 4/5 NEXT