アンチウイルス Clam Antivirus インストール

この章を始める前に下記の設定が必要です
「RPMforge EPEL Remi リポジトリインストール」
ヒント
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: 755405
Engine version: 0.96
Scanned directories: 1
Scanned files: 16
Infected files: 0 ←ウイルス感染ファイルは0
Data scanned: 2.51 MB
Data read: 0.24 MB (ratio 10.52:1)
Time: 5.635 sec (0 m 5 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
}
Home PageTop