1*e4a36f41SAndroid Build Coastguard WorkerThis directory contains a number of tools related to policy, some of 2*e4a36f41SAndroid Build Coastguard Workerwhich are used in building and validating the policy and others are 3*e4a36f41SAndroid Build Coastguard Workeravailable for help in auditing and analyzing policy. The tools are 4*e4a36f41SAndroid Build Coastguard Workerdescribed further below. 5*e4a36f41SAndroid Build Coastguard Worker 6*e4a36f41SAndroid Build Coastguard Workerbuild_policies.sh 7*e4a36f41SAndroid Build Coastguard Worker A tool to build SELinux policy for multiple targets in parallel. 8*e4a36f41SAndroid Build Coastguard Worker This is useful for quickly testing a new test or neverallow rule 9*e4a36f41SAndroid Build Coastguard Worker on multiple targets. 10*e4a36f41SAndroid Build Coastguard Worker 11*e4a36f41SAndroid Build Coastguard Worker Usage: 12*e4a36f41SAndroid Build Coastguard Worker ./build_policies.sh ~/android/master ~/tmp/build_policies 13*e4a36f41SAndroid Build Coastguard Worker ./build_policies.sh ~/android/master ~/tmp/build_policies sailfish-eng walleye-eng 14*e4a36f41SAndroid Build Coastguard Worker 15*e4a36f41SAndroid Build Coastguard Workercheckfc 16*e4a36f41SAndroid Build Coastguard Worker A utility for checking the validity of a file_contexts or a 17*e4a36f41SAndroid Build Coastguard Worker property_contexts configuration file. Used as part of the policy 18*e4a36f41SAndroid Build Coastguard Worker build to validate both files. Requires the sepolicy file as an 19*e4a36f41SAndroid Build Coastguard Worker argument in order to check the validity of the security contexts 20*e4a36f41SAndroid Build Coastguard Worker in the file_contexts or property_contexts file. 21*e4a36f41SAndroid Build Coastguard Worker 22*e4a36f41SAndroid Build Coastguard Worker Usage1: 23*e4a36f41SAndroid Build Coastguard Worker checkfc sepolicy file_contexts 24*e4a36f41SAndroid Build Coastguard Worker checkfc -p sepolicy property_contexts 25*e4a36f41SAndroid Build Coastguard Worker 26*e4a36f41SAndroid Build Coastguard Worker Also used to compare two file_contexts or file_contexts.bin files. 27*e4a36f41SAndroid Build Coastguard Worker Displays one of subset, equal, superset, or incomparable. 28*e4a36f41SAndroid Build Coastguard Worker 29*e4a36f41SAndroid Build Coastguard Worker Usage2: 30*e4a36f41SAndroid Build Coastguard Worker checkfc -c file_contexts1 file_contexts2 31*e4a36f41SAndroid Build Coastguard Worker 32*e4a36f41SAndroid Build Coastguard Worker Example: 33*e4a36f41SAndroid Build Coastguard Worker $ checkfc -c out/target/product/shamu/system/etc/general_file_contexts out/target/product/shamu/root/file_contexts.bin 34*e4a36f41SAndroid Build Coastguard Worker subset 35*e4a36f41SAndroid Build Coastguard Worker 36*e4a36f41SAndroid Build Coastguard Workercheckseapp 37*e4a36f41SAndroid Build Coastguard Worker A utility for merging together the main seapp_contexts 38*e4a36f41SAndroid Build Coastguard Worker configuration and the device-specific one, and simultaneously 39*e4a36f41SAndroid Build Coastguard Worker checking the validity of the configurations. Used as part of the 40*e4a36f41SAndroid Build Coastguard Worker policy build process to merge and validate the configuration. 41*e4a36f41SAndroid Build Coastguard Worker 42*e4a36f41SAndroid Build Coastguard Worker Usage: 43*e4a36f41SAndroid Build Coastguard Worker checkseapp -p sepolicy input_seapp_contexts0 [input_seapp_contexts1...] -o seapp_contexts 44*e4a36f41SAndroid Build Coastguard Worker 45*e4a36f41SAndroid Build Coastguard Workerinsertkeys.py 46*e4a36f41SAndroid Build Coastguard Worker A helper script for mapping tags in the signature stanzas of 47*e4a36f41SAndroid Build Coastguard Worker mac_permissions.xml to public keys found in pem files. This 48*e4a36f41SAndroid Build Coastguard Worker script is described further in the top-level sepolicy/README. 49*e4a36f41SAndroid Build Coastguard Worker 50*e4a36f41SAndroid Build Coastguard Workerpost_process_mac_perms 51*e4a36f41SAndroid Build Coastguard Worker A tool to help modify an existing mac_permissions.xml with additional app 52*e4a36f41SAndroid Build Coastguard Worker certs not already found in that policy. This becomes useful when a directory 53*e4a36f41SAndroid Build Coastguard Worker containing apps is searched and the certs from those apps are added to the 54*e4a36f41SAndroid Build Coastguard Worker policy not already explicitly listed. 55*e4a36f41SAndroid Build Coastguard Worker 56*e4a36f41SAndroid Build Coastguard Worker Usage: 57*e4a36f41SAndroid Build Coastguard Worker post_process_mac_perms [-h] -s SEINFO -d DIR -f POLICY 58*e4a36f41SAndroid Build Coastguard Worker 59*e4a36f41SAndroid Build Coastguard Worker -s SEINFO, --seinfo SEINFO seinfo tag for each generated stanza 60*e4a36f41SAndroid Build Coastguard Worker -d DIR, --dir DIR Directory to search for apks 61*e4a36f41SAndroid Build Coastguard Worker -f POLICY, --file POLICY mac_permissions.xml policy file 62*e4a36f41SAndroid Build Coastguard Worker 63*e4a36f41SAndroid Build Coastguard Workersepolicy-check 64*e4a36f41SAndroid Build Coastguard Worker A tool for auditing a sepolicy file for any allow rule that grants 65*e4a36f41SAndroid Build Coastguard Worker a given permission. 66*e4a36f41SAndroid Build Coastguard Worker 67*e4a36f41SAndroid Build Coastguard Worker Usage: 68*e4a36f41SAndroid Build Coastguard Worker sepolicy-check -s <domain> -t <type> -c <class> -p <permission> -P out/target/product/<board>/root/sepolicy 69*e4a36f41SAndroid Build Coastguard Worker 70*e4a36f41SAndroid Build Coastguard Workersepolicy-analyze 71*e4a36f41SAndroid Build Coastguard Worker A tool for performing various kinds of analysis on a sepolicy 72*e4a36f41SAndroid Build Coastguard Worker file. 73*e4a36f41SAndroid Build Coastguard Worker 74*e4a36f41SAndroid Build Coastguard Workerfuzzer_bindings_check 75*e4a36f41SAndroid Build Coastguard Worker Tool to check if fuzzer is added for new services. it is used by fuzzer_bindings_test soong module internally. 76*e4a36f41SAndroid Build Coastguard Worker Error will be generated if there is no fuzzer binding present for service added in service_contexts in 77*e4a36f41SAndroid Build Coastguard Worker system/sepolicy/soong/build/service_fuzzer_bindings.go 78*e4a36f41SAndroid Build Coastguard Worker 79*e4a36f41SAndroid Build Coastguard Worker Usage: 80*e4a36f41SAndroid Build Coastguard Worker fuzzer_bindings_check.py -s [SRCs...] -b /path/to/binding.json 81*e4a36f41SAndroid Build Coastguard Worker 82*e4a36f41SAndroid Build Coastguard Worker -s [SRCs...] list of service_contexts files. Tool will check if there is fuzzer for every service 83*e4a36f41SAndroid Build Coastguard Worker in the context file. 84*e4a36f41SAndroid Build Coastguard Worker -b /path/to/binding.json Path to json file containing "service":[fuzzers...] bindings. 85