AIDE ...
AIDE
當一個入侵者進入了你的系統並且種植了木馬,通常會想辦法來隱蔽這個木馬(除了木馬自身的一些隱蔽特性外,他會儘量給你檢查系統的過程設置障礙)。
通常入侵者會修改一些文件,比如管理員通常用ps -aux 來查看系統進程,那麼入侵者很可能用自己經過修改的ps 程式來替換掉你系統上的ps 程式,以使用ps 命令查不到正在運行的木馬程式。如果入侵者發現管理員正在運行crontab 作業,也有可能替換掉crontab程式等等。
所以由此可以看出對於系統文件或是關鍵文件的檢查是很必要的。
目前就系統完整性檢查的工具用的比較多的有兩款:Tripwire 和AIDE,前者是一款商業軟體,後者是一款免費的但功能也很強大的工具。
AIDE(Adevanced Intrusion Detection Environment),高級入侵檢測環境,是一個入侵檢測工具,主要用途是檢查文件的完整性,審計電腦上的那些文件被更改過了。
AIDE 能夠構造一個指定文件的資料庫,它使用aide.conf 作為其配置文件。
AIDE 資料庫能夠保存文件的各種屬性,包括:許可權(permission) 、索引節點序號(inode number) 、所屬用戶(user)、 所屬用戶組(group) 、文件大小、最後修改時間(mtime) 、創建時間(ctime) 、最後訪問時間(atime) 、增加的大小以及連接數。
AIDE還能夠使用下列演算法:sha1 、md5 、rmd160 、tiger ,以密文形式建立每個文件的校驗碼或散列號。
這個資料庫不應該保存那些經常變動的文件信息,例如:日誌文件、郵件、/proc 文件系統、用戶起始目錄以及臨時目錄.
安裝
yum install aide
aide
aide - Advanced Intrusion Detection Environment
aide [parameters] command
Commands:
-i, --init Initialize the database
-C, --check Check the database
-u, --update Check and update the database non-interactively
--compare Compare two databases
Miscellaneous:
-D, --config-check Test the configuration file
-v, --version Show version of AIDE and compilation options
-h, --help Show this help message
Options:
-c [cfgfile] --config=[cfgfile] Get config options from [cfgfile]
-B "OPTION" --before="OPTION" Before configuration file is read define OPTION
-A "OPTION" --after="OPTION" After configuration file is read define OPTION
-r [reporter] --report=[reporter] Write report output to [reporter] url
-V[level] --verbose=[level] Set debug message level to [level]
修改配置文件
vim /etc/aide.conf ( 指定對哪些文件進行檢測)
/test/chameleon R
/bin/ps R+a
/usr/bin/crontab R+a
/etc PERMS
!/etc/mtab # “!” 表示忽略這個文件的檢查
R=p+i+n+u+g+s+m+c+md5 許可權+ 索引節點+ 鏈接數+用戶+ 組+ 大小+ 最後一次修改時間+ 創建時間+md5 校驗值
NORMAL = R+rmd60+sha256
初始化預設的AIDE 的庫:
/usr/local/bin/aide --init
生成檢查資料庫(建議初始資料庫存放到安全的地方)
cd /var/lib/aide
mv aide.db.new.gz aide.db.gz
檢測:
/usr/local/bin/aide --check
更新資料庫
aide --update