489 views
■実現する機能
ウィルスソフトの入っていないパソコンを使うのは自殺行為です。Linux版が少ないので、毎回これを入れています。
■Clam AntiVirusのインストール
[root@ufuso ~]# yum -y install clamd ← Clam AntiVirusのインストール
Installed:
clamd.x86_64 0:0.97.3-3.el6
Dependency Installed:
clamav.x86_64 0:0.97.3-3.el6 clamav-db.x86_64 0:0.97.3-3.el6
Complete!
|
|
■Clam AntiVirus設定
[root@ufuso ~]# vi /etc/clamd.conf ← clamd設定ファイル編集
# Run as another user (clamd must be started by root for this option to work)
# Default: don't drop privileges
#User clam ← 行頭に#を付加して無効化し、root権限で動作するようにする
[root@ufuso ~]# /etc/rc.d/init.d/clamd start ← clamd起動
Starting Clam AntiVirus Daemon: LibClamAV Warning: ******************
LibClamAV Warning: *** The virus database is older than 7 days! ***
LibClamAV Warning: *** Please update it as soon as possible. ***
LibClamAV Warning: **************************************************
[ OK ]
[root@ufuso ~]# chkconfig clamd on ← clamd自動起動設定
[root@ufuso ~]# sed -i 's/Example/#Example/g' /etc/freshclam.conf ← ウィルス定義
ファイル更新機能の有効化
[root@ufuso ~]# freshclam ← ウィルス定義ファイル更新
ClamAV update process started at Wed Mar 28 13:43:10 2012
main.cvd is up to date (version: 54, sigs: 1044387, f-level: 60, builder: sven)
WARNING: getfile: daily-13811.cdiff not found on remote server (IP: 218.44.253.75)
WARNING: getpatch: Can't download daily-13811.cdiff from db.jp.clamav.net
WARNING: getfile: daily-13811.cdiff not found on remote server (IP: 219.94.128.99)
WARNING: getpatch: Can't download daily-13811.cdiff from db.jp.clamav.net
WARNING: getfile: daily-13811.cdiff not found on remote server (IP: 27.96.54.66)
WARNING: getpatch: Can't download daily-13811.cdiff from db.jp.clamav.net
WARNING: Incremental update failed, trying to download daily.cvd
Downloading daily.cvd [100%]
daily.cvd updated (version: 14712, sigs: 141182, f-level: 63, builder: guitar)
Downloading bytecode.cvd [100%]
bytecode.cvd updated (version: 168, sigs: 38, f-level: 63, builder: edwin)
Database updated (1185607 signatures) from db.jp.clamav.net (IP: 219.106.242.51)
|
|
■ウィルススキャンテスト
[root@ufuso ~]# clamscan --infected --remove --recursive ← ウィルススキャンテスト
----------- SCAN SUMMARY -----------
Known viruses: 1184296
Engine version: 0.97.3
Scanned directories: 7
Scanned files: 34
Infected files: 0 ← ウィルスゼロ
Data scanned: 1.40 MB
Data read: 1.34 MB (ratio 1.04:1)
Time: 4.983 sec (0 m 4 s)
|
|
■ウィルススキャン定期自動実行設定
[root@ufuso ~]# vi clamscan ← ウィルススキャン実行スクリプト作成
#!/bin/bash
PATH=/usr/bin:/bin
# clamd update
yum -y update clamd > /dev/null 2>&1
# excludeopt setup
excludelist=/root/clamscan.exclude
if [ -s $excludelist ]; then
for i in `cat $excludelist`
do
if [ $(echo "$i"|grep /$) ]; then
i=`echo $i|sed -e 's/^([^ ]*)/$/1/p' -e d`
excludeopt="${excludeopt} --exclude-dir=^$i"
else
excludeopt="${excludeopt} --exclude=^$i"
fi
done
fi
# signature update
freshclam > /dev/null
# virus scan
CLAMSCANTMP=`mktemp`
clamscan --recursive --remove ${excludeopt} / > $CLAMSCANTMP 2>&1
[ ! -z "$(grep FOUND$ $CLAMSCANTMP)" ] &&
# report mail send
grep FOUND$ $CLAMSCANTMP | mail -s "Virus Found in `hostname`" root
rm -f $CLAMSCANTMP
[root@ufuso ~]# chmod +x clamscan ← 実行スクリプトに実行権限付加
[root@ufuso ~]# mv clamscan /etc/cron.daily/ ← 実行スクリプトを毎日自動実行するディ
レクトリへ移動
|
|
■freshclamのトラブル対処
[root@ufuso ~]# freshclam ← ウィルス定義ファイルの更新に失敗する場合
ERROR: Can't open /var/log/clamav/freshclam.log in append mode (check permissions!).
ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).
[root@ufuso ~]# chmod -R 707 /var/log/clamav/freshclam.log ← 実行権限の再設定
[root@ufuso ~]# freshclam ← ウィルス定義ファイルの更新
ClamAV update process started at Thu Apr 19 12:20:57 2012
main.cvd is up to date (version: 54, sigs: 1044387, f-level: 60, builder: sven)
Downloading daily-14755.cdiff [100%]
Downloading daily-14756.cdiff [100%]
Downloading daily-14757.cdiff [100%]
Downloading daily-14758.cdiff [100%]
Downloading daily-14759.cdiff [100%]
Downloading daily-14760.cdiff [100%]
Downloading daily-14761.cdiff [100%]
Downloading daily-14762.cdiff [100%]
Downloading daily-14763.cdiff [100%]
Downloading daily-14764.cdiff [100%]
Downloading daily-14765.cdiff [100%]
Downloading daily-14766.cdiff [100%]
Downloading daily-14767.cdiff [100%]
Downloading daily-14768.cdiff [100%]
Downloading daily-14769.cdiff [100%]
Downloading daily-14770.cdiff [100%]
Downloading daily-14771.cdiff [100%]
Downloading daily-14772.cdiff [100%]
Downloading daily-14773.cdiff [100%]
Downloading daily-14774.cdiff [100%]
Downloading daily-14775.cdiff [100%]
Downloading daily-14776.cdiff [100%]
Downloading daily-14777.cdiff [100%]
Downloading daily-14778.cdiff [100%]
Downloading daily-14779.cdiff [100%]
Downloading daily-14780.cdiff [100%]
Downloading daily-14781.cdiff [100%]
Downloading daily-14782.cdiff [100%]
Downloading daily-14783.cdiff [100%]
Downloading daily-14784.cdiff [100%]
Downloading daily-14785.cdiff [100%]
Downloading daily-14786.cdiff [100%]
Downloading daily-14787.cdiff [100%]
Downloading daily-14788.cdiff [100%]
Downloading daily-14789.cdiff [100%]
Downloading daily-14790.cdiff [100%]
Downloading daily-14791.cdiff [100%]
Downloading daily-14792.cdiff [100%]
Downloading daily-14793.cdiff [100%]
Downloading daily-14794.cdiff [100%]
Downloading daily-14795.cdiff [100%]
Downloading daily-14796.cdiff [100%]
Downloading daily-14797.cdiff [100%]
Downloading daily-14798.cdiff [100%]
Downloading daily-14799.cdiff [100%]
Downloading daily-14800.cdiff [100%]
Downloading daily-14801.cdiff [100%]
Downloading daily-14802.cdiff [100%]
Downloading daily-14803.cdiff [100%]
Downloading daily-14804.cdiff [100%]
Downloading daily-14805.cdiff [100%]
Downloading daily-14806.cdiff [100%]
Downloading daily-14807.cdiff [100%]
Downloading daily-14808.cdiff [100%]
Downloading daily-14809.cdiff [100%]
Downloading daily-14810.cdiff [100%]
Downloading daily-14811.cdiff [100%]
Downloading daily-14812.cdiff [100%]
Downloading daily-14813.cdiff [100%]
daily.cld updated (version: 14813, sigs: 156491, f-level: 63, builder: ccordes)
bytecode.cvd is up to date (version: 168, sigs: 38, f-level: 63, builder: edwin)
Database updated (1200916 signatures) from db.jp.clamav.net (IP: 120.29.176.126)
|
|