この記事は、テスト目的でWindows上のLiferayプラットフォームでClam Antivirusをセットアップする方法を文書化したものです。 文書がアップロードされる際に、ウイルススキャンを行うことを目的としています。
解像度
- ClamWin for Windowsのダウンロード. インストール後、より新しいバージョンにアップデートすることができます。 その他のOSの場合は、 http://www.clamav.net/をお試しください。
- ClamWinのインストーラーをデフォルトの設定で実行します。
- インストールが完了してデータベースが更新されたら、ディレクトリ
C:\ProgramData\.clamwin\db into C:\Program Files (x86)\ClamWin\bin\
にコピーします。 - PATH変数を更新して、
C:\Program Files (x86)\ClamWin\bin\
を含めます。 - ファイルをスキャンして、ClamAVが正常に機能していることを確認する。 テスト用 eicar ファイル をダウンロードして実行します。
clamscan --stdout --no-summary [path to test file]
. ファイルのダウンロードを許可するために、マシンのアンチウイルスを修正する必要がある可能性が高いです。このような出力が表示されるはずです:
C:\Users\liferay>clamscan --stdout --no-summary C:\Users\liferay\Downloads\eicar.com.txt Loading virus signature database, please wait... done C:\Users\liferay\Downloads\eicar.com.txt: Eicar-Test-Signature FOUND
- ここで、Liferay プラットフォームの ClamAV の実装を設定します。 portal-ext.propertiesファイルに、以下のプロパティを追加します:
# Set this property to true to enable execution of antivirus check when # files are submitted into a store. Setting this value to true will prevent # any potential virus files from entering the store but will not allow for # file quarantines. # dl.store.antivirus.enabled=true # # Set the name of a class that implements # com.liferay.portlet.documentlibrary.antivirus.AntivirusScanner. The # document library server will use this to scan documents for viruses. # #dl.store.antivirus.impl=com.liferay.portlet.documentlibrary.antivirus.DummyAntivirusScannerImpl dl.store.antivirus.impl=com.liferay.portlet.documentlibrary.antivirus.ClamAntivirusScannerImpl
- プラットフォームを起動し、管理者としてログインします。
- ページにドキュメントとメディアのポートレットを追加し、eicarファイルをアップロードします。
期待される結果
ドキュメントとメディアポートレットには、 Your request failed to complete and A virus was detected in fileとあります。
アップロードが正常にブロックされました。