Skip to content
Snippets Groups Projects
  1. Jun 25, 2015
    • William Roberts's avatar
      check_seapp: add support for "neverallow" checks · 81e1f90c
      William Roberts authored
      
      Introduce "neverallow" rules for seapp_contexts. A neverallow rule is
      similar to the existing key-value-pair entries but the line begins
      with "neverallow". A neverallow violation is detected when all keys,
      both inputs and outputs are matched. The neverallow rules value
      parameter (not the key) can contain regular expressions to assist in
      matching. Neverallow rules are never output to the generated
      seapp_contexts file.
      
      Also, unless -o is specified, checkseapp runs in silent mode and
      outputs nothing. Specifying - as an argument to -o outputs to stdout.
      
      Sample Output:
      Error: Rule in File "external/sepolicy/seapp_contexts" on line 87: "user=fake domain=system_app type=app_data_file" violates neverallow in File "external/sepolicy/seapp_contexts" on line 57: "user=((?!system).)* domain=system_app"
      
      Change-Id: Ia4dcbf02feb774f2e201bb0c5d4ce385274d8b8d
      Signed-off-by: default avatarWilliam Roberts <william.c.roberts@intel.com>
      81e1f90c
  2. Jun 23, 2015
    • William Roberts's avatar
      check_seapp: mac build memory leak · 7d65b547
      William Roberts authored
      
      rule_map_free() took as a parameter a boolean menu rule_map_switch
      that was used to determine if it should free the key pointer that
      is also in the table. On GLIBC variants, calls to hdestroy do not
      free the key pointer, on NON-GLIBC variants, it does. The original
      patch was meant to correct this, however, it always passes "destroy"
      as the rule_map_switch. On GLIBC variants this is fine, however on
      NON-GLIBC variants, that free was compiled out, and the free() was
      handled by hdestroy. In cases of failure where the rule_map was not
      in the htable, those key's were not properly free'd.
      
      Change-Id: Ifdf616e09862bca642a4d31bf0cb266168170e50
      Signed-off-by: default avatarWilliam Roberts <william.c.roberts@intel.com>
      7d65b547
    • William Roberts's avatar
      drop unused option -s · f26b6d42
      William Roberts authored
      
      Change-Id: I00aa4eeaf569c8108a7b6aab190be68e53b46597
      Signed-off-by: default avatarWilliam Roberts <william.c.roberts@intel.com>
      f26b6d42
  3. Jun 19, 2015
    • William Roberts's avatar
      correct all error messages · 8d3a1b55
      William Roberts authored
      
      When an error occured it was erroneously being indicated that he
      file was the output file, not the input file.
      
      Before:
      Error: Could not find selinux type "fake_app" on line: 51 in file: out/target/product/flo/obj/ETC/seapp_contexts_intermediates/seapp_contexts
      Error: Could not validate
      Error: reading out/target/product/flo/obj/ETC/seapp_contexts_intermediates/seapp_contexts.tmp, line 51, name levelFrom, value user
      
      After:
      Error: Could not find selinux type "fake_app" on line: 51 in file: out/target/product/flo/obj/ETC/seapp_contexts_intermediates/seapp_contexts.tmp
      Error: Could not validate
      Error: reading out/target/product/flo/obj/ETC/seapp_contexts_intermediates/seapp_contexts.tmp, line 51, name levelFrom, value user
      
      Change-Id: Ib0e01f1f0ef563a2a150a0a3b4012e6e15d736bb
      Signed-off-by: default avatarWilliam Roberts <william.c.roberts@intel.com>
      8d3a1b55
  4. Jun 12, 2015
    • William Roberts's avatar
      check_seapp: Correct output on duplicate entries · 773d4126
      William Roberts authored
      
      If a duplicate entry is found, rule_map_cmp() incorrectly
      assumes that the lengths of the key value pairs should be
      equal, when this is not true. The duplicate detection is
      done on the input parameters, thus the lengths can be
      different. This resulted in a duplicate error string
      message of "do not match", instead of "match on all inputs".
      
      Also, the file name printed that contained the error was
      the output file, not the input file that contained it.
      
      Change-Id: I9b3f99fa4aa3454849de55f18b198b0b56e44320
      Signed-off-by: default avatarWilliam Roberts <william.c.roberts@intel.com>
      773d4126
  5. Jun 10, 2015
  6. Jun 09, 2015
  7. May 12, 2015
    • dcashman's avatar
      Fix sepolicy-analyze libc++.so loading issue w/CTS. · 28acbeab
      dcashman authored
      Addresses the following error when running CTS on master:
      junit.framework.AssertionFailedError: The following errors were encountered when validating the SELinuxneverallow rule:
      neverallow { appdomain -bluetooth } self:capability *;
      /tmp/SELinuxHostTest5593810182495331783.tmp: error while loading shared libraries: libc++.so: cannot open shared object file: No such file or directory
      
      Also indicate that none of the sepolicy tools need c++ std lib.
      
      (cherry-pick of 0cdb0517be696c0dc6882d289eedd45bf2da918c now made possible by
      addition of commit: 28b72eddd54cb1287dd7daae853e8e4b78fa17eb)
      
      Bug: 19617220
      Change-Id: I2c5b7ab1ddeb0e02cbaad2b7d5430a0974524a89
      28acbeab
  8. Mar 17, 2015
    • Dan Albert's avatar
      Revert "Fix sepolicy-analyze libc++.so loading issue w/CTS." · 0d3bf4be
      Dan Albert authored
      This is causing more harm than good. We'll just make these all link
      libc++ again and work out the CTS issues if they still exist.
      
      Bug: 19778891
      
      This reverts commit 3812cf58.
      
      Change-Id: Iaea8f6acb147da4275633a760ccb32951db7f8b6
      0d3bf4be
    • Dan Albert's avatar
      Revert "Don't use address sanitizer for selinux tools." · f0852340
      Dan Albert authored
      This is causing more harm than good. We'll just make these all link
      libc++ again (another revert) and work out the CTS issues if they still
      exist.
      
      Bug: 19778891
      
      This reverts commit a5113a15.
      
      Change-Id: I35a4c93dae4abb66e3525451d5ce01e33a540895
      f0852340
    • Dan Albert's avatar
      Don't use address sanitizer for selinux tools. · a5113a15
      Dan Albert authored
      Address sanitizer requires using libc++ (apparently). We removed
      libc++ from these projects since they were C and the SDK/CTS was not
      able to find libc++.
      
      If we're interested in continuing to use ASAN on these tools
      (probably), we should turn libc++ back on once we're sure CTS won't
      die.
      
      Bug: 19778891
      Change-Id: I3c1913171a15396ead73277ec1186fead730f66d
      a5113a15
  9. Mar 16, 2015
    • dcashman's avatar
      Fix sepolicy-analyze libc++.so loading issue w/CTS. · 3812cf58
      dcashman authored
      Addresses the following error when running CTS on master:
      junit.framework.AssertionFailedError: The following errors were encountered when validating the SELinuxneverallow rule:
      neverallow { appdomain -bluetooth } self:capability *;
      /tmp/SELinuxHostTest5593810182495331783.tmp: error while loading shared libraries: libc++.so: cannot open shared object file: No such file or directory
      
      Also indicate that none of the sepolicy tools need c++ std lib.
      
      Bug: 19617220
      
      Change-Id: I713b3cbd1220655413d399c7cd2b0b50459a5485
      3812cf58
  10. Mar 13, 2015
    • Stephen Smalley's avatar
      sepolicy-analyze: Add attribute command. · 0233cd80
      Stephen Smalley authored
      
      Add an attribute command to sepolicy-analyze for displaying the list
      of types associated with an attribute in a policy.  This is for use
      by CTS to check what domains and types are associated with certain
      attributes such as mlstrustedsubject and mlstrustedobject.
      
      Change-Id: Ie19361c02feb1ad14ce36862c6aace9e66c422bb
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      0233cd80
  11. Mar 12, 2015
  12. Mar 11, 2015
  13. Feb 24, 2015
  14. Feb 13, 2015
    • Stephen Smalley's avatar
      checkseapp: Detect duplicate entries within seapp_contexts. · 0b820042
      Stephen Smalley authored
      
      Presently it only detects complete duplicates if you specify -s (strict),
      which is not used in the external/sepolicy Makefile, and it allows
      overriding earlier entries that have the same input selectors (e.g.
      user=, seinfo=) with different values for the output selectors (e.g.
      domain=, type=).  Thus, a device/<vendor>/<board>/sepolicy/seapp_contexts
      file can override the external/sepolicy definitions, and even a single
      seapp_contexts file can contain duplicated or conflicting definitions.
      
      Make it always check strictly, and prohibit either duplicates on the
      input selectors (i.e. overrides) or complete duplicates (redundant).
      
      Change-Id: Id1e38133cbe31b796253101cfe3b111d1826bc8c
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      0b820042
  15. Feb 06, 2015
    • dcashman's avatar
      Accept command-line input for neverallow-check. · f82f5e01
      dcashman authored
      Also, divide each sepolicy-analyze function into its own component for simplified
      command-line parsing and potentially eventual modularization.
      
      Bug: 18005561
      
      Cherry-pick of commit: ef4fd306
      with commit: 47c14611
      squashed in.
      
      Bug: 19191637
      Change-Id: Id66cad549b7311a6bbd92fd64b6ec2c60d0433a4
      f82f5e01
  16. Feb 05, 2015
  17. Dec 22, 2014
    • dcashman's avatar
      Adjust sepolicy-analyze to reflect libsepol changes. · 0de2b45f
      dcashman authored
      Commit dc0ab516f11d8e2c413315e733e25a41ba468e4f changed the libsepol
      structures on which sepolicy-analyze relies so that it could be compiled
      as a C++ library.  Reflect this change in sepolicy-analyze.
      
      Change-Id: I7da601767c3a4ebed7274e33304d8b589a9115fe
      0de2b45f
  18. Dec 01, 2014
    • William Roberts's avatar
      Fix sepolicy-analyze build with different toolchains · 47c14611
      William Roberts authored
      host C: sepolicy-analyze <= external/sepolicy/tools/sepolicy-analyze/sepolicy-analyze.c
      external/sepolicy/tools/sepolicy-analyze/sepolicy-analyze.c: In function 'usage':
      external/sepolicy/tools/sepolicy-analyze/sepolicy-analyze.c:30:5: error: 'for' loop initial declarations are only allowed in C99 mode
      external/sepolicy/tools/sepolicy-analyze/sepolicy-analyze.c:30:5: note: use option -std=c99 or -std=gnu99 to compile your code
      make: *** [out/host/linux-x86/obj/EXECUTABLES/sepolicy-analyze_intermediates/sepolicy-analyze.o] Error 1
      
      Change-Id: I9222e447b032d051c251c9718e2b8d5ffb9e9c35
      47c14611
  19. Nov 20, 2014
    • Narayan Kamath's avatar
      Undo idiotic build fix. · f639e96b
      Narayan Kamath authored
      Just remove unused variables instead of making them refer to
      the wrong statics.
      
      Change-Id: I314bfe91b7912f7d8c9cba7dd55a76d72c879a51
      f639e96b
    • Narayan Kamath's avatar
      Fix build. · 012dd734
      Narayan Kamath authored
      Introduced by the merge conflict resolution for
      3a1eb33b.
      
      Change-Id: Iddbc9e4d83c513d7003102f881793b5b7945566c
      012dd734
  20. Nov 19, 2014
  21. Nov 13, 2014
  22. Oct 31, 2014
    • dcashman's avatar
      Accept command-line input for neverallow-check. · ef4fd306
      dcashman authored
      Also, divide each sepolicy-analyze function into its own component for simplified
      command-line parsing and potentially eventual modularization.
      
      Bug: 18005561
      Change-Id: I45fa07d776cf1bec7d60dba0c03ee05142b86c19
      ef4fd306
  23. Oct 15, 2014
    • Nick Kralevich's avatar
      maybe fix mac build. · 74bbf703
      Nick Kralevich authored
        1 warning generated.
        external/sepolicy/tools/sepolicy-analyze.c:446:27: error: implicit declaration of function 'isspace' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                while (p < end && isspace(*p))
                                ^
        1 error generated.
        make: *** [out/host/darwin-x86/obj32/EXECUTABLES/sepolicy-analyze_intermediates/sepolicy-analyze.o] Error 1
        make: *** Waiting for unfinished jobs....
      
      Change-Id: I250dcef7c726d5b66835dc51c057e472b801aa2c
      74bbf703
  24. Oct 14, 2014
  25. Sep 15, 2014
  26. Aug 27, 2014
    • dcashman's avatar
      Add permissive domains check to sepolicy-analyze. · c30dd63f
      dcashman authored
      Also enable global reading of kernel policy file. Motivation for this is to
      allow read access to the kernel version of the binary selinux policy.
      
      Bug: 17288791
      
      Change-Id: I1eefb457cea1164a8aa9eeb7683b3d99ee56ca99
      c30dd63f
  27. Aug 22, 2014
    • dcashman's avatar
      Add permissive domains check to sepolicy-analyze. · 9793ea7a
      dcashman authored
      Also enable global reading of kernel policy file. Motivation for this is to
      allow read access to the kernel version of the binary selinux policy.
      
      Change-Id: I1eefb457cea1164a8aa9eeb7683b3d99ee56ca99
      9793ea7a
  28. Jun 17, 2014
  29. Apr 04, 2014
    • Stephen Smalley's avatar
      Treat seinfo=default name=<anything> as an error. · f4fa7567
      Stephen Smalley authored
      
      check_app already checks for usage of name= entries
      in seapp_contexts with no seinfo= specification to
      link it back to a signer in mac_permissions.xml.
      However, one can avoid this error by specifying
      a seinfo=default which merely matches the default
      stanza of mac_permissions.xml without actually ensuring
      that it is tied to a specific certificate.  Catch
      that error case too.
      
      Change-Id: If33cf21501e8bfee44d31c92b6341dfa583552b2
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      f4fa7567
  30. Apr 01, 2014
  31. Mar 25, 2014
  32. Mar 12, 2014
    • Robert Craig's avatar
      Introduce post_process_mac_perms script. · 3e70d479
      Robert Craig authored
      
      usage: post_process_mac_perms [-h] -s SEINFO -d DIR -f POLICY
      
      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.
      
      optional arguments:
        -h, --help            show this help message and exit
        -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
      
      Change-Id: Ifbaca3b3120874a567d3f22eb487de1aa8bda796
      Signed-off-by: default avatarrpcraig <rpcraig@tycho.ncsc.mil>
      3e70d479
  33. Feb 19, 2014
    • Stephen Smalley's avatar
      Add support for and use new path= specifier in seapp_contexts. · 6139de50
      Stephen Smalley authored
      
      Extend check_seapp to accept the use of the new path= specifier
      in seapp_contexts and use it to ensure proper labeling of the cache
      subdirectory of com.android.providers.downloads for restorecon.
      
      After this change, restorecon /data/data/com.android.providers.downloads/cache
      does not change the context, leaving it in download_file rather than
      relabeling it to platform_app_data_file.
      
      Depends on Iddaa3931cfd4ddd5b9f62cd66989e1f26553baa1.
      
      Change-Id: Ief65b8c8dcb44ec701d53e0b58c52d6688cc2a14
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      6139de50
  34. Nov 19, 2013
    • Stephen Smalley's avatar
      Add support for duplicate allow rule detection (-D / --dups). · bec54f42
      Stephen Smalley authored
      
      Usage:
      sepolicy-analyze -D -P out/target/product/<board>/root/sepolicy
      
      Displays duplicate allow rules, i.e. pairs of allow rules that grant
      the same permissions where one allow rule is written directly in terms
      of individual types and the other is written in terms of attributes
      associated with those same types.  The rule with individual types is
      a candidate for removal.  The rule with individual types may be directly
      represented in the source policy or may be a result of expansion of
      a type negation (e.g. domain -foo -bar is expanded to individual allow
      rules by the policy compiler).  Domains with unconfineddomain will
      typically have such duplicate rules as a natural side effect and can
      be ignored.
      
      Also add a tools/README with a description of all of the tools.
      
      Change-Id: I07838dbd22c5cc8a4a65b57003ccae38129050f5
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      bec54f42
  35. Nov 01, 2013
Loading