Sov*_*ero 5 selinux logrotate centos7
logrotate 无法在 CentOS 7 上为我们的应用程序轮换日志文件。这似乎是因为此 AVC 错误:
type=AVC msg=audit(1441112694.305:19502): avc: denied { write } for pid=9146 comm="logrotate" name="autuitive.log" dev="xvda1" ino=26262388 scontext=system_u:system_r:logrotate_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:usr_t:s0 tclass=file
Run Code Online (Sandbox Code Playgroud)
我将错误传递给了 audit2allow 实用程序以创建规则以允许它,但是当我尝试启用该规则时,出现以下错误:
[root@app1 ~]# semodule -i logrotate.pp
libsepol.print_missing_requirements: logrotate's global requirements were not met: type/attribute logrotate_t (No such file or directory).
libsemanage.semanage_link_sandbox: Link packages failed (No such file or directory).
semodule: Failed!
Run Code Online (Sandbox Code Playgroud)
这是生成的规则本身:
[root@app1 ~]# cat logrotate.te
module logrotate 1.0;
require {
type logrotate_t;
type usr_t;
class file write;
}
#============= logrotate_t ==============
allow logrotate_t usr_t:file write;
Run Code Online (Sandbox Code Playgroud)
我认为这是因为系统上已经有一个 logrotate.pp 文件 ( /etc/selinux/targeted/modules/active/modules/logrotate.pp
)。
您应该使用不同的名称创建本地策略,例如
audit2allow -M MY_logrotate <somefilewithmessages
Run Code Online (Sandbox Code Playgroud)
然后使用
semodule -i MY_logrotate.pp
Run Code Online (Sandbox Code Playgroud)
安装它。是的,这不是最好的错误消息。
归档时间: |
|
查看次数: |
2062 次 |
最近记录: |