rootkit検知ツール導入(RKHunter)(AlmaLinux)
提供: すだちWiki
メインページ > Category:自宅サーバー > AlmaLinux 8 で自宅サーバー構築 > rootkit検知ツール導入(RKHunter)(AlmaLinux)
Rootkit 検出ツール RKHunter のインストールと設定です。
RKHunter をインストール
[root@host4 ~]# dnf --enablerepo=epel -y install rkhunter
・
・
依存性を解決しました
================================================================================
パッケージ アーキテクチャー
バージョン リポジトリ サイズ
================================================================================
Installing:
rkhunter noarch 1.4.6-5.el8 epel 212 k
依存関係をインストール中:
mailx x86_64 12.5-29.el8 BaseOS 257 k
トランザクションの概要
================================================================================
インストール 2 パッケージ ・
・
RKHunter の設定と利用方法
RKHunter の設定
[root@host4 ~]# vi /etc/sysconfig/rkhunter MAILTO=root@localhost ← レポートを送信する宛先 DIAG_SCAN=no ← yes で詳細スキャンモード
セキュリティデータベースのアップデート
[root@host4 ~]# rkhunter --update [ Rootkit Hunter version 1.4.6 ] Checking rkhunter data files... Checking file mirrors.dat [ Updated ] Checking file programs_bad.dat [ Updated ] ・ ・ ・
ハッシュデータベースの更新
[root@host4 ~]# rkhunter --propupd [ Rootkit Hunter version 1.4.6 ] File created: searched for 177 files, found 133
チェック実行
- --sk で Enterキー押下をスキップ
- --rwo を指定すると、警告のみ表示
[root@host4 ~]# 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@host4 ~]# 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': yes
解消
これを解決するために、/etc/rkhunter.conf を編集する。 ALLOW_SSH_ROOT_USER=no と書き換えればよい。
[root@host4 ~]# vi /etc/rkhunter.conf ALLOW_SSH_ROOT_USER=no ← 書き換える
- 編集後に以下のコマンドを実行する
[root@host4 ~]# rkhunter --propupd [ Rootkit Hunter version 1.4.6 ] File updated: searched for 177 files, found 133
