android_system_sepolicy/tools
Alex Klyubin c60d3ea164 Do not warn about empty typesets in neverallows
Empty typeset is not an issue in neverallow rules. The reason is that
it's completly normal for scontext or tcontext of neverallow rules to
evaluate to an empty type set. For example, there are neverallow rules
whose purpose is to test that all types with particular powers are
associated with a particular attribute:
  neverallow {
    untrusted_app_all
    -untrusted_app
    -untrusted_app_25
  } domain:process fork;

Test: sepolicy-analyze neverallow -w -n \
          'neverallow {} {}:binder call;'
      produces empty output instead of "Warning!  Empty type set"
Bug: 37357742
Change-Id: Id61b4fe22fafaf0522d8769dd4e23dfde6cd9f45
2017-04-25 14:25:04 -07:00
..
fc_sort fc_sort: cleanup warnings caught by clang tidy / static analyzer. 2016-10-12 12:19:48 -07:00
sepolicy-analyze Do not warn about empty typesets in neverallows 2017-04-25 14:25:04 -07:00
Android.mk sepolicy: add version_policy tool and version non-platform policy. 2016-12-06 08:56:02 -08:00
check_seapp.c Add new untrusted_v2_app domain 2017-02-21 12:39:55 -08:00
checkfc.c Modify checkfc to check (vnd|hw)service_manager_type. 2017-04-06 17:25:07 -07:00
insertkeys.py tools: Strengthen BEGIN/END CERTIFICATE checks 2013-10-14 15:54:42 -07:00
post_process_mac_perms Remove errant newline from generated policy file. 2014-04-01 11:22:53 -04:00
README checkfc: add support for comparing two file_contexts files. 2015-08-12 18:37:02 +00:00
sepolicy-check.c Add sepolicy-analyze tool. 2013-10-31 15:12:32 -04:00
version_policy.c sepolicy_version: change current version to NN.m format 2017-04-07 14:18:48 -07: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.

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.