ClamAVがアップデートした際にfreshclamが正常に動かない

当サーバはClamAVというアンチウィルスソフトで保護されていますが、このClamAVの日々の更新がうまくいっていない旨のメールが届くようになりました。

メール本文は以下の通り

/etc/cron.daily/freshclam:
ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).
ERROR: Can't open /var/log/clamav/freshclam.log in append mode (check permissions!).

 

freshclamは定義ファイルの更新プログラムですが、それがログを追記できないのが原因のようです。

早速リモートでサーバーに接続して/var/log/clamavのあたりをチェックしてみます。

すると所有者がclamに変更されており、clamavやfreshclamはclamavの権限で動作するよう設定していますので、この齟齬がエラーの原因と考えられます。

この状態でfreshclamしても、

ERROR: Can't open /var/log/clamav/freshclam.log in append mode (check permissions!).
ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).

メール本文と同じエラーが出力されます。

 

この/var/log/clamavあたりの所有権を訂正しないと、clamavが定義ファイルを更新できないので、

[bash]
# chown –R clamav:clamav /var/log/clamav
[/bash]

として、/var/log/clamav以下のディレクトリをclamavの所有権に変更します。

これで

[bash]
# freshclam
[/bash]

すると、

ClamAV update process started at Mon Oct 15 13:39:27 2012
nonblock_connect: connect timing out (30 secs)
Can't connect to port 80 of host db.jp.clamav.net (IP: 219.106.242.51)
Downloading main.cvd [100%]
main.cvd updated (version: 54, sigs: 1044387, f-level: 60, builder: sven)
Downloading daily.cvd [100%]
daily.cvd updated (version: 15460, sigs: 276636, f-level: 63, builder: guitar)
bytecode.cld is up to date (version: 190, sigs: 36, f-level: 63, builder: neo)
Database updated (1321059 signatures) from db.jp.clamav.net (IP: 211.10.155.48)

エラーも出ず、正常に終了しました。

(追記)

ふたたびcronが正常に動作していないメールが流れてきていました。

/etc/cron.daily/freshclam:
ERROR: Can't create temporary directory /var/lib/clamav/clamav-fb2e8913efa2473d6fce1646e98b3a64

定義ファイルを格納してる/var/lib/clamavディレクトリも所有者がclamになっています。

そこで同様に
[bash]
# chown –R clamav:clamav /var/lib/clamav
[/bash]して
[bash]
# freshsclam
ClamAV update process started at Thu Oct 18 10:19:09 2012
main.cvd is up to date (version: 54, sigs: 1044387, f-level: 60, builder: sven)
nonblock_connect: connect timing out (30 secs)
Can’t connect to port 80 of host db.jp.clamav.net (IP: 219.106.242.51)
Downloading daily-15461.cdiff [100%]
Downloading daily-15462.cdiff [100%]
Downloading daily-15463.cdiff [100%]
Downloading daily-15464.cdiff [100%]
Downloading daily-15465.cdiff [100%]
Downloading daily-15466.cdiff [100%]
Downloading daily-15467.cdiff [100%]
Downloading daily-15468.cdiff [100%]
Downloading daily-15469.cdiff [100%]
Downloading daily-15470.cdiff [100%]
Downloading daily-15471.cdiff [100%]
Downloading daily-15472.cdiff [100%]
daily.cld updated (version: 15472, sigs: 277314, f-level: 63, builder: ccordes)
bytecode.cld is up to date (version: 190, sigs: 36, f-level: 63, builder: neo)
Database updated (1321737 signatures) from db.jp.clamav.net (IP: 219.94.128.99)
[/bash]

同様のエラーが出力される場合は、いちどClamAVで設定されているユーザーと、ログファイルディレクトリや定義ファイルディレクトリの所有権に齟齬がないかを確認してみてください。

PAGE TOP ▲

お問い合わせフォームはこちら

お客様のビジネスの規模・内容に従い、最適なアプリケーションをご紹介します。
アプリケーションの導入・連携支援は、ぜひ、システムキューブにお任せください。

Copyright © 2022 System Cube Co.,Ltd. All Rights Reserved.