SELinux杂谈

----------------------------- 文末有推荐参考文档列表---------------------------

SELinux(Security Enhanced Linux)是一个Mandatory Access Control System,相应的,传统的Linux访问控制形式称为Regular Access Control,或者Discretionary Access Control(DAC)。SELinux使用内核提供的LSM(Linux Security Modules)接口与Kernel打交道。除了SELinux,也存在其他符合LSM接口规范的MAC系统,如AppArmor。

我们首先看一下传统的Regular Access Control是如何工作的。

比如说用户想要执行一个script,DAC将检查当前正在运行的用户进程(一般是shell)权限和该script权限。假设script访问权限是rwxr-x--x,那么用户总是可以执行这个script;如果script权限是rwxr-x---,那么只有当shell进程所属group是该script所在的group,用户才能执行该script。

这种访问控制方式的问题在于,只要一个人对某个文件有读权限,他实质上就可以将该文件的任何权限任意赋予系统中的任何人。例如我们在系统上创建了一个developer group,并希望只有该组内的成员才能运行compiler。但是该组内的任何成员完全可以将compiler复制到自己的HOME目录,并修改复制体的权限位,使得系统中任何人都可以执行compiler。

-------------------------------- 参考文档列表 -------------------------------------

可以先看一下gentoo wiki上的一篇Quick Introduction:

https://wiki.gentoo.org/wiki/SELinux/Quick_introduction

然后看进一步的讨论:

https://wiki.gentoo.org/wiki/SELinux

https://wiki.gentoo.org/wiki/SELinux/Tutorials

https://fedoraproject.org/wiki/SELinux

https://en.wikipedia.org/wiki/Security-Enhanced_Linux

https://wiki.archlinux.org/index.php/SELinux

原文地址:https://www.cnblogs.com/byeyear/p/9303429.html