我们知道,SELinux 是预先配置的,可以在不进行任何手动配置的情况下使用 SELinux 功能。然而,一般来说,预先配置的 SELinux 设置很难满足所有的 Linux 系统安全需求。
SELinux 配置只能有 root 用户进行设置和修改。配置和策略文件位于 /etc/selinux 目录中,主配置文件位 /etc/selinux/config 文件,该文件中的内容如下:
[root@localhost ~]# vim /etc/selinux/config
# 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
#指定SELinux的运行模式。有enforcing(强制模式)、permissive(宽容模式)、disabled(不生效)三种模式
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted