大网数据广告活动
服务器运维问答

Are custom SELinux policy modules portable?

· 52CE 我爱测

If I take a policy created, say, using audit2allow -M and install it on multiple servers, will it work as expected or is there something special happening when the policies are created? Ideally I'd like to deploy using Ansible.

问题原文

原帖链接 · Mark C · CC BY-SA 4.0

If I take a policy created, say, using audit2allow -M and install it on multiple servers, will it work as expected or is there something special happening when the policies are created? Ideally I'd like to deploy using Ansible.

已采纳解答

原帖链接 · filbranden · CC BY-SA 4.0

SELinux policy modules are portable and can be copied and reused on other servers.

As long as the servers are using the same policies (versions of the same policies are ok.) For instance, if all your servers are using the "targeted" policy (which is the default on RHEL/CentOS/Fedora), then you should be fine. Some version differences might be tolerable.

Distinct policies might be incompatible with each other, since they define SELinux types (essentially labels, names), these names will be all over your policy modules, so the modules only make sense in hosts that are using the same SELinux types. Furthermore, the rules encoded in that policy module needs to make sense in context of the other rules already in the policy. So that's why you need same (or almost same) policy for this to work.

But other than that, the modules themselves use a portable format, you can easily ship them in binary format and have them loaded on other machines, without having to install the tools that build such modules in the target machines.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-08-15)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。