Linux开源入侵检测工具-RKHunter
简介
RKHunter是专业检测系统是否感染rootkit的工具,通过执行一系列脚本来确定服务器是否感染rootkit。RKHunter可以做到:
MD5校验,检测文件是否有改动
检测rootkit使用的二进制和系统工具文件
检测特洛伊木马程序特征码
检测常用程序的文件属性是否正常
检测系统相关测试
检测隐藏文件
检测可以的核心模块LKM
检测系统已启动的监听端口
安装RKHunter
[][][]total 40drwxr-xr-x. 5 root root 4096 Feb 24 2018 files-rwxr-xr-x. 1 root root 33580 Feb 19 2018 installer.sh[]Checking system for:Rootkit Hunter installer files: foundA web file download command: wget foundStarting installation:Checking installation directory "/usr/local": it exists and is writable.Checking installation directories:Directory /usr/local/share/doc/rkhunter-1.4.6: creating: OKDirectory /usr/local/share/man/man8: exists and is writable.Directory /etc: exists and is writable.................
常用参数列表
| 参数 | 含义 |
| -c, --check | 必选参数,表示检测当前系统 |
| --configfile <file> | 使用特定配置文件 |
| --cronjob | 作为cron任务定期运行 |
| --sk, --skip-keypress | 自动完成所有检测,跳过键盘输入 |
| --summary | 显示检测结果的统计信息 |
| --update | 检测更新内容 |
| -V, --version | 显示版本信息 |
| --versioncheck | 检测最新版本 |
| --propupd [file | directory ] | 建立样本文件,建议安装完系统就建立 |
检测示例
[root@master rkhunter-1.4.6]# rkhunter -c[ Rootkit Hunter version 1.4.6 ]Checking system commands...Performing 'strings' command checksChecking 'strings' command [ OK ]Performing 'shared libraries' checksChecking for preloading variables [ None found ]Checking for preloaded libraries [ None found ]Checking LD_LIBRARY_PATH variable [ Not found ]Performing file properties checksChecking for prerequisites [ Warning ]/usr/local/bin/rkhunter [ OK ]/usr/sbin/adduser [ OK ].......
每项检测结果都高亮显示,绿色表示正常,红色表示需要引起关注,上面的检测需要与用户交互输入“回车”,可以使用--sk选项使其自动检测:
rkhunter --check --skip-keypress
也可以写成定时任务
00 3 * * * /usr/local/bin/rkhunter --check --cronjob
