开发者论坛

标题: OpenHarmony之SeLinux介绍(二) [打印本页]

作者: yeyao    时间: 2024-7-12 10:40
标题: OpenHarmony之SeLinux介绍(二)
[md]**OpenHarmony 之 SeLinux 介绍(二)**

(文章已获得原作者诚迈科技资深研发工程师-石杰授权)

文章前序指路:[OpenHarmony 之 SeLinux 介绍(一) - 文章 OpenHarmony 开发者论坛](https://forums.openharmony.cn/fo ... thread&tid=3201)

四、AVC 日志

`avc: denied { add } for service=3302 pid=608`

`scontext=u:r:foundation:s0`

`tcontext=u:object_r:sa_foundation_battery_service:s0 `

`tclass=samgr_class permissive=1`

● 日志分析

add:操作为 add

scontext=u:r:foundation:s0:主体安全上下文

tcontext=u:object\_r:sa\_foundation\_battery\_service:s0:客体安全上下文

tclass=samgr\_class:客体类别为 samgr\_class

● 编写策略

> allow foundation sa\_foundation\_battery\_service:samgr\_class add

五、定义安全上下文

✧ 进程定义
●cfg 配置文件中定义
cfg 文件中添加 secon 字段,例如 foundation 进程
cfg 配置路径:/etc/init/foundation.cfg

[/md]




欢迎光临 开发者论坛 (https://oh-test.qingcheng100.cn/) Powered by Discuz! X3.5