第 8 章 应用安全策略

在原位升级过程中,必须禁用某些安全策略。RHEL 8 引进了系统范围加密策略的新概念,同时安全配置可能包含主要发行本之间的更改。要使您的系统更安全,请将 SELinux 切换到 enforcing 模式,并设置系统范围的加密策略。您可能还希望修复系统,以符合特定的安全配置文件。

8.1. 将 SELinux 模式改为 enforcing

在原位升级过程中,Leapp 会将 SELinux 的模式设置为 permissive。当成功升级系统时,您必须手动将 SELinux 模式改为 enforcing。

先决条件

流程

  1. 确保没有 SELinux denials,例如,使用 ausearch 工具程序:

    # ausearch -m AVC,USER_AVC -ts boot

    请注意,上一步只涵盖最常见的情况。要检查所有可能的 SELinux denials,请查看使用 SELinux 中的 识别 SELinux denials 部分。

  2. 在您选择的文本编辑器中打开 /etc/selinux/config 文件,例如:

    # vi /etc/selinux/config
  3. 配置 SELINUX=enforcing 选项:

    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    #       enforcing - SELinux security policy is enforced.
    #       permissive - SELinux prints warnings instead of enforcing.
    #       disabled - No SELinux policy is loaded.
    SELINUX=enforcing
    # SELINUXTYPE= can take one of these two values:
    #       targeted - Targeted processes are protected,
    #       mls - Multi Level Security protection.
    SELINUXTYPE=targeted
  4. 保存更改,重启系统:

    # reboot

验证

  1. 系统重启后,确认 getenforce 命令返回 Enforcing:

    $ getenforce
    Enforcing