现在的位置: 首页 > 综合 > 正文

一些关于sulinux的知识

2012年10月31日 ⁄ 综合 ⁄ 共 2550字 ⁄ 字号 评论关闭
在Redhat Enterprise Linux 4.0或Fedora Core 2 Linux以 上版本的Linux中,有不少用户经常会遇到诸如apache的Permission denied,X windows打不开等等问题,抛开一些常规配 置错误外,很大一部分原因是因为激活了SELinux的缘故。

什么是SELinux?SELinux全称是 Security Enhanced Linux,由美国国家安全部(National Security Agency)领导开发的GPL项目,它拥有 一个灵活而强制性的访问控制结构,旨在提高Linux系统的安全性,提供强健的安全保证,可防御未知攻击,据称相当于B1级的军事安全性能。比MS NT 所谓的C2等高得多。

应用SELinux后,可以减轻恶意攻击或恶意软件带来的灾难,并提供对机密性和完整性有很高要求的信息很高的安全保障。

SELinux vs Linux
普 通Linux安全和传统Unix系统一样,基于自主存取控制方法,即DAC,只要符合规定的权限,如规定的所有者和文件属性等,就可存取资源。在传统的安 全机制下,一些通过setuid/setgid的程序就产生了严重安全隐患,甚至一些错误的配置就可引发巨大的漏洞,被轻易攻击。

而SELinux则基于强制存取控制方法,即MAC,透过强制性的安全策略,应用程序或用户必须同时符合DAC及对应SELinux的MAC才能进行正常操作,否则都将遭到拒绝或失败,而这些问题将不会影响其他正常运作的程序和应用,并保持它们的安全系统结构。

SELinux on Redhat Linux
在RHEL4.0或FC3以上的版本中,可以在安装时就选择是否激活SELinux,系统自动会安装相应的内核、工具、程序等。由于SELinux的MAC机制将极大的影响了现有引用,因此RHEL4/FC3中已预配置了大量兼容现有应用的安全策略。

SELinux的配置相关文件都在/etc/selinux下,其中/etc/selinux/targeted目录里就包含了策略的详细配置和context定义,以下是主要文件及功用:
/etc/selinux/targeted/contexts/*_context 默认的context设置
/etc/selinux/targeted/contexts/files/* 精确的context类型划分
/etc/selinux/targeted/policy/* 策略文件

-----------------------------------------------
Q:  How do I turn SELinux off at boot?  
A: Set SELINUX=disabled in /etc/selinux/config. 

Alternatively, you can add selinux=0 to your kernel boot parameters. However, this option is not recommended. 
      Be careful when disabling SELinux 
If you boot with selinux=0, any files you create while SELinux is disabled do not have SELinux context information. The file system is marked for relabeling at the next boot. If an unforeseen problem prevents you from rebooting normally, you may need to boot in single-user mode for recovery. Add the option emergency to your kernel boot parameters. 

Q:  How do I turn enforcing on/off at boot? 
A: You can specify the SELinux mode using the configuration file /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= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted
  However, setting the value to disabled is not the same as the selinux=0 kernel boot parameter. Rather than fully disabling SELinux in the kernel, the disabled setting instead turns enforcing off and skips loading a policy. 

相关网址:::URL::http://fedora.redhat.com/docs/selinux-faq-fc5/#id2962490

抱歉!评论已关闭.