[root@localhost ~]# seinfo -b
#还记得-b选项吗?就是查询布尔值,也就是查询规则名字
Conditional Booleans:187
#当前系统中有187个规则
allow_domain_fd_use
allow_ftpd_full_access
allow_sysadm_exec_content
allow_user_exec_content
allow_zebra_write_config
…省略部分输出…
[root@localhost ~]# sesearch [选项] [规则类型] [表达式]
选项:[root@localhost ~]# seinfo -b | grep http
httpd_manage_ipa
…省略部分输出…
#查询和apache相关的规则,有httpd_manage_ipa规则
[root@localhost ~]# sesearch --all -b httpd_manage_ipa
# httpd_manage_ipa规则中具体定义了哪些规则内容呢?使用sesearch命令查询一下
Found 4 semantic av rules:
allow httpd_t var_run_t:dir { getattr search open } ;
allow httpd_t memcached_var_run_t:file { ioctl read write create getattr setattr lock append unlink link rename open } ;
allow httpd_t memcached_var_run_t:dir { ioctl read write getattr lock add_name remove_name search open } ;
allow httpd_t var_t:dir { getattr search open } ;
Found 20 role allow rules:
allow system_r sysadm_r;
allow sysadm_r system_r;
…省略部分输出…
[root@localhost ~]# ps auxZ | grep httpd
unconfined_u:system_r:httpd_t:s0 root 25620 0.0 0.5 11188 36X6 ? Ss
03:44 0:03 /usr/sbin/httpd
#apache进程的域是httpd_t
[root@localhost ~]# ls -Zd /var/www/html/
drwxr-xr-x. root root system_u:object_r:httpd_sys_content_t:s0 /var/www/html/
#/var/www/html/ 目录的类型是 httpd_sys_content_t
[root@localhost ~]# sesearch --all -s httpd_t -t httpd_sys_content_t Found 13 semantic av rules:
...省略部分输出...
allow httpd_t httpd_sys_content_t : file { ioctl read getattr lock open };
allow httpd_t httpd_sys_content_t : dir { ioctl read getattr lock search open };
allow httpd_t httpd_sys_content_t : lnk_file { read getattr };
allow httpd_t httpd_sys_content_t : file { ioctl read getattr lock open };
...省略部分输出...
#可以清楚地看到httpd_t域是允许访间和使用httpd_sys_content_t类型的
新闻热点
疑难解答