rootkit検知ツール導入(RKHunter)

1.RKHunter をインストール

[root@miracle ~]# dnf --enablerepo=epel -y install rkhunter
・
・
インストール済み:
  mailx-12.5-29.el8.x86_64               rkhunter-1.4.6-7.el8.noarch              

完了しました!

2.RKHunter の設定

rootでログインしないので修正。

[root@miracle ~]# vi /etc/rkhunter.conf
ALLOW_SSH_ROOT_USER=no

修正しないとチェック時に警告が出るらしい。

Warning: The SSH and rkhunter configuration options should be the same:
         Rkhunter configuration option 'ALLOW_SSH_ROOT_USER': yes

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

[root@miracle ~]# rkhunter --update

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

[root@miracle ~]# rkhunter --propupd

5.RKHunterチェック実行

[root@miracle ~]# rkhunter --check --sk

オプション
 –sk:Enterキー押下をスキップ
 –rwo:警告のみ表示

チェック結果がこんな感じで表示されます。

[root@miracle ~]# 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 ]
・
・
・
System checks summary
=====================

File properties checks...
    Files checked: 138
    Suspect files: 0

Rootkit checks...
    Rootkits checked : 495
    Possible rootkits: 0

Applications checks...
    All checks skipped

The system checks took: 2 minutes and 6 seconds

All results have been written to the log file: /var/log/rkhunter/rkhunter.log

No warnings were found while checking the system.

Warning結果だけ欲しいよって場合は、以下で実行すればWarning無ければ何も表示されません。

[root@miracle ~]# rkhunter --check --skip-keypress --report-warnings-only
[root@miracle ~]#

7.RKHunter自動起動設定

定期的にチェックを行い、そのレポートをメールで報告するスクリプトが自動で作成されます。
/etc/cron.daily/rkhunter

コメント

タイトルとURLをコピーしました