アンチウイルス Clam Antivirus インストール
ヒント
Clam Antivirusとは
オープンソースで開発が行われているUNIX Linux用アンチウィルスソフトです。
clamdインストール
[root@centos ~]# yum -y install clamd
clamd.conf編集
[root@centos ~]# vi /etc/clamd.conf
#LocalSocket /tmp/clamd.socket
↓
LocalSocket /var/run/clamav/clamd.sock ←コメント解除&変更(ローカルソケットを指定)
TCPSocket 3310
↓
#TCPSocket 3310 ←コメントアウト(TCPSocketは使用しない)
TCPAddr 127.0.0.1
↓
#TCPAddr 127.0.0.1 ←コメントアウト
User clamav
↓
#User clamav ←コメントアウト(root権限で動作させる)
freshclam.conf編集
[root@centos ~]# vi /etc/freshclam.conf
DatabaseOwner clamav
↓
DatabaseOwner root ←変更(root権限で動作させる)
clamd起動
[root@centos ~]# /etc/rc.d/init.d/clamd start
[root@centos ~]# chkconfig clamd on
[root@centos ~]# chkconfig --list clamd
clamd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
ウィルス定義ファイル最新化
[root@centos ~]# freshclam
ウイルススキャンテスト
[root@centos ~]# clamscan --infected --remove --recursive
----------- SCAN SUMMARY -----------
Known viruses: 1169562
Engine version: 0.97.3
Scanned directories: 10
Scanned files: 12
Infected files: 0 ←ウイルス感染ファイルは0
Data scanned: 2.61 MB
Data read: 1.30 MB (ratio 2.00:1)
Time: 4.389 sec (0 m 4 s)
ウイルススキャン定期自動実行
[root@centos ~]# vi /etc/cron.weekly/clamscan
↓下記を記入
#!/bin/bash
yum -y update clamd > /dev/null 2>&1
/usr/bin/freshclam > /dev/null
/usr/bin/clamscan -i -r --remove /home >> /var/log/clamav/clamscan.log 2>&1
[root@centos ~]# chmod +x /etc/cron.weekly/clamscan
ログローテーション設定
[root@centos ~]# vi /etc/logrotate.d/clamscan
↓下記を記入
/var/log/clamav/clamscan.log {
monthly
rotate 4
missingok
}