Clamでウィルス対策(メール編)
2006年03月03日 13:36:27
シジミを使った料理でメールにひそむウィルスを調理。クラムチャウダとか日本人ならやっぱりしじみの味噌汁が最高!ハマグリならやはり「その手は桑名の焼きハマグリ」でしょうか!
という事でClam AntiVirusの導入です。しんぱいはClamなやつでウィルス見つけても口を割らないかも?SPAM(スパム)ポークランチョンミートに続く食べ物対策シリーズ第2弾です。
まずはパッケージの確認
gentooez8 ~ # emerge -pv clamav
These are the packages that I would merge, in order:
Calculating dependencies ...done!
[ebuild N ] dev-libs/gmp-4.1.4-r3 -doc -nocxx 1,641 kB
[ebuild N ] app-antivirus/clamav-0.88 +crypt -mailwrapper +milter (-selinux) 4,457 kB
Total size of downloads: 6,099 kB
sendmailで使うためにUSEにmilterを追加します。それにしてもなぜGMPがついてくるのか?
GMP(GNU multiple precision arithmetic library)てなことで何桁もの円周率の計算を早くやってくれる数値計算ライブラリなのですが(それだけじゃないですけど) ではインストール
gentooez8 ~ # emerge clamav
clamd定義ファイルの確認
gentooez8 ~ # vi /etc/clamd.conf
メールのチェックが目的なのでもちろんこの辺りを修正
@@ -201,7 +201,7 @@
# Enable internal e-mail scanner.
# Default: enabled
- #ScanMail
# If an email contains URLs ClamAV can download and scan them.
# WARNING: This option may open your system to a DoS attack.
gentooez8 ~ # vi /etc/conf.d/clamd
# Config file for /etc/init.d/clamd
# NOTICE: Since clamav-0.85-r1, only START_CLAMD and START_FRESHCLAM settings
# are used, other are silently ignored
START_CLAMD=yes
START_FRESHCLAM=yes
#(UPDATE 2006-03-02 H.COYAMA)
#START_MILTER=no sendmailでフィルタ掛けるのでyesにします。
START_MILTER=yes
MILTER_SOCKET="/var/run/clamav/clmilter.sock"
MILTER_OPTS="-m 10 --timeout=0"
sendmailの設定
gentooez8 ~ # vi /etc/mail/sendmail.mc
こんなのを追加しなさいと
INPUT_MAIL_FILTER(`clmilter',`S=local:/var/run/clamav/clmilter.sock, F=, T=S:4m;R:4m')dnl
define(`confINPUT_MAIL_FILTERS', `clmilter')dnl
そしてCFの作成
gentooez8 ~ # cd /etc/mail
gentooez8 mail # m4 sendmail.mc > sendmail.cf
デーモンの起動
gentooez8 mail # /etc/init.d/clamd start
gentooez8 mail # /etc/init.d/sendmail restart
これも忘れずに
gentooez8 mail # rc-update -a clamd default
そんじゃテストしてみよう
まず普通にメールを送ってみるとLOGにはこんなのが残されていますね。
Mar 2 14:19:29 gentooez8 sm-mta[14134]: k225JSnB014134: from=
Mar 2 14:19:29 gentooez8 sm-mta[14134]: k225JSnB014134: Milter add: header: X-Virus-Scanned: ClamAV 0.88/1308/Wed Mar 1 19:13:39 2006 on gentooez8.momoso-net.com
Mar 2 14:19:29 gentooez8 sm-mta[14134]: k225JSnB014134: Milter add: header: X-Virus-Status: Clean
Mar 2 14:19:36 gentooez8 sm-mta[14136]: k225JSnB014134: to=
送られてきたメールヘッダには
X-Virus-Scanned: ClamAV 0.88/1308/Wed Mar 1 19:13:39 2006 on gentooez8.momoso-net.com
X-Virus-Status: Clean
OKってことでしょうか。
次に無害なウィルスをダウンロードしてこのへんにあるのでそれを添付して送ってみる。ちなみに自分以外に送っちゃだめですよ。絶対!!!
でもAVGとかインストールしているPCからは送れません。ちゃんとブロックしてますからね〜!
残されたLOGは
Mar 2 14:49:45 gentooez8 sm-mta[14455]: k225niCO014455: from=
=<44068776.1090501@xxxxxxxx.xxxxxxxx.jp>, proto=ESMTP, daemon=MTA, relay=xxxxxxxx.xxxxxxxx.xx.jp [xxx.xxx.xxx.xxx]
Mar 2 14:49:45 gentooez8 sm-mta[14455]: k225niCO014455: Milter add: header: X-Virus-Scanned: ClamAV 0.88/1308/Wed Mar 1 19:
13:39 2006 on gentooez8.momoso-net.com
Mar 2 14:49:45 gentooez8 sm-mta[14455]: k225niCO014455: Milter add: header: X-Virus-Status: Infected with Eicar-Test-Signatu
re
Mar 2 14:49:45 gentooez8 sendmail[14458]: k225nj4c014458: from=clam宛, size=346, class=0, nrcpts=2, msgid=<200603020549.k225
nj4c014458@gentooez8.momoso-net.com>, relay=clam宛@localhost
Mar 2 14:49:45 gentooez8 sm-mta[14462]: STARTTLS=server, relay=localhost.localdomain [127.0.0.1], version=TLSv1/SSLv3, verif
y=NO, cipher=DHE-RSA-AES256-SHA, bits=256/256
Mar 2 14:49:45 gentooez8 sendmail[14458]: STARTTLS=client, relay=[127.0.0.1], version=TLSv1/SSLv3, verify=FAIL, cipher=DHE-R
SA-AES256-SHA, bits=256/256
Mar 2 14:49:45 gentooez8 sm-mta[14462]: k225njHJ014462: from=
msgid=<200603020549.k225nj4c014458@gentooez8.momoso-net.com>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.
1]
Mar 2 14:49:45 gentooez8 sendmail[14458]: k225nj4c014458: to=
), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=60346, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (k225njHJ014
462 Message accepted for delivery)
Mar 2 14:49:45 gentooez8 sm-mta[14455]: k225niCO014455: Milter: data, reject=554 5.7.1 virus Eicar-Test-Signature detected b
y ClamAV - http://www.clamav.net
Mar 2 14:49:45 gentooez8 sm-mta[14455]: k225niCO014455: to=
Eicar-Test-Signature detected by ClamAV - http://www.clamav.net
Mar 2 14:49:51 gentooez8 sm-mta[14464]: k225njHJ014462: to=
お〜Eicar-Test-Signature detected by ClamAVの文章が!すばらしい。
そこで送られてきたメールの内容は
From - Thu Mar 02 14:57:07 2006
X-Account-Key: account2
X-UIDL: H0p!!hPE!!8A<"!ACn!!
X-Mozilla-Status: 0001
X-Mozilla-Status2: 00000000
Return-Path:
X-Spam-Checker-Version: SpamAssassin 3.1.0-gr0 (2005-09-13) on
gentooez8.momoso-net.com
X-Spam-Level: *
X-Spam-Status: No, score=1.8 required=5.0 tests=ALL_TRUSTED,AWL,
NO_DNS_FOR_FROM,NO_REAL_NAME autolearn=no version=3.1.0-gr0
Received: from gentooez8.momoso-net.com (localhost.localdomain [127.0.0.1])
by gentooez8.momoso-net.com (SMTP) with ESMTP id k225njHJ014462;
Thu, 2 Mar 2006 14:49:45 +0900
Received: (from clamさん@localhost)
by gentooez8.momoso-net.com (8.13.4/8.13.4/Submit) id k225nj4c014458;
Thu, 2 Mar 2006 14:49:45 +0900
Date: Thu, 2 Mar 2006 14:49:45 +0900
Message-Id: <200603020549.k225nj4c014458@gentooez8.momoso-net.com>
From: MAILER-デーモンさん@momoso-net.com
To: ポストマスターさん@gentooez8.momoso-net.com
Cc:
Auto-Submitted: auto-submitted (antivirus notify)
X-Infected-Received-From: xxxxxxxx.xxxxxxxx.xx.jp [xxx.xxx.xxx.xxx]
Subject: Virus intercepted
X-UIDL: H0p!!hPE!!8A<"!ACn!!
Status: U
X-Antivirus: AVG for E-mail 7.1.375 [268.1.1/272]
A message sent from
contained Eicar-Test-Signature and has not been delivered.
MAILER-デーモンさんからxxxxxxxx@xxxxxxxx.xx.jpのメールはやらへんで。なんかムカツクメールが届きました。
それから送った相手にはこんなメールが届くのです。
From - Thu Mar 02 15:04:13 2006
X-Account-Key: account2
X-UIDL: 440687d900000001
X-Mozilla-Status: 0001
X-Mozilla-Status2: 10000000
Return-Path:
Received: from localhost (localhost)
by xxxxxxxx.xxxxxxxx.xx.jp (SMTP) id k225nkA06204;
Thu, 2 Mar 2006 14:49:46 +0900
Date: Thu, 2 Mar 2006 14:49:46 +0900
From: Mail Delivery Subsystem
Message-Id: <200603020549.k225nkA06204@xxxxxxxx.xxxxxxxx.xx.jp>
To:
Subject: Returned mail: see transcript for details
Auto-Submitted: auto-generated (failure)
Status: O
X-Antivirus: AVG for E-mail 7.1.375 [268.1.1/272]
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="=======AVGMAIL-44068ADD3973======="
- =======AVGMAIL-44068ADD3973=======
- k225nkA06204.1141278586/xxxxxxxx.xxxxxxxx.xx.jp
The original message was received at Thu, 2 Mar 2006 14:49:43 +0900
from xxxxxxxx.xxxxxxxx.xx.jp [xxx.xxx.xxx.xxx]
----- The following addresses had permanent fatal errors -----
(reason: 554 5.7.1 virus Eicar-Test-Signature detected by ClamAV - http://www.clamav.net)
----- Transcript of session follows -----
... while talking to gentooez8.momoso-net.com.:
>>> >>> DATA
<<< 554 5.7.1 virus Eicar-Test-Signature detected by ClamAV - http://www.clamav.net
554 5.0.0 Service unavailable
- k225nkA06204.1141278586/xxxxxxxx.xxxxxxxx.xx.jp
ちょっと長いので省略します。送ったテキスト文なんかも書かれています。
大事なのは-----でかこまれている文章ですね。内容は・・・・・・・・
「メールを送った相手は天然パーマだった。」実際に当たってるがそんなことは書かれていない。
相手のメール管理者が「ClamAVって貝ヤローがウィルスだと判断したので届けずに破棄したぜ!」ごめんよ
みたいなことが書いてあればわかるのにね!
まあそんなこんなでとりあえず導入完了しにます。
焼きハマグリが食いたい。3月だけどまだ大丈夫かな?食べそこなうと秋まで食べれないよね。卵産んでるやつなんか食べたひにゃ〜 キャー助けてーって事になりますからね。