アンチウィルスソフトの導入。

今や常識となりつつあるウィルス検知ソフトを導入する。

Clam AntiVirusはシグネチャによるパターンマッチング方式を採用しており、2006年12月27日の時点で約85,000種類のウイルスに対応する、GPLライセンスに従って利用することができるオープンソースのソフトウェアだ。
qmailやpostfix、sendmailなどと連携してウィルス検知を行うこともできる。

Clam AntiVirusが導入されているかを調べる。

# yum list clamav
Loading "installonlyn" plugin
Setting up repositories
core                      100% |=========================| 1.1 kB    00:00
updates                   100% |=========================| 1.2 kB    00:00
extras                    100% |=========================| 1.1 kB    00:00
Reading repository metadata in from local files
Available Packages
clamav.i386                              0.88.7-1.fc6           extras

<

p>一見「インストールされているのかな?」と思ってしまうかもしれないが、clamav.i386の行の一番右側を見ると「extras」となっており、インストールされていないことがわかる。

(インストールされている場合は、「extras」ではなく「installed」となる。)

インストールされている場合は、次の手順まで読み進む。

インストールされていない場合は、下記のようにyumを利用してインストールする。

「yum -y install clamav」と入力することで、途中の「Is this ok [y/N]: y」部分での入力が不要になる。

# yum install clamav
Loading "installonlyn" plugin
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for clamav to pack into transaction set.
clamav-0.88.7-1.fc6.i386. 100% |=========================|  20 kB    00:00
---> Package clamav.i386 0:0.88.7-1.fc6 set to be updated
--> Running transaction check
--> Processing Dependency: data(clamav) for package: clamav
--> Processing Dependency: clamav-lib = 0.88.7-1.fc6 for package: clamav
--> Processing Dependency: libclamav.so.1 for package: clamav
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for clamav-lib to pack into transaction set.
clamav-lib-0.88.7-1.fc6.i 100% |=========================|  17 kB    00:00
---> Package clamav-lib.i386 0:0.88.7-1.fc6 set to be updated
---> Downloading header for clamav-data to pack into transaction set.
clamav-data-0.88.7-1.fc6. 100% |=========================|  18 kB    00:00
---> Package clamav-data.i386 0:0.88.7-1.fc6 set to be updated
--> Running transaction check
--> Processing Dependency: fedora-usermgmt for package: clamav-data
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for fedora-usermgmt to pack into transaction set.
fedora-usermgmt-0.8.91-1. 100% |=========================| 5.2 kB    00:00
---> Package fedora-usermgmt.noarch 0:0.8.91-1.fc6 set to be updated
--> Running transaction check
--> Processing Dependency: instance(fedora-usermgmt) for package: fedora-usermgmt
--> Processing Dependency: fedora-usermgmt-core = 0.8.91-1.fc6 for package: fedora-usermgmt
--> Processing Dependency: setup(fedora-usermgmt) for package: fedora-usermgmt
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for fedora-usermgmt-shadow-utils to pack into transaction set.
fedora-usermgmt-shadow-ut 100% |=========================| 6.7 kB    00:00
---> Package fedora-usermgmt-shadow-utils.noarch 0:0.8.91-1.fc6 set to be updated
---> Downloading header for fedora-usermgmt-core to pack into transaction set.
fedora-usermgmt-core-0.8. 100% |=========================| 5.8 kB    00:00
---> Package fedora-usermgmt-core.noarch 0:0.8.91-1.fc6 set to be updated
---> Downloading header for fedora-usermgmt-default-fedora-setup to pack into transaction set.
fedora-usermgmt-default-f 100% |=========================| 6.0 kB    00:00
---> Package fedora-usermgmt-default-fedora-setup.noarch 0:0.8.91-1.fc6 set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 clamav                  i386       0.88.7-1.fc6     extras            599 k
Installing for dependencies:
 clamav-data             i386       0.88.7-1.fc6     extras            7.4 M
 clamav-lib              i386       0.88.7-1.fc6     extras            163 k
 fedora-usermgmt         noarch     0.8.91-1.fc6     extras            6.6 k
 fedora-usermgmt-core    noarch     0.8.91-1.fc6     extras            7.6 k
 fedora-usermgmt-default-fedora-setup  noarch     0.8.91-1.fc6     extras            6.5 k
 fedora-usermgmt-shadow-utils  noarch     0.8.91-1.fc6     extras            7.4 k

Transaction Summary
=============================================================================
Install      7 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 8.1 M
Is this ok [y/N]: y
Downloading Packages:
(1/7): clamav-data-0.88.7 100% |=========================| 7.4 MB    00:20
(2/7): fedora-usermgmt-0. 100% |=========================| 6.6 kB    00:00
(3/7): clamav-lib-0.88.7- 100% |=========================| 163 kB    00:00
(4/7): clamav-0.88.7-1.fc 100% |=========================| 599 kB    00:01
(5/7): fedora-usermgmt-sh 100% |=========================| 7.4 kB    00:00
(6/7): fedora-usermgmt-co 100% |=========================| 7.6 kB    00:00
(7/7): fedora-usermgmt-de 100% |=========================| 6.5 kB    00:00
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: fedora-usermgmt-default-fedo ######################### [1/7]
  Installing: fedora-usermgmt-core         ######################### [2/7]
  Installing: fedora-usermgmt-shadow-utils ######################### [3/7]
  Installing: fedora-usermgmt              ######################### [4/7]
  Installing: clamav-data                  ######################### [5/7]
  Installing: clamav-lib                   ######################### [6/7]
  Installing: clamav                       ######################### [7/7]

Installed: clamav.i386 0:0.88.7-1.fc6
Dependency Installed: clamav-data.i386 0:0.88.7-1.fc6 clamav-lib.i386 0:0.88.7-1.fc6 fedora-usermgmt.noarch 0:0.8.91-1.fc6 fedora-usermgmt-core.noarch 0:0.8.91-1.fc6 fedora-usermgmt-default-fedora-setup.noarch 0:0.8.91-1.fc6 fedora-usermgmt-shadow-utils.noarch 0:0.8.91-1.fc6
Complete!

本体のインストールが終了したら、パターンファイルのアップデートなどを行うためのファイルが入ったパッケージのインストールを行う。

# yum install clamav-update
Loading "installonlyn" plugin
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for clamav-update to pack into transaction set.
clamav-update-0.88.7-1.fc 100% |=========================|  19 kB    00:00
---> Package clamav-update.i386 0:0.88.7-1.fc6 set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 clamav-update           i386       0.88.7-1.fc6     extras             47 k

Transaction Summary
=============================================================================
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 47 k
Is this ok [y/N]: y
Downloading Packages:
(1/1): clamav-update-0.88 100% |=========================|  47 kB    00:00
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: clamav-update                ######################### [1/1]

Installed: clamav-update.i386 0:0.88.7-1.fc6
Complete!

インストールが完了したら、パターンファイル更新用のコンフィグファイルを編集し、更新ができる状態にする。

# sed -i 's/^Example/#Example/g' /etc/freshclam.conf
# sed -i 's/^FRESHCLAM/#FRESHCLAM/g' /etc/sysconfig/freshclam

パターンファイルを更新する。

# freshclam
ClamAV update process started at Wed Dec 27 17:04:15 2006
main.cvd is up to date (version: 41, sigs: 73809, f-level: 10, builder: tkojm)
daily.cvd is up to date (version: 2382, sigs: 11567, f-level: 9, builder: ccordes)

「ERROR: Clamd was NOT notified: Can’t connect to clamd on 127.0.0.1:3310」とエラーが表示される場合は、下記のコマンドを実行する。

# sed -i 's/^NotifyClamd/#NotifyClamd/g' /etc/freshclam.conf

スクリプトを作成し、ウィルスの検知が簡単に行えるように設定を行う。

# mkdir /root/mainte
# vi /root/mainte/clamav.sh
#!/bin/bash

PATH=/usr/bin:/bin
freshclam > /dev/null
clamscan --recursive --remove / | grep FOUND$

# chmod 755 /root/mainte/clamav.sh
# vi /etc/cron.d/clamav
00 05 * * * root /root/mainte/clamav.sh

これで毎日、午前5時にチェックするように設定ができた。

00の部分が、分、05の部分が時を表しているので、環境によって変えても良い。

*の後ろに書いてあるrootは実行するユーザの名前だが、clamavは読み込めないファイルがあると困るため、rootとする。

crondを利用した場合、標準出力があると実行したユーザ宛てに標準出力をメールで送信するため、この設定では、aideで検知した内容はroot宛てにメールで飛ぶようになっている。

関連記事

  1. NO IMAGE

    2007.11.06

    荷物が!
  2. NO IMAGE
  3. NO IMAGE

    2010.08.20

    1Password購入。
  4. NO IMAGE

コメントをお待ちしております

CALENDAR

2024年4月
 123456
78910111213
14151617181920
21222324252627
282930  

ARCHIVES

CATEGORIES