2016年3月21日月曜日

Calm もとい Clamshell もとい Clam をインストールできるかメモ

ド無知でド素人で誤3野郎による、初めてのおつかいシリーズです。


OXY NOTES さんから
無料で使えるLinuxのアンチウイルスソフト[Clam AntiVirus]の導入と設定の解説
http://oxynotes.com/?p=9731

こちら様の例は約2年前のことなので、直近ならあるいはひょっとして? と標準リポジトリで探してみると、


======================================================== Matched: clamd ========================================================
clamav-scanner.noarch : Clamav scanner daemon
clamav-server.x86_64 : Clam Antivirus scanner server
nagios-plugins-tcp.x86_64 : Nagios Plugin - check_tcp

それらしいものがあるにはあるが、同じかどうかわからない。また、clamavで探してみると

===================================================== N/S matched: clamav ======================================================
clamav-filesystem.noarch : Filesystem structure for clamav
clamav-milter-systemd.noarch : Systemd initscripts for the clamav sendmail-milter
clamav-milter-sysvinit.noarch : SysV initscripts for the clamav sendmail-milter
clamav-scanner.noarch : Clamav scanner daemon
clamav-scanner-systemd.noarch : Systemd initscripts for clamav scanner daemon
clamav-scanner-sysvinit.noarch : SysV initscripts for clamav scanner daemon
clamav-server-systemd.noarch : Systemd initscripts for clamav server
clamav-server-sysvinit.noarch : SysV initscripts for clamav server
clamav-unofficial-sigs.noarch : Scripts to download unoffical clamav signatures
clamav.x86_64 : End-user tools for the Clam Antivirus scanner
clamav-data.noarch : Virus signature data for the Clam Antivirus scanner
clamav-data-empty.noarch : Empty data package for the Clam Antivirus scanner
clamav-devel.x86_64 : Header files and libraries for the Clam Antivirus scanner
clamav-lib.x86_64 : Dynamic libraries for the Clam Antivirus scanner
clamav-milter.x86_64 : Milter module for the Clam Antivirus scanner
clamav-server.x86_64 : Clam Antivirus scanner server
clamav-update.x86_64 : Auto-updater for the Clam Antivirus scanner data-files

  Name and summary matches only, use "search all" for everything.


さて、これは困った。いろいろ探した結果、こちら様の例から

はじめての自宅サーバ構築 - Fedora/CentOS -
http://kajuhome.com/clam_antivirus.shtml


もっともシンプル?な単体動作の例らしき手順をならってみることにする。併せて参考にするのはこちら。

Clamav
http://www.clamav.net/documents/installing-clamav



assume
http://ejje.weblio.jp/content/assume

compilation
http://ejje.weblio.jp/content/compilation

かmぴれぃしゃn

それから milterとは何かと思えば、これのようで。
http://milter-manager.sourceforge.net/reference/ja/introduction.html

これは管理ツールであってそのものではないが、なるほどそういうことですかと。


# yum install clamav

# yum install clamav-update

後者の導入が必要であったかどうかは、かなりアヤシイ。続いて

# vi /etc/freshclam.conf

において

# Comment or remove the line below.
#Example

コメント記号追加。 続いて定義ファイルのアップデートだが



# freshclam
ClamAV update process started at Tue Mar 21 21:44:52 2016
WARNING: Your ClamAV installation is OUTDATED!
WARNING: Local version: 0.99 Recommended version: 0.99.1
DON'T PANIC! Read http://www.clamav.net/support/faq
Empty script main-56.cdiff, need to download entire database
Downloading main.cvd [100%]
main.cvd updated (version: 57, sigs: 4218790, f-level: 60, builder: amishhammer)
WARNING: getfile: daily-21124.cdiff not found on remote server (IP: 218.44.253.75)
WARNING: getpatch: Can't download daily-21124.cdiff from database.clamav.net
WARNING: getfile: daily-21124.cdiff not found on remote server (IP: 219.94.128.99)
WARNING: getpatch: Can't download daily-21124.cdiff from database.clamav.net
WARNING: getfile: daily-21124.cdiff not found on remote server (IP: 203.212.42.128)
WARNING: getpatch: Can't download daily-21124.cdiff from database.clamav.net
WARNING: Incremental update failed, trying to download daily.cvd
Downloading daily.cvd [100%]
daily.cvd updated (version: 21467, sigs: 83892, f-level: 63, builder: amishhammer)
Downloading bytecode.cvd [100%]
bytecode.cvd updated (version: 275, sigs: 45, f-level: 63, builder: amishhammer)
Database updated (4302727 signatures) from database.clamav.net (IP: 27.96.54.66)
#

インクリメンタルな更新には失敗したようだ。次に、定期更新の設定を先人の例にならって。


# vi /root/clamav.sh
#
# chmod 700 /root/clamav.sh
#
# crontab -e
no crontab for root - using an empty one
crontab: installing new crontab
#

変更内容は先人の方々を参照のこと。次にスキャン。


# clamscan --log=/var/log/clamav.log --infected --remove --recursive /home/linux/
/home/linux/: No such file or directory
WARNING: /home/linux/: Can't access file


----------- SCAN SUMMARY -----------
Known viruses: 4297364
Engine version: 0.99
Scanned directories: 0
Scanned files: 0
Infected files: 0
Data scanned: 0.00 MB
Data read: 0.00 MB (ratio 0.00:1)
Time: 12.124 sec (0 m 12 s)


あ、そんなディレクトリないのにダメじゃん。しかしこの点を修正しても、

# clamscan --log=/var/log/clamav.log --infected --remove --recursive /home/

----------- SCAN SUMMARY -----------
Known viruses: 4297364
Engine version: 0.99
Scanned directories: 143
Scanned files: 735
Infected files: 0
Data scanned: 103.08 MB
Data read: 53.47 MB (ratio 1.93:1)
Time: 29.493 sec (0 m 29 s)

えーと、秒殺ってなんで!?

あ、リカーシブで指定した先が検索対象ということかなるほどそりゃ秒殺だわ。次に、ウィルス検出テストについて。こちらも先人の方の例のとおりに。

# wget -P /home/ http://www.eicar.org/download/eicar.com
--2016-03-21 22:30:29--  http://www.eicar.org/download/eicar.com
Resolving www.eicar.org (www.eicar.org)... 188.40.238.250
Connecting to www.eicar.org (www.eicar.org)|188.40.238.250|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 68 [application/octet-stream]
Saving to: ‘/home/eicar.com’

100%[======================================================================================>] 68          --.-K/s   in 0s

2016-03-22 01:30:29 (5.91 MB/s) - ‘/home/eicar.com’ saved [68/68]

#
# wget -P /home/ http://www.eicar.org/download/eicarcom2.zip
--2016-03-21 22:30:53--  http://www.eicar.org/download/eicarcom2.zip
Resolving www.eicar.org (www.eicar.org)... 188.40.238.250
Connecting to www.eicar.org (www.eicar.org)|188.40.238.250|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 308 [application/octet-stream]
Saving to: ‘/home/eicarcom2.zip’

100%[======================================================================================>] 308         --.-K/s   in 0s

2016-03-21 22:30:54 (28.1 MB/s) - ‘/home/eicarcom2.zip’ saved [308/308]

#
#
# clamscan --log=/var/log/clamav.log --infected --remove --recursive /home
/home/eicar.com: Eicar-Test-Signature FOUND
/home/eicar.com: Removed.
/home/eicarcom2.zip: Eicar-Test-Signature FOUND
/home/eicarcom2.zip: Removed.

----------- SCAN SUMMARY -----------
Known viruses: 4297364
Engine version: 0.99
Scanned directories: 143
Scanned files: 737
Infected files: 2
Data scanned: 103.08 MB
Data read: 53.47 MB (ratio 1.93:1)
Time: 26.584 sec (0 m 26 s)
#

なるほどこういう動作感。実際には検出された光景など見たくはないが。


さて、次に検索領域を広げてみる。テストで/をすべて検索してみると... clamscanのプロセスで、CPUをガッツリ75-100%ほども使ってくれる。この機材のCPUは i5-560Uで4コア、数世代前とはいえ相当な性能のはずなのだが、それでもclamscanは負荷が高い。


尚、ここでは、そもそもCPU使用率ってどうやって見るんだっけ?程度の見方。こちら様を参照させていただいて、

GOISBLOG さんから
CentOSにおけるリソースプロセス(CPU、メモリ)を確認するコマンドまとめ
https://genchan.net/server/8074

私はここに紹介されているたった一コマンドを使っただけで、ド素人のショボい見方しかしていないので念のため。


さて、このPC で / を検索した結果だが、

----------- SCAN SUMMARY -----------
Known viruses: 4297364
Engine version: 0.99
Scanned directories: 18118
Scanned files: 82184
Infected files: 0
Total errors: 13908
Data scanned: 3581.74 MB
Data read: 3717.09 MB (ratio 0.96:1)
Time: 864.900 sec (14 m 24 s)

CPUを100%近く使いつつの所要時間。



0 件のコメント:

コメントを投稿