ヘルプ:rootkit検知ツール導入(RKHunter)(CentOS7)

提供:あわWiki

メインページ > ヘルプ:目次 > ヘルプ:自宅サーバー構築(CentOS7)  > rootkit検知ツール導入(RKHunter)(CentOS7)

Rootkit 検出ツール RKHunter のインストールと設定です。

RKHunter をインストール

[root@host2 ~]# yum --enablerepo=epel -y install rkhunter
・
・
依存性を解決しました

================================================================================
 Package            アーキテクチャー バージョン            リポジトリー    容量
================================================================================
インストール中:
 rkhunter           noarch           1.4.6-1.el7           epel           207 k

トランザクションの要約
================================================================================
インストール  1 パッケージ
・
・

RKHunter の設定と利用方法

RKHunter の設定

[root@host2 ~]# vi /etc/sysconfig/rkhunter

MAILTO=root@localhost ← レポートを送信する宛先

DIAG_SCAN=no ← yes で詳細スキャンモード

セキュリティデータベースのアップデート

[root@host2 ~]# rkhunter --update
[ Rootkit Hunter version 1.4.6 ]

Checking rkhunter data files...
  Checking file mirrors.dat                                  [ Updated ]
  Checking file programs_bad.dat                             [ Updated ]
・
・
・

ハッシュデータベースの更新

[root@host2 ~]# rkhunter --propupd
[ Rootkit Hunter version 1.4.6 ]
Checking system commands...

  Performing 'strings' command checks
    Checking 'strings' command                               [ OK ]
・
・
・

チェック実行

  • --sk で Enterキー押下をスキップ
  • --rwo を指定すると、警告のみ表示
[root@host2 ~]# rkhunter --check --sk
[ Rootkit Hunter version 1.4.6 ]

Checking system commands...

  Performing 'strings' command checks
    Checking 'strings' command                               [ OK ]

  Performing 'shared libraries' checks
    Checking for preloading variables                        [ None found ]
    Checking for preloaded libraries                         [ None found ]
    Checking LD_LIBRARY_PATH variable                        [ Not found ]

  Performing file properties checks
    Checking for prerequisites                               [ OK ]
    /usr/local/bin/perl                                      [ OK ]
    /usr/sbin/adduser                                        [ OK ]
    /usr/sbin/chkconfig                                      [ OK ]
    /usr/sbin/chroot                                         [ OK ]
・
・
・

警告解消

警告

khunter でスキャンをかけると以下のように警告がが出た。

[root@host2 ~]# rkhunter --check --sk --rwo
Warning: The SSH and rkhunter configuration options should be the same:
         SSH configuration option 'PermitRootLogin': no
         Rkhunter configuration option 'ALLOW_SSH_ROOT_USER': unset

解消

これを解決するために、/etc/rkhunter.conf を編集する。 ALLOW_SSH_ROOT_USER=no と書き換えればよい。

[root@host2 ~]# vi /etc/rkhunter.conf

ALLOW_SSH_ROOT_USER=no ← 書き換える
  • 編集後に以下のコマンドを実行する
[root@host2 ~]# rkhunter --propupd