Windowsで最新のClam AntivirusをLiferayプラットフォームで設定する方法。 目的は、文書をアップロードする際にウイルスをスキャンすることです。
環境
- Windows 10
- Liferay 6.2
- ClamAV version 0.103.0
解決
- ClamAVの最新版をダウンロードします https://www.clamav.net/downloads/production/ClamAV-0.103.0.exe
-
ClamAV-0.103.0.exeを右クリックし、管理者として実行を選択します
“Windows protected your PC”という警告メッセージが表示される場合があります。Select Moreを選択し、Runを選択します -
I accept the agreementを選択し、Nextをクリックします
-
もう一度Nextをクリックしてください。 以前にインストールしたClamAVを削除した場合、“フォルダは既に存在します”というプロンプトが表示されることがあります。 "Yes "を選択します
-
Installをクリックします
-
Finishをクリックします
-
環境変数でパスを更新する必要があります。 例 C:\Program Files\ClamAV
-
Windowsキーを押してPowerShellと入力しますが、Enterキーは押さないでください
-
メニュー上部のWindows PowerShellを右クリックし、「管理者として実行」を選択します。 このアプリケーションががデバイスに変更を加えることを許可しますか?という警告を表示する場合がありまが、「はい」をクリックします
-
PowerShellウィンドウのプロンプトが次のようになっていることを確認してください。PS C:\WINDOWS\system32>
Administrator PowerShellウィンドウで、以下のように入力してClamAVのインストールディレクトリに移動します。 cd "c:\program files\clamav" -
初回セットアップ
PowerShell ウィンドウで、以下のタスクを実行します:
実行:
copy .\conf_examples\freshclam.conf.sample .\freshclam.conf
copy .\conf_examples\clamd.conf.sample .\clamd.conf
実行:write.exe .\freshclam.conf
ワードパッドがポップアップします。“Example”という行を削除します。 機能を有効にしたり、受信タイムアウトなどのデフォルトの動作を変更したりするために、追加のオプションを設定することもできます。 ファイルを保存してワードパッドを閉じます
実行: write.exe .\clamd.conf
ワードパッドがポップアップします。“Example”という行を削除します。 機能を有効にしたり、ログの有効化などのデフォルトの動作を変更したりするために、追加のオプションを設定することもできます。 ファイルを保存してワードパッドを閉じます -
署名データベースをダウンロードします
PowerShell ウィンドウで続行します
実行:.\freshclam.exe
基本的なスキャンを実行する手順
現在のディレクトリ内のファイルをスキャンします: .\clamscan.exe.
これにより、現在のディレクトリがスキャンされます。 スキャンの最後に、サマリーが表示されます - 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
- すべての一時フォルダを削除します
- サーバーを再起動します
- プラットフォームを起動し、管理者としてログインします
- ドキュメントをアップロードします
期待される結果
アップロードが正常に行われます。
ドキュメントとメディアポートレットは、ファイルにウイルスが検出された場合、"処理に失敗しました。" と表示します。