7.2. 为数据机密配置多类别安全性
默认情况下,多类别安全(MCS)在 targeted
和 mls
SELinux 策略中处于活跃状态,但不是为用户配置的。在 targeted
策略中,仅针对以下内容配置 MCS:
- OpenShift
- virt
- sandbox
- 网络标记
-
containers (
container-selinux
)
您可以通过创建本地 SELinux 模块并将 user_t
SELinux 类型限制在类型强制的情况下,将 MCS 规则配置为分类用户的 MCS 规则。
警告
更改某些文件的类别可能会导致某些服务无法正常运行。如果您并不是相关系统的专家,请联系红帽销售代表并请求咨询服务。
先决条件
-
SELinux 模式设置为
enforcing(强制)
模式。 -
SELinux 策略被设置为
targeted
或mls
。 -
已安装
policycoreutils-python-utils
和setools-console
软件包。
步骤
创建一个新文件,例如名为
local_mcs_user.cil
:vim local_mcs_user.cil
# vim local_mcs_user.cil
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 插入以下规则:
(typeattributeset mcs_constrained_type (user_t))
(typeattributeset mcs_constrained_type (user_t))
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 安装策略模块:
semodule -i local_mcs_user.cil
# semodule -i local_mcs_user.cil
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
验证
对于每个用户域,显示所有组件的更多详情:
seinfo -xt user_t
# seinfo -xt user_t Types: 1 type user_t, application_domain_type, nsswitch_domain, corenet_unlabeled_type, domain, kernel_system_state_reader, mcs_constrained_type, netlabel_peer_type, privfd, process_user_target, scsi_generic_read, scsi_generic_write, syslog_client_type, pcmcia_typeattr_1, user_usertype, login_userdomain, userdomain, unpriv_userdomain, userdom_home_reader_type, userdom_filetrans_type, xdmhomewriter, x_userdomain, x_domain, dridomain, xdrawable_type, xcolormap_type;
Copy to Clipboard Copied! Toggle word wrap Toggle overflow