您所在的位置: 首页>>读书频道>>操作系统>>Linux>>

3.4.2 target二进制策略目录与文件说明

http://book.51cto.com  2007-12-27 12:50  倪继利 著  电子工业出版社博文视点  我要评论(0)
  • 摘要:《Linux安全体系分析与编程》第三章分析了SELinux的安全机制,介绍了安全策略配置语言、内核策略库的结构,简述了SELinux内核模块的实现,还分析了用户空间的客体管理器。本文主要介绍的是target二进制策略目录与文件说明。
  • 标签:Linux  目录  target  策略  Linux安全体系分析与编程

3.4.2  target二进制策略目录与文件说明

1.目录/etc/selinux/targeted/booleans

/etc/selinux/targeted/booleans 是Boolean的默认设置,其内容列出如下:

$ cat /etc/selinux/targeted/booleans
allow_ypbind=1
dhcpd_disable_trans=1
httpd_disable_trans=0
httpd_enable_cgi=1
httpd_enable_homedirs=1
httpd_ssi_exec=1
httpd_tty_comm=0
httpd_unified=1
mysqld_disable_trans=0
named_disable_trans=0
named_write_master_zones=0
nscd_disable_trans=0
ntpd_disable_trans=0
portmap_disable_trans=0
postgresql_disable_trans=0
snmpd_disable_trans=0
squid_disable_trans=0
syslogd_disable_trans=0
winbind_disable_trans=0
ypbind_disable_trans=0

用Boolean定义可选策略的状态,允许在运行时设置可选策略规则的状态。内核访问/selinux/booleans/*下的Boolean值,每个Boolean是一个文件。

运行echo "1 1" > squid_disable_trans,关闭从unconfined_t和squid_t类型转移。

接着运行echo 1 > /selinux/commit_pending_bools让切换起作用,将/etc/selinux/targeted/booleans中的值切换到squid_disable_trans=1。更方便的方法是使用setsebool命令来切换Boolean。

改变了/etc/selinux/targeted/booleans值后,在一次策略装载(如:重启动或make load)时,改变了的策略才起作用。
Boolean是通过编译进二进制策略的if条件语句进行工作的,每个策略文件中存在条件分支。如果查找selinux文件系统的Boolean文件,如:cat /selinux/booleans/httpd_unified/,则得到两个值:1 1,第一个值代表当前的值,另一个代表重装载时security_commit_booleans()运行将设置的值。或者当运行命令setsebool -P时,将所有要修改的Boolean值写到硬件。

2./etc/selinux/targeted/contexts/

这个目录含有运行时各个应用程序使用的安全上下文信息,在contexts/下有许多文件和目录,其中,最重要的文件和目录说明如下:

—  default_contexts文件定义了默认的安全上下文,用于本地或远程用户会话、克隆工作等。

—  files/子目录含有安全上下文配置文件,应用程序(如:rpm、restorecon、setfiles和udev等)在运行时用它们给文件打上标签。

—  userhelper_context 文件给使用的userhelper应用程序设置上下文。

【责任编辑:董书 TEL:(010)68476606】

回书目   上一节   下一节
安全防范与策略
Linux——从菜鸟到高手
补丁自动分发管理策略专题
Linux/Solaris服务器的安全配置
Linux 集群技术专题
 
 验证码: (点击刷新验证码)   匿名发表
  • 野蛮生长

  • 作者:冯仑著
  • “地产界的思想家”冯仑纵横生意江湖20年来,第一次系统梳理出书。  三十年来中国民营企业从前公司时代发展到公司时代,21..
Copyright©2005-2008 51CTO.COM 版权所有