LMD (Linux Malware Detect)は、Linuxオペレーティングシステム用のオープンソースのマルウェア検出器です。 LMDは、ユーザーファイル内の脅威を検出してクリアするための共有ホスティング環境向けに特別に設計されています。
このガイドでは、 ClamAVを使用してLinuxMalwareDetect(LMD)をインストールします。 Debian 9 / Ubuntu 16.04 / LinuxMint 18 。
DebianにLinuxMalwareDetectをインストールする
LMDは、ビルド済みパッケージとしてベースリポジトリで利用できませんが、公式プロジェクトWebサイトからtarballとしてLMDを入手できます。
最新バージョンのLMDをダウンロード (v1.6.2)次のコマンドを使用します。
cd /tmp/ curl -O http://www.rfxn.com/downloads/maldetect-current.tar.gz
tarコマンドを使用してtarballを解凍します 。
tar -zxvf maldetect-current.tar.gz
抽出したディレクトリに移動します。
cd maldetect-1.6.2/
抽出したディレクトリにあるインストールスクリプトinstall.shを実行します。
bash install.sh
出力:
Created symlink /etc/systemd/system/multi-user.target.wants/maldet.service → /usr/lib/systemd/system/maldet.service. update-rc.d: error: unable to read /etc/init.d/maldet Linux Malware Detect v1.6 (C) 2002-2017, R-fx Networks <[email protected]> (C) 2017, Ryan MacDonald <[email protected]> This program may be freely redistributed under the terms of the GNU GPL installation completed to /usr/local/maldetect config file: /usr/local/maldetect/conf.maldet exec file: /usr/local/maldetect/maldet exec link: /usr/local/sbin/maldet exec link: /usr/local/sbin/lmd cron.daily: /etc/cron.daily/maldet maldet(933): {sigup} performing signature update check... maldet(933): {sigup} local signature set is version 2017070716978 maldet(933): {sigup} new signature set (201708255569) available maldet(933): {sigup} downloading https://cdn.rfxn.com/downloads/maldet-sigpack.tgz maldet(933): {sigup} downloading https://cdn.rfxn.com/downloads/maldet-cleanv2.tgz maldet(933): {sigup} verified md5sum of maldet-sigpack.tgz maldet(933): {sigup} unpacked and installed maldet-sigpack.tgz maldet(933): {sigup} verified md5sum of maldet-clean.tgz maldet(933): {sigup} unpacked and installed maldet-clean.tgz maldet(933): {sigup} signature set update completed maldet(933): {sigup} 15218 signatures (12485 MD5 | 1954 HEX | 779 YARA | 0 USER)
Linuxマルウェア検出の構成
/usr/local/maldetect/conf.maldet LMDのメイン設定ファイルです。要件に応じてパラメータを変更できます。
nano /usr/local/maldetect/conf.maldet
以下は、マルウェアの脅威を正常に検出して削除するためにLMDに設定する必要があるいくつかの設定です。
# Enable Email Alerting email_alert="1" # Email Address in which you want to receive scan reports email_addr="[email protected]" # Use with ClamAV scan_clamscan="1" # Enable scanning for root-owned files. Set 1 to disable. scan_ignore_root="0" # Move threats to quarantine quarantine_hits="1" # Clean string based malware injections quarantine_clean="1" # Suspend user if malware found. quarantine_suspend_user="1" # Minimum userid value that be suspended quarantine_suspend_user_minuid="500"
ClamAVでLMDを使用したくない場合は、以下の部分をスキップしてください。
ClamAVを使用したLinuxマルウェア検出
LMDは、特に大きなファイルセットのスキャンに関しては、ClamAVの方がパフォーマンスが優れています。 ClamAV (Clam Antivirus)は、ウイルス、マルウェア、トロイの木馬、その他の悪意のある脅威を検出するためのオープンソースのウイルス対策エンジンです。
ClamAVはベースリポジトリで利用できるため、aptコマンドを使用してインストールできます。
apt-get -y install clamav clamav-daemon clamdscan
デフォルトでは、LMDでのClamAVの使用が有効になっています。
LinuxMalwareDetectでスキャン
EICAR Webサイトからサンプルのウイルス署名をダウンロードして、LMDの機能をテストしてみましょう。
cd /tmp wget http://www.eicar.org/download/eicar_com.zip wget http://www.eicar.org/download/eicarcom2.zip
次に、/tmpディレクトリでマルウェアをスキャンします。
maldet -a /tmp
出力:
Linux Malware Detect v1.6.2 (C) 2002-2017, R-fx Networks <[email protected]> (C) 2017, Ryan MacDonald <[email protected]> This program may be freely redistributed under the terms of the GNU GPL v2 maldet(4209): {scan} signatures loaded: 15218 (12485 MD5 | 1954 HEX | 779 YARA | 0 USER) maldet(4209): {scan} building file list for /tmp, this might take awhile... maldet(4209): {scan} setting nice scheduler priorities for all operations: cpunice 19 , ionice 6 maldet(4209): {scan} file list completed in 0s, found 4 files... maldet(4209): {scan} found clamav binary at /usr/bin/clamscan, using clamav scanner engine... maldet(4209): {scan} scan of /tmp (4 files) in progress... maldet(4209): {scan} processing scan results for hits: 2 hits 0 cleaned maldet(4209): {scan} scan completed on /tmp: files 4, malware hits 2, cleaned hits 0, time 12s maldet(4209): {scan} scan report saved, to view run: maldet --report 171026-1103.4209
出力から、LMDがClamAVスキャナーエンジンを使用してスキャンを実行し、2つのマルウェアヒットを検出することに成功したことがわかります。
Linuxマルウェア検出器スキャンレポート
LMDはスキャンレポートを/usr/ local / maldetect /sess/に保存します 。詳細なスキャンレポートを表示するには、SCANIDとともにmaldetコマンドを使用してください。
maldet --report 171026-1103.4209
出力:
HOST: lmd SCAN ID: 171026-1103.4209 STARTED: Oct 26 2017 11:03:16 +0000 COMPLETED: Oct 26 2017 11:03:28 +0000 ELAPSED: 12s [find: 0s] PATH: /tmp TOTAL FILES: 4 TOTAL HITS: 2 TOTAL CLEANED: 0 FILE HIT LIST: {HEX}EICAR.TEST.10 : /tmp/eicar_com.zip => /usr/local/maldetect/quarantine/eicar_com.zip.296395948 {HEX}EICAR.TEST.10 : /tmp/eicarcom2.zip => /usr/local/maldetect/quarantine/eicarcom2.zip.418410660 =============================================== Linux Malware Detect v1.6.2 < [email protected] >
Linuxマルウェア検出の更新
以下のコマンドを使用して、LMDを更新します。
maldet -d
LMD署名を更新するには、次を実行します。
maldet -u
以上です。