Selinux阻塞模块,seboolean“nis_enabled”是否足够安全?

vhipe2zx  于 2023-05-28  发布在  Linux
关注(0)|答案(1)|浏览(96)

我最近使用vmalert模块(Victoriametrics产品)配置了警报系统。在我的系统上,有一个强制执行的SELinux策略,它将保持不变。当尝试运行vmalert时,它被SELinux阻止。
直到我grep audit.log的内容并将其提供给audit2allow以创建策略时,才发生这种情况。此外,我可以通过在Selinux中启用“nis boolean”来确保它正常工作。不过,我坚信有更好的方法让它运行。在这方面的任何援助都是值得赞赏的。下面是建议加载到Selinux中的策略片段:

module vmalert 1.0;

    require {
    type init_t;
    type unreserved_port_t;
    type http_port_t;
    class tcp_socket name_connect;
    }

    #============= init_t ==============

    #!!!! This avc can be allowed using the boolean 'nis_enabled'
    allow init_t http_port_t:tcp_socket name_connect;

    #!!!! This avc can be allowed using the boolean 'nis_enabled'
    allow init_t unreserved_port_t:tcp_socket name_connect;
46scxncf

46scxncf1#

您可以只允许被阻止的内容(到http端口和未保留端口的TCP连接):

cat << EOF > vmalert.te
module vmalert 1.0;

require {
type init_t;
type unreserved_port_t;
type http_port_t;
class tcp_socket name_connect;
}

#============= init_t ==============

allow init_t http_port_t:tcp_socket name_connect;
allow init_t unreserved_port_t:tcp_socket name_connect;
EOF
checkmodule -M -m -o vmalert.mod vmalert.te
semodule_package -o vmalert.pp -m vmalert.mod
semodule -i vmalert.pp

相关问题