LoginSignup
0
0

More than 1 year has passed since last update.

Ubuntu Server 20.04.3 LTS 構築#14 セキュリティ設定7-1(マルウェア対策)

Last updated at Posted at 2022-02-13

実施日:2022/02/13

<<今回の内容>>
マルウェア対策としてmaldectを導入します。

調べてみると、公式サイトからwgetコマンドかcurlコマンドを使用してダウンロードする必要がある。

cd /tmp/ && wget http://www.rfxn.com/downloads/maldetect-current.tar.gz
ダウンロードコマンドと併せてcdコマンドで任意のディレクトリに移動してから、ダウンロードします

ダウンロードファイルはgzがファイル名の最後についているため、tarコマンドで解凍します。

tara xfz maldetect-current.tar.gz

エラーメッセージが表示されました。 tar:ERROR is not recoverable exting now tarアーカイブではないという意味のようです。 fileコマンドで該当ファイルを確認してみます。 file maldetect-current.tar.gz HTML Document,ASCII text with no line terminators HTMLドキュメントのようです。

解決方法 上記のようにダウンロードサイトからダウンロードしたにも関わらず、正しくダウンロード出来ていないものは コマンドの記述に誤りがあったり、ダウンロードの失敗で起きているようですので、再ダウンロードします。 再ダウンロードして、解凍出来ました。

lsコマンドで/tmp/ディレクトリの中を確認します。

/tmp$ ls
maldetect-current.tar.gz
maldetect-1.6.4
#maldetect-1.6.4が解凍後のファイルになります。

このままインストールまで作業を進めます。
cd maldetect-1.6.4 && ./install.sh
./insall.shの前にsudoを入れていないで実行したため、~のファイルやディレクトリはありませんと
ズラズラと表示されましたので、やり直しです。
sudo ./install.sh
参考にさせて頂いたサイト様と同様にインストールが完了しました。

インストールが完了しましたので、設定をします。

その前に設定ファイルのバックアップを取っておきます。
cp /usr/local/maldetect/conf.maldet /usr/local/maldetect/conf.maldet-default

取得したバックアップファイルを別のディレクトリに移します。
sudo mv /usr/local/maldetect/conf.maldet-default /tmp/default-file/

設定ファイルの編集
sudo nano /usr/local/maldetect/conf.maldet

編集項目
email_alert="0"を"1"に変更
email_address="you@domain.com"を"ユーザー名@localhost"に変更
scan_user_access="0"を"1"に変更
quarantine_hits="0"を"1"に変更
quarantine_suspend_user="0"を"1"に変更

設定を編集しましたので、次は更新をしてみます。

更新の前にログインしているユーザーの正しいパスを作成します。
sudo /usr/local/sbin/maldet --mkpubpaths

更新をします。
maldet -u

最新バージョンがあるか確認します。
maldet -d

最新バージョンであることが表示されていました。

実際にmaldetが機能しているか確認します。

clamavでお世話になったeicarから確認用で頂いてきます。
wget http://www.eicar.org/download/eicar_com.zip

スキャンします。
maldet -a /tmp
マルウェアとしてヒットしたのが9件ありました。
誤検知の可能性があるため、ヒットしたファイルの確認が必要です。

本日はここまで。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0