提供:あわWiki
移動先: 案内検索

ヘルプ:アンチウィルスソフト導入(Clam AntiVirus)(CentOS8)

メインページ > ヘルプ:目次 > ヘルプ:自宅サーバー構築(CentOS8)  > アンチウィルスソフト導入(Clam AntiVirus)(CentOS8)

Clam AntiVirusインストール

[root@host3 ~]# dnf --enablerepo=epel -y install clamav clamav-update clamav-scanner-systemd

ウイルス定義ファイル最新化

ウイルス定義ファイル更新設定

  • freshclam.conf が存在しませんでした。別のサーバーで確認したらファイルはありましたが、全てがコメントアウトのみの記載でした。無くても動作しました。
[root@host3 ~]# vi /etc/freshclam.conf ← ウイルス定義ファイル更新設定ファイル編集
# Comment or remove the line below.
#Example ← 行頭に#を追加してコメントアウト(ウイルス定義ファイル更新機能の有効化)

ウイルス定義ファイル最新化

[root@host3 ~]# freshclam ← ウイルス定義ファイル最新化
ClamAV update process started at Tue Mar 10 10:22:58 2020
daily database available for download (remote version: 25746)
・
・

Clam AntiVirus設定

Clam AntiVirus設定ファイル編集

[root@host3 ~]# vi /etc/clamd.d/scan.conf
# Comment or remove the line below.
#Example ← 行頭に#を追加してコメントアウト

# Run as another user (clamd must be started by root for this option to work)
# Default: don't drop privileges
#User clamscan ← 行頭に#を追加してコメントアウト(root権限で動作するようにする)

# Path to a local socket file the daemon will listen on.
# Default: disabled (must be specified by a user)
LocalSocket /run/clamd.scan/clamd.sock ← 行頭の#を削除

Clam AntiVirus起動

[root@host3 ~]# systemctl start clamd@scan ← clamd起動

[root@host3 ~]# systemctl enable clamd@scan ← clamd自動起動設定

[root@host3 ~]# systemctl status clamd@scan ← 動作確認
 clamd@scan.service - clamd scanner (scan) daemon
   Loaded: loaded (/usr/lib/systemd/system/clamd@.service; enabled; vendor pres>
   Active: active (running) since Sun 2020-03-22 20:13:31 JST; 22min ago
     Docs: man:clamd(8)
           man:clamd.conf(5)
           https://www.clamav.net/documents/
 Main PID: 19465 (clamd)
    Tasks: 2 (limit: 26213)
   Memory: 873.7M
   CGroup: /system.slice/system-clamd.slice/clamd@scan.service
           mq19465 /usr/sbin/clamd -c /etc/clamd.d/scan.conf

ウイルススキャンテスト

[root@host3 ~]# clamscan --infected --remove --recursive ← ウイルススキャンテスト(ウイルスなしの場合)
/root: OK

----------- SCAN SUMMARY -----------
Known viruses: 6767434
Engine version: 0.102.2
Scanned directories: 1
Scanned files: 8
Infected files: 0
Data scanned: 0.00 MB
Data read: 0.00 MB (ratio 0.00:1)
Time: 17.879 sec (0 m 17 s)

[root@host3 ~]# wget http://www.eicar.org/download/eicar.com ← テスト用ウイルスをダウンロード
[root@host3 ~]# wget http://www.eicar.org/download/eicar.com.txt ← テスト用ウイルスをダウンロード
[root@host3 ~]# wget http://www.eicar.org/download/eicar_com.zip ← テスト用ウイルスをダウンロード
[root@host3 ~]# wget http://www.eicar.org/download/eicarcom2.zip ← テスト用ウイルスをダウンロード

[root@host3 ~]# clamscan --infected --remove --recursive ← ウイルススキャンテスト(ウイルスありの場合)
/root/eicar.com: Eicar-Test-Signature FOUND ← ウイルス検知
/root/eicar.com: Removed. ← ウイルス削除
/root/eicar.com.txt: Eicar-Test-Signature FOUND ← ウイルス検知
/root/eicar.com.txt: Removed. ← ウイルス削除
/root/eicar_com.zip: Eicar-Test-Signature FOUND ← ウイルス検知
/root/eicar_com.zip: Removed. ← ウイルス削除
/root/eicarcom2.zip: Eicar-Test-Signature FOUND ← ウイルス検知
/root/eicarcom2.zip: Removed. ← ウイルス削除

----------- SCAN SUMMARY -----------
Known viruses: 6767434
Engine version: 0.102.2
Scanned directories: 1
Scanned files: 12
Infected files: 4 ← 4つのウイルスを検知した
Data scanned: 0.00 MB
Data read: 0.00 MB (ratio 0.00:1)
Time: 17.872 sec (0 m 17 s)