在selinux中添加现有的策略

我刚刚创build了一个自定义策略,并做了semodule -i test.te.

几天后我重新开始了所有的testing,我注意到audit.log中还有另外的AVC拒绝。

我想添加新的东西到我现有的test.te文件,这样我就不会有多个策略。 我只想有一个政策,只是不断增加,这是可能的,如何? 提前致谢。

所有的程序在audit2allow(1)checkmodule(8)semodule(8)的manpages中都有很好的logging。

示例工作stream将是( 全部来自提到的手册):

  • 查看local.te并根据需要自定义
 $ cat local.te module local 1.0; require { class file { getattr open read }; type myapp_t; type etc_t; }; allow myapp_t etc_t:file { getattr open read }; 
  • 编译模块
 $ checkmodule -M -m -o local.mod local.te 
  • 创build包
 $ semodule_package -o local.pp -m local.mod 
  • 将模块加载到内核中
 $ semodule -i local.pp 
  • 安装或replace非基本策略包。
 $ semodule -i httpd.pp 
  • 列出非基本模块。
 $ semodule -l 

如果你的模块是版本化的,你可能会觉得有趣的使用semodule(8) -u开关:

 -u,--upgrade=MODULE_PKG upgrade an existing module package, or install if the module does not exist