AL2023 的默认 SELinux 状态和模式 - Amazon Linux 2023
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

AL2023 的默认 SELinux 状态和模式

对于 AL2023,SELinux 默认设置为模式,enabled并设置为模式。permissivepermissive 模式下,记录但不强制执行权限拒绝。

getenforcesestatus 命令会告诉您当前的 SELinux 状态、策略和模式。

当默认状态设置为 enabledpermissive 时,getenforce 命令返回 permissive

sestatus命令返回 SELinux 状态和当前 SELinux 政策,如以下示例所示:

$ sestatus SELinux status: enabled SELinuxfs mount: /sys/fs/selinux SELinux root directory: /etc/selinux Loaded policy name: targeted Current mode: permissive Mode from config file: permissive Policy MLS status: enabled Policy deny_unknown status: allowed Memory protection checking: actual (secure) Max kernel policy version: 33

当您在permissive模式下运行 SELinux 时,用户可能会错误地标记文件。当您在 disabled 状态下运行 SELinux 时,不会标记文件。当您改为 enforcing 模式时,不正确或未标记的文件都可能导致问题。

为了避免此问题,SELinux 会自动重新标记文件。当您将状态改为 enabled 时,SELinux 可通过自动重新标记来防止出现标记问题。