Red Hat Training

A Red Hat training course is available for RHEL 8

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

默认情况下,Multi-Category Security (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
  2. 插入以下规则:

    (typeattributeset mcs_constrained_type (user_t))
  3. 安装策略模块:

    # semodule -i local_mcs_user.cil

验证

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

    # 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;