使用auditctl命令完成给一个文件设定监控:
[root@host]# auditctl -w /etc/hosts -p war -k hosts-file
在这里,在/etc/hosts文件上设定了一个监控,针对任意有可能会执行写、读或者改变属性(-p war)的系统调用(syscall)。这将会以key hosts-file的方式记录下来。key可以用来在audit日志中查找那些操作,使用ausearch命令:
引用:[root@host]# ausearch -ts today -k hosts-file
---
time->Sat Feb 3 07:32:20 2007
type=PATH msg=audit(1170451940.872:34): item=0 name=”/etc/hosts” inode=1308742 dev=fd:00 mode=0100644 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:etc_t:s0
type=CWD msg=audit(1170451940.872:34): cwd=”/root”
type=SYSCALL msg=audit(1170451940.872:34): arch=40000003 syscall=226 success=yes exit=0 a0=867c4b8 a1=458bcc4f a2=8686800 a3=1c items=1 ppid=3544 pid=3558 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 comm=”vim” exe=”/usr/bin/vim” subj=root:system_r:unconfined_t:s0-s0:c0.c1023 key=”hosts-files”
[root@host]#
从这次跟踪,可以看出/etc/hosts文件是被vim命令编辑,运行了/usr/bin/vim命令,运行这个命令的用户带有root:system_r:unconfined_t:s0-s0:c0.c1023这样的属性。


521renjian 于 2011-11-28 09:12:22发表:
麻烦哪位大侠,帮忙解释下结果中都代表什么意思?