Skip to content
Snippets Groups Projects
  • Nick Kralevich's avatar
    c3c9052b
    Make DEFAULT_SYSTEM_DEV_CERTIFICATE available in keys.conf · c3c9052b
    Nick Kralevich authored
    In 9af6f1bd, the -d option
    was dropped from insertkeys.py. This was done to allow an
    Android distribution to replace the default version of
    keys.conf distributed in external/sepolicy/keys.conf. keys.conf
    was modified to reference the publicly known test keys in
    build/target/product/security.
    
    Unfortunately, this broke Google's build of Android. Instead
    of incorporating our keys directory, we were using the
    default AOSP keys. As a result, apps were getting assigned
    to the wrong SELinux domain. (see "Steps to reproduce" below)
    
    This change continues to allow others to replace keys.conf,
    but makes DEFAULT_SYSTEM_DEV_CERTIFICATE available as an
    environment variable in case the customized version wants to
    make reference to it. This change also modifies the stock
    version of keys.conf to use DEFAULT_SYSTEM_DEV_CERTIFICATE,
    which should be appropriate for most Android distributions.
    It doesn't make any sense to force each OEM to have a copy of
    this file.
    
    Steps to reproduce.
    
    1) Compile and boot Android.
    2) Run the following command: "adb shell ps -Z | grep process.media"
    
    Expected:
    
      $ adb shell ps -Z | grep process.media
      u:r:media_app:s0               u0_a5     1332  202   android.process.media
    
    Actual:
    
      $ adb shell ps -Z | grep process.media
      u:r:untrusted_app:s0           u0_a5     3617  187   android.process.media
    
    Bug: 11327304
    Change-Id: Ica24fb25c5f9c0e2f4d181718c757cf372467822
    c3c9052b
    History
    Make DEFAULT_SYSTEM_DEV_CERTIFICATE available in keys.conf
    Nick Kralevich authored
    In 9af6f1bd, the -d option
    was dropped from insertkeys.py. This was done to allow an
    Android distribution to replace the default version of
    keys.conf distributed in external/sepolicy/keys.conf. keys.conf
    was modified to reference the publicly known test keys in
    build/target/product/security.
    
    Unfortunately, this broke Google's build of Android. Instead
    of incorporating our keys directory, we were using the
    default AOSP keys. As a result, apps were getting assigned
    to the wrong SELinux domain. (see "Steps to reproduce" below)
    
    This change continues to allow others to replace keys.conf,
    but makes DEFAULT_SYSTEM_DEV_CERTIFICATE available as an
    environment variable in case the customized version wants to
    make reference to it. This change also modifies the stock
    version of keys.conf to use DEFAULT_SYSTEM_DEV_CERTIFICATE,
    which should be appropriate for most Android distributions.
    It doesn't make any sense to force each OEM to have a copy of
    this file.
    
    Steps to reproduce.
    
    1) Compile and boot Android.
    2) Run the following command: "adb shell ps -Z | grep process.media"
    
    Expected:
    
      $ adb shell ps -Z | grep process.media
      u:r:media_app:s0               u0_a5     1332  202   android.process.media
    
    Actual:
    
      $ adb shell ps -Z | grep process.media
      u:r:untrusted_app:s0           u0_a5     3617  187   android.process.media
    
    Bug: 11327304
    Change-Id: Ica24fb25c5f9c0e2f4d181718c757cf372467822
keys.conf 851 B
#
# Maps an arbitrary tag [TAGNAME] with the string contents found in
# TARGET_BUILD_VARIANT. Common convention is to start TAGNAME with an @ and
# name it after the base file name of the pem file.
#
# Each tag (section) then allows one to specify any string found in
# TARGET_BUILD_VARIANT. Typcially this is user, eng, and userdebug. Another
# option is to use ALL which will match ANY TARGET_BUILD_VARIANT string.
#

[@PLATFORM]
ALL : $DEFAULT_SYSTEM_DEV_CERTIFICATE/platform.x509.pem

[@MEDIA]
ALL : $DEFAULT_SYSTEM_DEV_CERTIFICATE/media.x509.pem

[@SHARED]
ALL : $DEFAULT_SYSTEM_DEV_CERTIFICATE/shared.x509.pem

# Example of ALL TARGET_BUILD_VARIANTS
[@RELEASE]
ENG       : $DEFAULT_SYSTEM_DEV_CERTIFICATE/testkey.x509.pem
USER      : $DEFAULT_SYSTEM_DEV_CERTIFICATE/testkey.x509.pem
USERDEBUG : $DEFAULT_SYSTEM_DEV_CERTIFICATE/testkey.x509.pem