7.2. 为数据机密配置多类别安全性


默认情况下,多类别安全(MCS)在 targetedmls SELinux 策略中处于活跃状态,但不是为用户配置的。在 targeted 策略中,仅针对以下内容配置 MCS:

  • OpenShift
  • virt
  • sandbox
  • 网络标记
  • containers (container-selinux)

您可以通过创建本地 SELinux 模块并将 user_t SELinux 类型限制在类型强制的情况下,将 MCS 规则配置为分类用户的 MCS 规则。

警告

更改某些文件的类别可能会导致某些服务无法正常运行。如果您并不是相关系统的专家,请联系红帽销售代表并请求咨询服务。

先决条件

  • SELinux 模式设置为 enforcing(强制)模式。
  • SELinux 策略被设置为 targetedmls
  • 已安装 policycoreutils-python-utilssetools-console 软件包。

步骤

  1. 创建一个新文件,例如名为 local_mcs_user.cil

    # vim local_mcs_user.cil
    Copy to Clipboard Toggle word wrap
  2. 插入以下规则:

    (typeattributeset mcs_constrained_type (user_t))
    Copy to Clipboard Toggle word wrap
  3. 安装策略模块:

    # semodule -i local_mcs_user.cil
    Copy to Clipboard Toggle word wrap

验证

  • 对于每个用户域,显示所有组件的更多详情:

    # 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 Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat