SELinux 上下文文档

SELinux 上下文文档

我正在尝试理解 SELinux,但一个问题一直浮现在我的脑海里:CONTEXT。

当我编写自定义规则和模块(在 CentOS 7 上)时,我最终只是从空中获取上下文——这是我目前的理解:

  • seinfo -t -x列出所有上下文及其属性。

  • sesearch显示所有当前规则,所以如果我对 httpd_t 当前可以访问的内容感兴趣,我会使用类似的方法sesearch -A -s httpd_t

  • semanage fcontext -l列出所有现有规则。

  • /etc/selinux/targeted/contexts这里有一些文件,例如 customizable_types,所以我最终使用了它们。

然而,我仍然只是凭空选择上下文,而没有关于应该使用什么上下文的真实信息。

我一直在各处寻找上下文描述,但似乎没有可用的 - 只有 apache 有:

httpd_php_tmp_t httpd_var_lib_t httpd_var_run_t httpd_user_htaccess_t httpd_sys_content_t httpd_sys_htaccess_t httpd_user_script_exec_t httpd_rotatelogs_t httpd_suexec_tmp_t httpd_unconfined_script_exec_t httpd_user_ra_content_t httpd_user_rw_content_t httpd_suexec_t httpd_config_t httpd_bool_t httpd_php_t httpd_tmp_t httpd_user_script_t httpd_helper_exec_t httpd_squirrelmail_t httpd_php_exec_t httpd_sys_ra_content_t httpd_sys_rw_content_t httpd_modules_t httpd_sys_script_t httpd_user_content_t httpd_suexec_exec_t httpd_unit_file_t httpd_unconfined_script_t httpd_initrc_exec_t httpd_t httpd_rotatelogs_exec_t httpd_passwd_t httpd_helper_t httpd_keytab_t httpd_exec_t httpd_lock_t httpd_log_t httpd_cache_t httpd_tmpfs_t httpd_sys_script_exec_t httpd_passwd_exec_t

一些上下文的名称是不言自明的,但是肯定有一些地方对此有所说明?

答案1

SELinux 上下文记录在策略模块手册页中。Apache SELinux 策略文档位于httpd_selinux请参阅手册页。

如果已经selinux-policy-devel安装,则可以通过运行以下命令生成手册页:

sepolicy manpage -a -p /usr/local/man/man8
mandb

(还询问上层建筑

相关内容