##AIDEnode
當一個入侵者進入了你的系統而且種植了木馬,一般會想辦法來隱蔽這個木馬(除了木馬自身的一些隱蔽特性外,他會盡可能給你檢查系統的過程設置障礙)。 一般入侵者會修改一些文件,好比管理員一般用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