platform_system_sepolicy/tools
Alan Stokes 3c4375a5b4 Enforce use of app_data_file_type.
Extend check_seapp to check that all types specified in seapp_contexts
files have the attribute, to ensure that the neverallow rules apply to
them. As a small bonus, also verify that domain and type values are
actually types not attributes.

Test: Presubmits
Test: Manual: specify an invalid type, build breaks.
Bug: 171795911
Change-Id: I951d6f993445e8ba11c30a504b8de281fdd93c4a
2020-11-11 14:45:32 +00:00
..
sepolicy-analyze Convert sepolicy-analyze to Android.bp 2020-01-29 13:20:47 -08:00
Android.bp Remove unused tags property from Android.bp files 2018-05-08 17:15:33 -07:00
Android.mk Build sepolicy tools with Android.bp. 2018-05-07 12:51:54 -07:00
build_policies.sh Reduce the number of parallel compiles. 2019-03-04 14:04:49 -08:00
check_seapp.c Enforce use of app_data_file_type. 2020-11-11 14:45:32 +00:00
checkfc.c Modify checkfc to check (vnd|hw)service_manager_type. 2017-04-06 17:25:07 -07:00
insertkeys.py Update sepolicy to use inclusive language 2020-07-27 16:52:04 +00:00
policy_version_check.sh Android.bp: set sepolicy version for use by init 2019-03-14 17:49:14 +00:00
post_process_mac_perms
README Add a script to build multiple SELinux targets. 2018-01-29 15:48:15 -08:00
sepolicy-check.c
sepolicy_cleanup_check.sh Add code to check for unescaped periods in file_contexts. 2018-10-06 13:39:38 -07:00
version_policy.c version_policy: avoid fclose a NULL file pointer 2019-07-01 16:47:20 +08:00
whitespace.sh Block files without trailing newlines 2016-12-12 08:18:01 -08:00

This directory contains a number of tools related to policy, some of
which are used in building and validating the policy and others are
available for help in auditing and analyzing policy.  The tools are
described further below.

build_policies.sh
   A tool to build SELinux policy for multiple targets in parallel.
   This is useful for quickly testing a new test or neverallow rule
   on multiple targets.

   Usage:
   ./build_policies.sh ~/android/master ~/tmp/build_policies
   ./build_policies.sh ~/android/master ~/tmp/build_policies sailfish-eng walleye-eng

checkfc
   A utility for checking the validity of a file_contexts or a
   property_contexts configuration file.  Used as part of the policy
   build to validate both files.  Requires the sepolicy file as an
   argument in order to check the validity of the security contexts
   in the file_contexts or property_contexts file.

   Usage1:
   checkfc sepolicy file_contexts
   checkfc -p sepolicy property_contexts

   Also used to compare two file_contexts or file_contexts.bin files.
   Displays one of subset, equal, superset, or incomparable.

   Usage2:
   checkfc -c file_contexts1 file_contexts2

   Example:
   $ checkfc -c out/target/product/shamu/system/etc/general_file_contexts out/target/product/shamu/root/file_contexts.bin
   subset

checkseapp
    A utility for merging together the main seapp_contexts
    configuration and the device-specific one, and simultaneously
    checking the validity of the configurations. Used as part of the
    policy build process to merge and validate the configuration.

    Usage:
    checkseapp -p sepolicy input_seapp_contexts0 [input_seapp_contexts1...] -o seapp_contexts

insertkeys.py
    A helper script for mapping tags in the signature stanzas of
    mac_permissions.xml to public keys found in pem files.  This
    script is described further in the top-level sepolicy/README.

post_process_mac_perms
    A tool to help modify an existing mac_permissions.xml with additional app
    certs not already found in that policy. This becomes useful when a directory
    containing apps is searched and the certs from those apps are added to the
    policy not already explicitly listed.

    Usage:
    post_process_mac_perms [-h] -s SEINFO -d DIR -f POLICY

      -s SEINFO, --seinfo SEINFO  seinfo tag for each generated stanza
      -d DIR, --dir DIR           Directory to search for apks
      -f POLICY, --file POLICY    mac_permissions.xml policy file

sepolicy-check
    A tool for auditing a sepolicy file for any allow rule that grants
    a given permission.

    Usage:
    sepolicy-check -s <domain> -t <type> -c <class> -p <permission> -P out/target/product/<board>/root/sepolicy

sepolicy-analyze
    A tool for performing various kinds of analysis on a sepolicy
    file.