LoginSignup
10
11

More than 5 years have passed since last update.

CentOS 6.5にClamAVをインストしてみた

Last updated at Posted at 2014-03-28

Linuxでもトロイの木馬やウイルスを仕込まれる可能性あるので、OSSのウイルススキャンソフトであるClamAVを入れてみました。
まあこのへんの記事の焼き直しなんですが。

0. 環境

CentOS 6.5(x64)

1. インストール

yum使ってClamAVを入れます。

# yum install clamav
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * epel: ftp.kddilabs.jp
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package clamav.x86_64 0:0.98.1-1.el6 will be installed
--> Processing Dependency: clamav-db = 0.98.1-1.el6 for package: clamav-0.98.1-1.el6.x86_64
--> Running transaction check
---> Package clamav-db.x86_64 0:0.98.1-1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================
 Package                    Arch                    Version                       Repository             Size
==============================================================================================================
Installing:
 clamav                     x86_64                  0.98.1-1.el6                  epel                  1.3 M
Installing for dependencies:
 clamav-db                  x86_64                  0.98.1-1.el6                  epel                   77 M

Transaction Summary
==============================================================================================================
Install       2 Package(s)

Total download size: 79 M
Installed size: 81 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): clamav-0.98.1-1.el6.x86_64.rpm                                                  | 1.3 MB     00:00
(2/2): clamav-db-0.98.1-1.el6.x86_64.rpm                                               |  77 MB     00:04
--------------------------------------------------------------------------------------------------------------
Total                                                                          15 MB/s |  79 MB     00:05
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : clamav-db-0.98.1-1.el6.x86_64                                                              1/2
  Installing : clamav-0.98.1-1.el6.x86_64                                                                 2/2
  Verifying  : clamav-0.98.1-1.el6.x86_64                                                                 1/2
  Verifying  : clamav-db-0.98.1-1.el6.x86_64                                                              2/2

Installed:
  clamav.x86_64 0:0.98.1-1.el6

Dependency Installed:
  clamav-db.x86_64 0:0.98.1-1.el6

Complete!
#

EPELからサクッとインスト完了しましたね。

2. データベースファイル更新

次にウイルス検知するための情報が入ったDBファイルを更新しましょう。

# freshclam
ClamAV update process started at Fri Mar 28 17:22:56 2014
Downloading main.cvd [100%]
main.cvd updated (version: 55, sigs: 2424225, f-level: 60, builder: neo)
Downloading daily.cvd [100%]
daily.cvd updated (version: 18706, sigs: 857466, f-level: 63, builder: neo)
Downloading bytecode.cvd [100%]
bytecode.cvd updated (version: 236, sigs: 43, f-level: 63, builder: dgoddard)
Database updated (3281734 signatures) from db.jp.clamav.net (IP: 203.178.137.175)

freshclamコマンドで下記のファイルがDLされましたね。

# file /var/lib/clamav/*
/var/lib/clamav/bytecode.cvd: Clam AntiVirus database 05 Feb 2014 12-36 -0500, version 236, gzipped
/var/lib/clamav/daily.cvd:    Clam AntiVirus database 27 Mar 2014 11-01 -0400, version 1870, gzipped
/var/lib/clamav/main.cvd:     Clam AntiVirus database 17 Sep 2013 10-57 -0400, version 55, gzipped
/var/lib/clamav/mirrors.dat:  data

ClamAVのサイト↓とはversionが違ってちょっと不安がよぎりますが、単にfileコマンドの出力が欠けているようで、タイムスタンプは一致しているので良しとしましょう。(hash値もあったらいいのに)

Clipboard01.gif

3. ウイルススキャン!

# clamscan -ri /root

----------- SCAN SUMMARY -----------
Known viruses: 3276337
Engine version: 0.98.1
Scanned directories: 563
Scanned files: 2853
Infected files: 0
Data scanned: 30.21 MB
Data read: 30.04 MB (ratio 1.01:1)
Time: 12.288 sec (0 m 12 s)

手動だとclamscanコマンドでスキャンできます。-rオプションで指定したディレクトリ配下の子ディレクトリを再帰的にチェクしてくれるようです。

freshclamを自動実行したり、ウイルススキャン処理はデーモン化することもできるようですが、それはまた今度追ってみます。

ではでは。

10
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
11