close

現場(環境):CentOS6.9  套件: rootkit hunter

 


 

原因:

 

對於任何入侵者來說,

 

可以使用市面上多種的rootkit來進行攻擊,

 

而搶到root權限是他的最終目的。

 

雖然對於非常高層級的惡意攻擊,

 

這個套件可能沒辦法發揮他100%的能力,

 

但面對較為簡單的攻擊方法,它仍是有它的一片天。

 


 

處理方式:

 

這次要安裝的套件是rookit hunter

 

他可以做什麼??

 

-->偵測 rootkit 程式、偵測後門程式、以及主機端的套件檢查問題

 

-->檢查 rootkit 經常攻擊的檔案

 

-->檢查隱藏檔案

 

除了這些事情之外,當然他還有許多可以達成的項目。

 

從下列網站下載我們的套件

http://rkhunter.sourceforge.net/

 

#tar -zxvf rkhunter1.4.4.tar.gz

 

#cd rkhunter1.4.4  (切換目錄)

#ls -l

=!===================

total 40

 

drwxr-xr-x 5 root root 4096 Jun 29 15:55 files

 

-rwxr-xr-x 1 root root 34923 Jun 29 15:51 installer.sh

=!======================

 

 

#./install.sh --layout default --install

 

預設路徑 /usr/local/bin/rkhunter

 

=!=======================

Checking system for:

Rootkit Hunter installer files: found

A web file download command: wget found

Starting installation:

Checking installation directory "/usr/local": it exists and is writable.

Checking installation directories:

Directory /usr/local/share/doc/rkhunter-1.4.4: creating: OK

Directory /usr/local/share/man/man8: exists and is writable.

Directory /etc: exists and is writable.

Directory /usr/local/bin: exists and is writable.

Directory /usr/local/lib64: exists and is writable.

Directory /var/lib: exists and is writable.

Directory /usr/local/lib64/rkhunter/scripts: creating: OK

Directory /var/lib/rkhunter/db: creating: OK

Directory /var/lib/rkhunter/tmp: creating: OK

Directory /var/lib/rkhunter/db/i18n: creating: OK

Directory /var/lib/rkhunter/db/signatures: creating: OK

Installing check_modules.pl: OK

Installing filehashsha.pl: OK

Installing stat.pl: OK

Installing readlink.sh: OK

Installing backdoorports.dat: OK

Installing mirrors.dat: OK

Installing programs_bad.dat: OK

Installing suspscan.dat: OK

Installing rkhunter.8: OK

Installing ACKNOWLEDGMENTS: OK

Installing CHANGELOG: OK

Installing FAQ: OK

Installing LICENSE: OK

Installing README: OK

Installing language support files: OK

Installing ClamAV signatures: OK

Installing rkhunter: OK

Installing rkhunter.conf: OK

Installation complete

=!=============================

 

執行系統檢測後,我們可以看到LOG

 

#rkhunter --checkall




運作完會有下面的訊息,告訴你資訊都寫在log裡面了。


 

====================

鳥哥的文件上有提到大部分的使用方式

 

--checkall (-c)           :全系統檢測,rkhunter 的所有檢測項目

--createlogfile           :建立登錄檔,一般預設放在 /var/log/rkhunter.log

--cronjob                 :可以使用 crontab 來執行,不會有顏色顯示

--report-warnings-only    :僅列出警告訊息,正常訊息不列出!

--skip-application-check  :忽略套件版本檢測(如果您已確定系統的套件已patch)

--skip-keypress           :忽略按鍵後繼續的舉動(程式會持續自動執行)

--quiet                   :僅顯示有問題的訊息,比 --report-warnings-only 更少訊息

--versioncheck            :檢測試否有新的版本在伺服器上

=!======================

 

 

日誌檔案預設存放在

 

/var/log/rkhunter.log

LOG內會有時間顯示,不會讓你無法確認是什麼時候的檢測。



而且也會詳細的告訴你問題再哪裡。

=!================================================================

[14:11:52]   /usr/bin/GET                                    [ Warning ]

[14:11:52] Warning: The command '/usr/bin/GET' has been replaced by a script: /usr/bin/GET: a /usr/bin/perl -w script text executable

=!================================================================

 

我們再他檢查的時候,會需要互動是的操作(如下圖)

 

 

但有時候覺得互動方式很麻煩,可以直接讓程式自動執行。

 

#rkhunter --checkall --skip-keypress

 

 

上述都是我們手動的方式,而我們最需要的是要去排程運作。

 

然後我們定期去收日誌訊息。

 

所以要寫在crontab 裡面。

 

#crontab -e

=!============================

每天2點執行一次

0 2 * * * root /usr/local/bin/rkhunter --checkall --cronjob

 

=!============================

 

每天執行一次其實就差不多了。

 

因為用crontab執行的不會有顏色的區別,

 

一天你也沒那麼多時間就只看一台機器。

 

(本篇完)

 

 

 

參考網址:

http://linux.vbird.org/linux_security/0420rkhunter.php

arrow
arrow
    全站熱搜

    IT001 發表在 痞客邦 留言(0) 人氣()