在红帽企业版Linux 5中,怎样去掉/var/log/audit/audit.log文件中的虚假audit信息?
解决方法:
SELinux有时候会禁止一个应用程序的合理使用,并且当该应用被使用时,产生audit信息。当确定被禁止的操作事实上属于合法的,可以使用audit2allow命令生成SELinux规则去删除那些信息。
警告:使用audit2allow存在潜在安全隐患,因为它可以被使用去允许那些真正被拒绝的操作。在允许操作之前应核实那些将要执行的操作事实上是合理的。
对于以下给出的AVC信息,使用audit2allow可以生成SELinux规则:
type=AVC msg=audit(1170457119.592:91): avc: denied { use } for pid=4456 comm="setsebool" name="0" dev=devpts ino=2 scontext=system_u:system_r:semanage_t:s0 tcontext=system_u:system_r:init_t:s0 tclass=fd
[root@host]# ausearch -x setsebool | audit2allow -M setseboolfix
Generating type enforcement file: setseboolfix.te
Compiling policy
checkmodule -M -m -o setseboolfix.mod setseboolfix.te
semodule_package -o setseboolfix.pp -m setseboolfix.mod
******************** IMPORTANT ***********************
In order to load this newly created policy package into the kernel,
you are required to execute
semodule -i setseboolfix.pp
[root@host]#
现在,可以讲模块插入到SELinux,使用:
semodule
命令:
[root@host]# semodule -i setseboolfix.pp