这个tripwire.verify文件是一个小型脚本,由服务器的 crond 程序每天执行,以扫描硬盘上可能已更改的文件或目录,并将结果通过邮件发送给系统管理员。此脚本将为您自动化完整性检查过程。如果您打算自动化此任务,请按照以下简单步骤操作。
创建tripwire.verify脚本文件,touch/etc/cron.daily/tripwire.verify并添加到此脚本中
#!/bin/sh /usr/sbin/tripwire -loosedir -q | (cat <<EOF This is an automated report of possible file integrity changes, generated by the Tripwire integrity checker. To tell Tripwire that a file or entire directory tree is valid, as root run: /usr/sbin/tripwire -update [pathname|entry] If you wish to enter an interactive integrity checking and verification session, as root run: /usr/sbin/tripwire -interactive Changed files/directories include: EOF cat ) | /bin/mail -s "File integrity report" root |
现在,使此脚本可执行,并使用以下命令将其模式更改为 0700
[root@deep] /# chmod 700 /etc/cron.daily/tripwire.verify |
为了更好的安全性,建议将 Tripwire 的数据库tw.db_[hostname]文件移动到某个地方,例如 软盘,使其无法被修改。这一点很重要,因为来自 Tripwire 的数据是否可信取决于其数据库。还建议您立即制作数据库内容的纸质副本。如果您怀疑数据库的完整性,您将能够手动将信息与此纸质副本进行比较。
有关更多详细信息,请查阅更多文档,您可以阅读以下 man 手册
- Tripwire 的签名生成例程
- UNIX 系统的文件完整性检查器
- Tripwire 的配置文件
下一节中列出的命令是我们经常在常规使用中使用的一些命令,但还有更多命令存在。请查阅 man 手册以获取更多详细信息。