CentOSサーバー構築マニュアル

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


この章を始める前に下記の設定が必要です

「rpmforgeリポジトリ追加」

ヒント

Clam Antivirusとは
オープンソースで開発が行われているUNIX Linux用アンチウィルスソフトです。

■clamdインストール
[root@ns1 ~]# yum -y install clamd

■clamd.conf編集
[root@ns1 ~]# cp /etc/clamd.conf /etc/clamd.conf.org
[root@ns1 ~]# vi /etc/clamd.conf

#LocalSocket /tmp/clamd.socket
↓
LocalSocket /var/run/clamav/clamd.sock ←コメント解除&変更

TCPSocket 3310
↓
#TCPSocket 3310 ←コメントアウト

TCPAddr 127.0.0.1
↓
#TCPAddr 127.0.0.1 ←コメントアウト

User clamav
↓
#User clamav ←コメントアウト(root権限で動作させる)

■freshclam.conf編集
[root@ns1 ~]# cp /etc/freshclam.conf /etc/freshclam.conf.org
[root@ns1 ~]# vi /etc/freshclam.conf

DatabaseOwner clamav
↓
DatabaseOwner root ←変更(root権限で動作させる)

■clamd起動
[root@ns1 ~]# /etc/rc.d/init.d/clamd start
[root@ns1 ~]# chkconfig clamd on
[root@ns1 ~]# chkconfig --list clamd
clamd           0:off   1:off   2:on    3:on    4:on    5:on    6:off

■ウィルス定義ファイル最新化
[root@ns1 ~]# freshclam

■ウイルススキャンテスト
[root@ns1 ~]# 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@ns1 ~]# 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@ns1 ~]# chmod +x /etc/cron.weekly/clamscan

■ログローテーション設定
[root@ns1 ~]# vi /etc/logrotate.d/clamscan

↓下記を記入
/var/log/clamav/clamscan.log {
	monthly
	rotate 4
	missingok
}


Home PageTop Last updated 2010-08-25

このサイトはリンクフリーです。ご自由にリンクしてください。 Copyright centos.server-manual.com