android 如何添加被denied的权限
来源:互联网 发布:淘宝虚标电池 编辑:程序博客网 时间:2024/05/02 03:01
security context
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
如上,系统中的所有对象都被打上了一个security context的标签,这些对象包括文件,目录,进程,socket,drivers等等。而security context中最重要的是第三列的type。
下面看下这个type到底是如何使用的。
policy rule
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
And so an example use of this would follow the structure:
allow appdomain app_data_file:file rw_file_perms;
This says that all application domains are allowed to read and write files labeled app_data_file. Note that this rule relies upon macros defined in the global_macros file, and other helpful macros can also be found in the te_macros file, both of which can be found in the external/sepolicy directory in the AOSP source tree. Macros are provided for common groupings of classes, permissions and rules, and should be used whenever possible to help reduce the likelihood of failures due to denials on related permissions.
通过denied log添加policy rule
例如下面一个denied log,
type=1400 audit(0.0:7): avc: denied { open } for path=”/system/bin/sh” dev=”mmcblk0p23” ino=724 scontext=u:r:system_server:s0tcontext=u:object_r:shell_exec:s0 tclass=file permissive=0
注意上面log中加深的部分,分别对应:
a, source-type, scontext=u:r:system_server:s0中的第三列,即system_server。
b, destination-type, tcontext=u:object_r:shell_exec:s0中的第三列,即shell_exec。
c, Class,tclass=file,即为file。
d, Permission,{ open },即为open。
所以需要添加的policy rule为,
allow system_server shell_exec:file open
上述命令表示允许打着system_server 标签的domain,即进程去open打着shell_exec标签的文件。上面例子是在security context 已经定义的情况下,根据denied log添加policy rule的过程,下面以新建一个led灯的读写权限为例,允许system_app去读写这个led灯(当然system_app的security context系统早就定义好了)。
1.定义新的一个type
- 1
- 1
这个type的名字为sysfs_button_backlight,为sysfs类型。
2.定义sys文件的security context
- 1
- 1
定义led灯sys文件系统中节点的security context。有了security context,domain就能访问了。
3.添加system_app对led的读写权限
- 1
- 1
允许system_app这个domain,进程,去读写label为sysfs_button_backlight的文件。
- android 如何添加被denied的权限
- seandroid 如何添加被denied的权限
- seandroid 如何添加被denied的权限(avc denied)
- Android如何添加权限
- 【转】android如何添加权限
- Android系统中如何添加权限
- Android 6.0 权限的添加
- android 6.0 读取sd卡上文件报错,manifest已经添加权限, open failed: EACCES (Permission denied)
- android Permission denied错误 权限设置
- android selinux权限, Permission denied, 访问限制
- 6.0Android 各种权限添加的方法:
- Android Studio 的使用之添加权限
- Android系统中如何添加权限-----以TP为例
- android 添加各种权限
- android添加权限说明
- android添加权限说明
- android 添加sensor 权限
- android添加权限说明
- ARM Linux 3.x的设备树(Device Tree)
- Android框架学习之Retrofit(三)retrofit和okhttp的区别
- bfs编译失败,编译gflags时缺少config.h
- Fried Fish(向上取整问题)ceil函数
- 使用Axis2创建WebService实例
- android 如何添加被denied的权限
- SQL表内查重和删重
- Java中httpClient中的三种超时设置小结
- 51nod 最大子段和(Java)
- Spark 2.1 structured streaming
- Flask-REST架构
- android 蓝牙模块连接
- [Python模块学习]使用getpass模块无回显输入
- centos7安装mysql5.7解压缩版