码迷,mamicode.com
首页 > 系统相关 > 详细

如何设置确认selinux 模式【转】

时间:2018-03-05 11:06:28      阅读:241      评论:0      收藏:0      [点我收藏+]

标签:cli   mail   init   原创   ati   adb shell   https   rip   oca   

本文转载自:http://blog.csdn.net/lei1217/article/details/48377109

[Description]
linux SELinux 分成Enforce 以及 Permissive 两种模式,如何进行设置与确认当前SELinux模式?
 
[Keyword]
android, SELinux, Enforce, Permissive
 
[Solution]
在Android KK 4.4 版本后,Google 有正式有限制的启用SELinux, 来增强android 的安全保护。
在ENG 版本中, 可以使用setenforce 命令进行设置:
adb shell setenforce 0    //设置成permissive 模式
adb shell setenforce 1    //设置成enforce 模式
 
在ENG/USER 版本中,都可以使用getenforce 命令进行查询,如:
root@mt6589_phone_720pv2:/ # getenforce
getenforce
Enforcing
 
如果想开机一启动就设置模式,你可以用下面方式:
KK 版本:更新mediatek/custom/{platform}/lk/rules_platform.mk
L  版本: 更新bootable/bootloader/lk/platform/mt6xxx/rules.mk
# choose one of following value -> 1: disabled/ 2: permissive /3: enforcing
SELINUX_STATUS := 3
可直接调整这个SELINUX_STATUS这个的值为2, 严禁直接设置成1:disabled, 此会造成生成的文件无法正确的打上标签,造成在再次设置成enforcing时,难以预料的情况发生。
 
注意的是, 在L 版本上, Google 要求强制性开启enforcing mode, 前面的设置只针对userdebug, eng 版本有效, 如果要对user 版本有效, 需要修改system/core/init/Android.mk 新增
ifeq ($(strip $(TARGET_BUILD_VARIANT)),user)
LOCAL_CFLAGS += -DALLOW_DISABLE_SELINUX=1
endif
 
 
需要注意的是, Google 要求强制性开启SELinux Enforcing Mode, 如果您关闭,将无法通过Google CTS. 
 
 
[相关FAQ]
[FAQ11486] [SELinux Policy] 如何设置SELinux 策略规则 ? 在Kernel Log 中出现"avc: denied" 要如何处理
http://blog.csdn.net/lei1217/article/details/48377555
[FAQ11485] 权限(Permission denied)问题如何确认是Selinux 约束引起
http://blog.csdn.net/lei1217/article/details/48377575
[FAQ11483] 如何快速Debug SELinux Policy 问题
版权声明:本文为博主原创文章,未经博主允许不得转载。

如何设置确认selinux 模式【转】

标签:cli   mail   init   原创   ati   adb shell   https   rip   oca   

原文地址:https://www.cnblogs.com/zzb-Dream-90Time/p/8507369.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!