##AIDE
1 当一个入侵者进入了你的系统并且种植了木马,通常会想办法来隐蔽这个木马(除了木马自身的一些隐蔽特性外,他会尽量给你检查系统的过程设置障碍)。 2 通常入侵者会修改一些文件,比如管理员通常用ps -aux 来查看系统进程,那么入侵者很可能用自己经过修改的ps 程序来替换掉你系统上的ps 程序,以使用ps 命令查不到正在运行的木马程序。如果入侵者发现管理员正在运行crontab 作业,也有可能替换掉crontab程序等等。 3 所以由此可以看出对于系统文件或是关键文件的检查是很必要的。 4 目前就系统完整性检查的工具用的比较多的有两款:Tripwire 和AIDE,前者是一款商业软件,后者是一款免费的但功能也很强大的工具。 5 6 AIDE(Adevanced Intrusion Detection Environment),高级入侵检测环境,是一个入侵检测工具,主要用途是检查文件的完整性,审计计算机上的那些文件被更改过了。 7 AIDE 能够构造一个指定文件的数据库,它使用aide.conf 作为其配置文件。 8 AIDE 数据库能够保存文件的各种属性,包括:权限(permission) 、索引节点序号(inode number) 、所属用户(user)、 所属用户组(group) 、文件大小、最后修改时间(mtime) 、创建时间(ctime) 、最后访问时间(atime) 、增加的大小以及连接数。 9 AIDE还能够使用下列算法:sha1 、md5 、rmd160 、tiger ,以密文形式建立每个文件的校验码或散列号。 10 这个数据库不应该保存那些经常变动的文件信息,例如:日志文件、邮件、/proc 文件系统、用户起始目录以及临时目录. 11 12 安装 13 yum install aide 14 15 aide 16 aide - Advanced Intrusion Detection Environment 17 aide [parameters] command 18 Commands: 19 -i, --init Initialize the database 20 -C, --check Check the database 21 -u, --update Check and update the database non-interactively 22 --compare Compare two databases 23 Miscellaneous: 24 -D, --config-check Test the configuration file 25 -v, --version Show version of AIDE and compilation options 26 -h, --help Show this help message 27 Options: 28 -c [cfgfile] --config=[cfgfile] Get config options from [cfgfile] 29 -B "OPTION" --before="OPTION" Before configuration file is read define OPTION 30 -A "OPTION" --after="OPTION" After configuration file is read define OPTION 31 -r [reporter] --report=[reporter] Write report output to [reporter] url 32 -V[level] --verbose=[level] Set debug message level to [level] 33 34 35 修改配置文件 36 vim /etc/aide.conf ( 指定对哪些文件进行检测) 37 /test/chameleon R 38 /bin/ps R+a 39 /usr/bin/crontab R+a 40 /etc PERMS 41 !/etc/mtab # “!” 表示忽略这个文件的检查 42 R=p+i+n+u+g+s+m+c+md5 权限+ 索引节点+ 链接数+用户+ 组+ 大小+ 最后一次修改时间+ 创建时间+md5 校验值 43 NORMAL = R+rmd60+sha256 44 初始化默认的AIDE 的库: 45 /usr/local/bin/aide --init 46 生成检查数据库(建议初始数据库存放到安全的地方) 47 cd /var/lib/aide 48 mv aide.db.new.gz aide.db.gz 49 检测: 50 /usr/local/bin/aide --check 51 更新数据库 52 aide --update