当前位置 主页 > 服务器问题 > Linux/apache问题 >
/selinux/伪文件系统kernel子系统通常使用的命令,它类似于/proc/伪文件系统。系统管理员和用户不需要操作这部分。/selinux/目录举例如下:
-rw-rw-rw- 1 root root 0 Sep 22 13:14 access dr-xr-xr-x 1 root root 0 Sep 22 13:14 booleans --w------- 1 root root 0 Sep 22 13:14 commit_pending_bools -rw-rw-rw- 1 root root 0 Sep 22 13:14 context -rw-rw-rw- 1 root root 0 Sep 22 13:14 create --w------- 1 root root 0 Sep 22 13:14 disable -rw-r--r-- 1 root root 0 Sep 22 13:14 enforce -rw------- 1 root root 0 Sep 22 13:14 load -r--r--r-- 1 root root 0 Sep 22 13:14 mls -r--r--r-- 1 root root 0 Sep 22 13:14 policyvers -rw-rw-rw- 1 root root 0 Sep 22 13:14 relabel -rw-rw-rw- 1 root root 0 Sep 22 13:14 user
如cat enforce其值可能如下:
1: enforcing mode
0: permissive mode
4. SELinux配置文件
SELinux配置文件(configuration)或策略文件(policy)位于/etc/目录下。
4.1 /etc/sysconfig/selinux配置文件
/etc/sysconfig/selinux是一个符号链接,真正的配置文件为:/etc/selinux/config
配置SELinux有如下两种方式:
1) 使用配置工具:Security Level Configuration Tool (system-config-selinux)
2) 编辑配置文件 (/etc/sysconfig/selinux).
/etc/sysconfig/selinux中包含如下配置选项:
1) 打开或关闭SELinux
2) 设置系统执行哪一个策略(policy)
3) 设置系统如何执行策略(policy)
4.2 配置文件选项
4.2.1 SELINUX
SELINUX=enforcing|permissive|disabled —定义SELinux的高级状态
enforcing — The SELinux security policy is enforced. permissive — The SELinux system prints warnings but does not enforce policy. disabled — SELinux is fully disabled. SELinux hooks are disengaged from the kernel and the pseudo-file system is unregistered.4.2.2 SELINUXTYPE(安全策略)
SELINUXTYPE=targeted|strict — 指定SELinux执行哪一个策略
targeted — 只有目标网络daemons保护。每个daemon是否执行策略,可通过system-config-selinux进行配置。保护常见的网络服务,为SELinux默认值。
可使用如下工具设置每个daemon的布尔值:
1) getsebool -a: 列出SELinux的所有布尔值
2) setsebool: 设置SELinux布尔值,如:setsebool -P dhcpd_disable_trans=0,-P表示即使用reboot之后,仍然有效。
strict — 对SELinux执行完全的保护。为所有的subjects和objects定义安全环境,且每一个Action由策略执行服务器处理。提供符合Role-based-Access Control(RBAC)之policy,具备完整的保护功能,保护网络服务、一般指令及应用程序。4.2.3 SETLOCALDEFS