RedHat7 SELinux

SELinux(Security-Enhanced Linux) 是美国国家安全局(NSA)对于强制访问控制的实现,是 Linux历史上最杰出的新安全子系统。NSA是在Linux社区的帮助下开发了一种访问控制体系,在这种访问控制体系的限制下,进程只能访问那些在他的任务中所需要文件。SELinux 默认安装在 Fedora 和 Red Hat Enterprise Linux 上,也可以作为其他发行版上容易安装的包得到。

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@www ~]# 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  <==目前仅有 targeted 与 strict 

5,通过命令更改SELinux模式

[root@www ~]# setenforce [0|1]

选项与参数:  

0 :转成 permissive 宽容模式;

1 :转成 Enforcing 强制模式

 

posted @ 2015-10-15 00:14  Edward Guan  阅读(867)  评论(0编辑  收藏  举报