1.Clam AntiVirusインストール
[root@miracle ~]# dnf --enablerepo=epel -y install clamav clamav-update clamav-scanner-systemd
2.ウイルス定義ファイル更新設定
[root@miracle ~]# vi /etc/freshclam.conf # Comment or remove the line below. #Example ← #が無かったら追加。ウイルス定義ファイル更新機能の有効化
3.ウイルス定義ファイル最新化
[root@miracle ~]# freshclam
4.Clam AntiVirus設定ファイル編集
[root@miracle ~]# 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 ← 行頭の#を削除
5.Clam AntiVirus起動
[root@miracle ~]# systemctl start clamd@scan
6.Clam AntiVirus自動起動設定
[root@miracle ~]# systemctl enable clamd@scan
7.Clam AntiVirus動作確認
[root@miracle ~]# systemctl status clamd@scan ● clamd@scan.service - clamd scanner (scan) daemon Loaded: loaded (/usr/lib/systemd/system/clamd@.service; enabled; vendor preset> Active: active (running) since Tue 2022-09-13 17:19:45 EDT; 15s ago Docs: man:clamd(8) man:clamd.conf(5) https://www.clamav.net/documents/ Main PID: 58478 (clamd) Tasks: 2 (limit: 11378) Memory: 1.2G CGroup: /system.slice/system-clamd.slice/clamd@scan.service └─58478 /usr/sbin/clamd -c /etc/clamd.d/scan.conf
8.ウィルススキャンテスト (ウィルス無し時)
[root@miracle ~]# clamscan --infected --remove --recursive ----------- SCAN SUMMARY ----------- Known viruses: 8633902 Engine version: 0.103.7 Scanned directories: 1 Scanned files: 8 Infected files: 0 ← 検知無し Data scanned: 0.00 MB Data read: 0.00 MB (ratio 0.00:1) Time: 47.879 sec (0 m 47 s) Start Date: 2022:09:13 17:25:38 End Date: 2022:09:13 17:26:26
9.ウィルススキャンテスト (ウィルス有り時)
テスト用ウィルスをダウンロードしてスキャン実行
[root@miracle ~]# wget http://www.eicar.org/download/eicar.com [root@miracle ~]# wget http://www.eicar.org/download/eicar.com.txt [root@miracle ~]# wget http://www.eicar.org/download/eicar_com.zip [root@miracle ~]# wget http://www.eicar.org/download/eicarcom2.zip [root@miracle ~]# clamscan --infected --remove --recursive /root/eicar.com.txt: Win.Test.EICAR_HDB-1 FOUND /root/eicar.com.txt: Removed. ← ウイルス削除 /root/eicar_com.zip: Win.Test.EICAR_HDB-1 FOUND /root/eicar_com.zip: Removed. ← ウイルス削除 /root/eicar.com: Win.Test.EICAR_HDB-1 FOUND /root/eicar.com: Removed. ← ウイルス削除 /root/eicarcom2.zip: Win.Test.EICAR_HDB-1 FOUND /root/eicarcom2.zip: Removed. ← ウイルス削除 ----------- SCAN SUMMARY ----------- Known viruses: 8633902 Engine version: 0.103.7 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.570 sec (0 m 17 s) Start Date: 2022:09:13 17:30:35 End Date: 2022:09:13 17:30:52
コメント