audit2allow的安装

sudo apt install policycoreutils

或者

将Android 源码目录下external/selinux/python/audit2allow/audit2allow copy到/usr/bin/

audit2allow的用法

1.抓log并保存至文件:

adb logcat -b all  > error_log.txt

2.分析SeLinux问题的log:

audit2allow -i error_log.txt

有些系统在执行audit2allow时会出现错误“unable to open (null):  Bad address”

有两个方法可以规避这个问题:

2.1 sudo vim  /usr/bin/audit2allow

注释掉如下4行代码,这个错误是因为执行audit2why.init()导致的,具体原因不详。

    def main(self):try:self.__parse_options()# if self.__options.policy:#     audit2why.init(self.__options.policy)# else:#     audit2why.init()

2.2 加-p参数  从audit2allow的help信息看 , -p需要指定一个policy文件

Usage: audit2allow [options]Options:--version             show program's version number and exit-h, --help            show this help message and exit-b, --boot            audit messages since last boot conflicts with -i-a, --all             read input from audit log - conflicts with -i-p POLICY, --policy=POLICYPolicy file to use for analysis-d, --dmesg           read input from dmesg - conflicts with --all and--input-i INPUT, --input=INPUTread input from <input> - conflicts with -a-l, --lastreload      read input only after the last reload-r, --requires        generate require statements for rules-m MODULE, --module=MODULEset the module name - implies --requires-M MODULE_PACKAGE, --module-package=MODULE_PACKAGEgenerate a module package - conflicts with -o and -m-o OUTPUT, --output=OUTPUTappend output to <filename>, conflicts with -M-D, --dontaudit       generate policy with dontaudit rules-R, --reference       generate refpolicy style output-N, --noreference     do not generate refpolicy style output-v, --verbose         explain generated output-e, --explain         fully explain generated output-t TYPE, --type=TYPE  only process messages with a type that matches thisregex--perm-map=PERM_MAP   file name of perm map--interface-info=INTERFACE_INFOfile name of interface information--debug               leave generated modules for -M-w, --why             Translates SELinux audit messages into a descriptionof why the access was denied

Android代码一般会在out中生成,可以在out目录下find一下,例如:

R4250-dev$ find out/target/product/ -name sepolicyout/target/product/<project_name>/recovery/root/sepolicy

综合来看,如果不常用audit2why这个功能的话,方案2.1比较方便些,一劳永逸。

[SeLinux]audit2allow安装与使用相关推荐

  1. SELinux avc权限--audit2allow

    SELinux avc 权限, audit2allow 使用 若在log出现" avc:"则按照调试添加权限. 使用avc关键词查找权限相关log adb logcat -b al ...

  2. SELinux中的Apache和MySQL设定

    原贴:http://www.gofun.com.cn:8080/viewtopic.php?f=8&t=234 SELinux中的Apache和MySQL设定    Page 1 of 1   ...

  3. Centos6/7下静默安装oracle10g

    Centos6/7下静默安装Oracle10g 远程安装oracle10g,通过网上资料,不断摸索成功安装.先在本地虚拟机Centos7上做实验,快照恢复快照恢复,安装了几十次成功之后,再在服务器Ce ...

  4. CentOS 6.5下编译安装新版LNMP

    2019独角兽企业重金招聘Python工程师标准>>> 准备工作 最小化安装CentOS6.5 我们安装完成CentOS系统,默认都是系统自带的yum源,国内用户用yum安装软件的时 ...

  5. linux系统软件包分类,Linux软件包管理和编译安装

    软件包介绍 开源软件最初只提供了.tar.gz的打包的源码文件,用户必须自已编译每个想在GNU/Linux上运行的软件.用户急需系统能提供一种更加便利的方法来管理这些软件,当Debian诞生时,这样一 ...

  6. 手把手教你安装OpenStack——Ocata安装指南(上)

    本文参考:https://docs.openstack.org/ocata/install-guide-rdo/index.html官方文档来手把手教你安装Ocata,安装文档中有漏洞的地方,本文都会 ...

  7. 自动化运维之CentOS7下PXE+Kickstart+DHCP+TFTP+HTTP无人值守安装系统

    一.概述 1.关于PXE Preboot Execution Environment翻译过来就是预启动执行环境;简称PXE;传统安装操作系统的方法是CDROM或U盘引导,而PXE技术解决的是从网络引导 ...

  8. zabbix 安装配置介绍

    介绍 Zabbix是一款能够监控各种网络参数以及服务器健康性和完整性的软件.Zabbix使用灵活的通知机制,允许用户为几乎任何事件配置基于邮件的告警.这样可以快速反馈服务器的问题.基于已存储的数据,Z ...

  9. Centos 7.2安装FTP服务并进行相关设置

    关闭防火墙 #systemctl stop firewalld #systemctl disable firewalld 关闭SELINUX #vi /etc/selinux/config 修改为 S ...

  10. 安装GitLab,Jenkins,及自动化上线

    目录 一.DevOps简介 1.什么是持续集成(CI-Continuous integration) 2.什么是持续部署(CD-continuous deployment) 3.什么是持续交付(Con ...

最新文章

  1. JavaScript Collection
  2. 【错误记录】GitHub 网站和仓库无法访问 ( 域名重定向 | 检查 C:\Windows\System32\drivers\etc\hosts 配置文件中的 GitHub 地址域名配置 )
  3. 从 volatile 说到 i++ 的线程安全问题
  4. 你知道 Spring Batch 吗?
  5. 【BZOJ3894】文理分科
  6. Python提取 Gprmax 3.0 的out文件数据
  7. 问题记录——com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure...
  8. linux系统中用户和组的管理
  9. AVR 工具指南(一)
  10. 【智能家居篇】wifi网络结构(下)
  11. 面试题之接口和抽象类的区别
  12. linux命令行下如何播放视频,linux播放视频命令
  13. LSTM matlab实现
  14. 条码专题--条码技术应用
  15. 如何理解t检验、t分布、t值?
  16. 如何编译生成dll文件以及如何调用dll文件
  17. 前端图片上传问题整理
  18. 新版本GPU加速的tensorflow库的配置方法
  19. 无盘服务器chkdsk *: /f)修复命令,使用CHKDSK命令修复U盘文件或目录损坏无法读取问题...
  20. 开源精神_开源精神-网络礼节可能微妙

热门文章

  1. 计算机网络体系结构——各层的功能
  2. 工具类APP如何做ASO优化推广
  3. 数据库表设计:一对一、一对多、多对多
  4. Element UI练习
  5. 使用SharePoint Designer 2010新建外部内容类型,并解决访问被拒绝问题
  6. MySQL技术:数据库逻辑结构单元
  7. Android 退出登录实现
  8. c语言写的贪吃蛇在哪能运行,有没有可以帮我写c语言贪吃蛇的代码 cmd运行的
  9. wago edz 下载_用电子枪制造的WeakAuras Wago.io桥
  10. Linux系统管理员对普通用户的基本操作