前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >S010SEAndroid中相关命令(一)seinfo

S010SEAndroid中相关命令(一)seinfo

作者头像
上善若水.夏
发布2018-09-28 11:14:02
8760
发布2018-09-28 11:14:02
举报
文章被收录于专栏:上善若水上善若水

类型强制的安全上下文(Type Enforcement Security Context)

安全上下文是一个简单的、一致的访问控制属性,在SELinux中,类型标识符是安全上下文的主要组成部分,由于历史原因,一个进程的类型通常被称为一个域(domain),"域"和"域类型"意思都一样,我们不必苛刻地去区分或避免使用术语域,通常,我们认为【域】、【域类型】、【主体类型】和【进程类型】都是同义的,即都是安全上下文中的“TYPE”。

安全上下文格式

代码语言:javascript
复制
USER:ROLE:TYPE[LEVEL[:CATEGORY]]

LEVEL和CATEGORY:定义层次和分类,只用于mls策略中

代码语言:javascript
复制
• LEVEL:代表安全等级,目前已经定义的安全等级为s0-s15,等级越来越高
• CATEGORY:代表分类,目前已经定义的分类为c0-c1023

Android Selinux命令

SELinux的策略与规则管理:seinfo,sesearch,setsebool,semanage 一个主体进程能否读取到目标文件资源的重点是在于SELinux的策略以及策略内的各项规则,然后再通过该规则的定义去处理各项目标文件的安全上下文,尤其是“类型”部分。

seinfo策略查阅

策略提供多少相关的规则呢,用seinfo查阅。

代码语言:javascript
复制
#seinfo  --help
Usage: seinfo [OPTIONS] [EXPRESSION] [POLICY ...]

Print information about the components of a SELinux policy.

EXPRESSIONS:
  -c[NAME], --class[=NAME]         print object classes 列出所有的客体限制类别类
  --sensitivity[=NAME]             print sensitivities  打印安全级别
  --category[=NAME]                print categories     分类
  -t[NAME], --type[=NAME]          print types (no aliases or attributes) 包含的所有的type
  -a[NAME], --attribute[=NAME]     print type attributes 所有的属性
  -r[NAME], --role[=NAME]          print roles
  -u[NAME], --user[=NAME]          print users
  -b[NAME], --bool[=NAME]          print conditional booleans  列出与 httpd 有关的规则 (booleans) 有哪些?  seinfo -b | grep httpd
  --constrain                      print constrain statements  显示系统中的约束。但是它立刻返回的是完全展开的输出,使用的是数学表达式上的语法
  --initialsid[=NAME]              print initial SIDs
  --fs_use[=TYPE]                  print fs_use statements
  --genfscon[=TYPE]                print genfscon statements
  --netifcon[=NAME]                print netif contexts
  --nodecon[=ADDR]                 print node contexts
  --permissive                     print permissive types
  --polcap                         print policy capabilities
  --portcon[=PORT]                 print port contexts
  --protocol=PROTO                 specify a protocol for portcons
  --all                            print all of the above
OPTIONS:
  -x, --expand                     show more info for specified components
  --stats                          print useful policy statistics
  -l, --line-breaks                print line breaks in constrain statements
  -h, --help                       print this help text and exit
  -V, --version                    print version information and exit

For component options, if NAME is provided, then only show info for
NAME.  Specifying a name is most useful when used with the -x option.
If no option is provided, display useful policy statistics (-s).

The default source policy, or if that is unavailable the default binary
policy, will be opened if no policy is provided.

seinfo [-Atrub]
  --all:列出SELinux的状态、规则布尔值、身份识别、角色、类型等所有信息
  -t:列出SELinux所有类型(type)的种类
  -r:列出SELinux所有角色(role)的种类
  -u:列出SELinux所有身份识别(user)的种类
  -b:列出所有规则的种类(布尔值)

参考链接

seinfo

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2016.10.18 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 类型强制的安全上下文(Type Enforcement Security Context)
  • 安全上下文格式
    • seinfo策略查阅
    • 参考链接
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档