再将selinux配置文件粗略解释下咯:
[root@localhost /]# cat /etc/sysconfig/selinux
# 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
SELINUX有「disabled」「permissive」,「enforcing」3种选择。
Disabled就不用说了,permissive就是Selinux有效,但是即使你违反了策略的话它让你继续操作,但是把你的违反的内容记录下来。在我们开发策略的时候非常的有用。
相当于Debug模式。
Enforcing就是你违反了策略,你就无法继续操作下去。
SELINUXTYPE呢,现在主要有2大类,一类就是红帽子开发的targeted,它只是对于,主要的网络服务进行保护,比如 apache,sendmail,bind,postgresql等,不属于那些domain的就都让他们在unconfined_t里,可导入性高,可用性好但是不能对整体进行保护。
另一类是Strict,是NAS开发的,能对整个系统进行保护,但是设定复杂,我认为虽然它复杂,但是一些基本的会了,还是可以玩得动的。
我们除了在/etc/sysconfig/selinux设它有效无效外,在启动的时候,也可以通过传递参数selinux给内核来控制它。(Fedora 5默认是有效)
kernel /boot/vmlinuz-2.6.15-1.2054_FC5 ro root=LABEL=/ rhgb quiet selinux=0
上面的变更可以让它无效。
