首页 技术 正文
技术 2022年11月10日
0 收藏 487 点赞 2,231 浏览 1356 个字

本文转载自: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 问题http://blog.csdn.net/lei1217/article/details/48377131版权声明:本文为博主原创文章,未经博主允许不得转载。

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,111
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,584
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,431
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,203
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,838
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,922