selinux配置

来源:互联网 发布:ubuntu如何下载anzqvim 编辑:程序博客网 时间:2024/05/18 03:29

SELinux 的启动、关闭与查看


1、并非所有的 Linux distributions 都支持SELinux 的
目前 SELinux 支持三种模式,分别如下:
•enforcing
:强制模式,代表 SELinux运作中,且已经正确的开始限制 domain/type了;
•permissive
:宽容模式:代表 SELinux运作中,不过仅会有警告讯息并不会实际限制 domain/type的存取。这种模式可以运来作为 SELinux debug 之用;
•disabled
:关闭,SELinux并没有实际运作。
 
2、
查看SELinux的模式
# getenforce
Enforcing  <==
就显示出目前的模式为 Enforcing
 
3、
查看 SELinux 的政策 (Policy)?
[root@master oracle]# sestatus
SELinux status:                enabled    <==
是否启动 SELinux
SELinuxfs mount:               /selinux   <==SELinux
的相关文件资料挂载点
Current mode:                  enforcing  <==
目前的模式
Mode from config file:         enforcing  <==
设定档指定的模式
Policy version:                 21
Policy from config file:       targeted   <==
目前的政策为何?
 
4、
通过配置文件调整SELinux的参数
[root@www ~]# vi /etc/selinux/config
SELINUX=enforcing     <==
调整 enforcing | disabled | permissive
SELINUXTYPE=targeted  <==
目前仅有 targetedstrict
 

5、SELinux 的启动与关闭

[root@www ~]# vi/boot/grub/menu.lst
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-92.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-92.el5 roroot=LABEL=/1 rhgb quiet selinux=0
        initrd /initrd-2.6.18-92.el5.img
#
如果要启动 SELinux ,则不可以出现 selinux=0 的字样在kernel 后面!


0 0