Skip to content
Snippets Groups Projects
  1. Dec 12, 2016
    • Roshan Pius's avatar
      hal_wifi: Allow system_server to access wifi HIDL services · 02ed21e8
      Roshan Pius authored
      We're going to be using Android framework directly to invoke Wifi HIDL
      calls. So, change permissions appropriately.
      
      Bug: 33398154
      Test: Verfied that framework is able to make HIDL calls using
      go/aog/310610.
      
      Change-Id: I4d0d88961753ad73f3876aec58b26b89486cc02a
      02ed21e8
  2. Nov 07, 2016
    • Roshan Pius's avatar
      wpa.te: Add binder permission back · cec44a61
      Roshan Pius authored
      Adding back the binder permission to access keystore from
      wpa_supplicant. This was removed by mistake in the previous patch
      (commit#: 6caeac) to add hwbinder permissions.
      
      Denials in logs:
      11-03 14:37:54.831  9011  9011 I auditd  : type=1400 audit(0.0:1490):
      avc: denied { call } for comm="wpa_supplicant" scontext=u:r:wpa:s0
      tcontext=u:r:servicemanager:s0 tclass=binder permissive=0
      11-03 14:37:54.831  9011  9011 W wpa_supplicant: type=1400
      audit(0.0:1490): avc: denied { call } for scontext=u:r:wpa:s0
      tcontext=u:r:servicemanager:s0 tclass=binder permissive=0
      11-03 14:37:55.838  9011  9011 I ServiceManager: Waiting for service
      android.security.keystore...
      11-03 14:37:55.834  9011  9011 I auditd  : type=1400 audit(0.0:1491):
      avc: denied { call } for comm="wpa_supplicant" scontext=u:r:wpa:s0
      tcontext=u:r:servicemanager:s0 tclass=binder permissive=0
      11-03 14:37:55.834  9011  9011 W wpa_supplicant: type=1400
      audit(0.0:1491): avc: denied { call } for scontext=u:r:wpa:s0
      tcontext=u:r:servicemanager:s0 tclass=binder permissive=0
      11-03 14:37:56.838  9011  9011 I ServiceManager: Waiting for service
      android.security.keystore...
      11-03 14:37:56.834  9011  9011 I auditd  : type=1400 audit(0.0:1492):
      avc: denied { call } for comm="wpa_supplicant" scontext=u:r:wpa:s0
      tcontext=u:r:servicemanager:s0 tclass=binder permissive=0
      11-03 14:37:56.834  9011  9011 W wpa_supplicant: type=1400
      audit(0.0:1492): avc: denied { call } for scontext=u:r:wpa:s0
      tcontext=u:r:servicemanager:s0 tclass=binder permissive=0
      11-03 14:37:57.839  9011  9011 I ServiceManager: Waiting for service
      android.security.keystore...
      11-03 14:37:57.834  9011  9011 I auditd  : type=1400 audit(0.0:1493):
      avc: denied { call } for comm="wpa_supplicant" scontext=u:r:wpa:s0
      tcontext=u:r:servicemanager:s0 tclass=binder permissive=0
      11-03 14:37:57.834  9011  9011 W wpa_supplicant: type=1400
      audit(0.0:1493): avc: denied { call } for scontext=u:r:wpa:s0
      tcontext=u:r:servicemanager:s0 tclass=binder permissive=0
      
      Bug: 32655747
      Test: Compiles. Will send for integration testing.
      Change-Id: Ic57a5bf0e6ea15770efc0d09f68d04b2db9ec1b8
      cec44a61
  3. Oct 26, 2016
    • Roshan Pius's avatar
      wpa: Add permissions for hwbinder · 6caeac7b
      Roshan Pius authored
      Modify permissions for wpa_supplicant to use hwbinder (for HIDL),
      instead of binder.
      
      Denials:
      01-15 14:31:58.573   541   541 W wpa_supplicant: type=1400
      audit(0.0:10): avc: denied { call } for scontext=u:r:wpa:s0
      tcontext=u:r:hwservicemanager:s0 tclass=binder permissive=0
      01-15 14:31:58.573   541   541 W wpa_supplicant: type=1400
      audit(0.0:11): avc: denied { call } for scontext=u:r:wpa:s0
      tcontext=u:r:hwservicemanager:s0 tclass=binder permissive=0
      
      BUG: 31365276
      Test: Compiled and ensured that the selinux denials are no longer
      present in logs.
      
      Change-Id: Ifa4630edea6ec5a916b3940f9a03ef9dc6fc9af2
      6caeac7b
  4. Oct 06, 2016
    • dcashman's avatar
      Split general policy into public and private components. · cc39f637
      dcashman authored
      Divide policy into public and private components.  This is the first
      step in splitting the policy creation for platform and non-platform
      policies.  The policy in the public directory will be exported for use
      in non-platform policy creation.  Backwards compatibility with it will
      be achieved by converting the exported policy into attribute-based
      policy when included as part of the non-platform policy and a mapping
      file will be maintained to be included with the platform policy that
      maps exported attributes of previous versions to the current platform
      version.
      
      Eventually we would like to create a clear interface between the
      platform and non-platform device components so that the exported policy,
      and the need for attributes is minimal.  For now, almost all types and
      avrules are left in public.
      
      Test: Tested by building policy and running on device.
      
      Change-Id: Idef796c9ec169259787c3f9d8f423edf4ce27f8c
      cc39f637
  5. Sep 11, 2016
    • Jeff Vander Stoep's avatar
      Enforce ioctl command whitelisting on all sockets · bff98015
      Jeff Vander Stoep authored
      Remove the ioctl permission for most socket types. For others, such as
      tcp/udp/rawip/unix_dgram/unix_stream set a default unprivileged whitelist
      that individual domains may extend (except where neverallowed like
      untrusted_app). Enforce via a neverallowxperm rule.
      
      Change-Id: I15548d830f8eff1fd4d64005c5769ca2be8d4ffe
      bff98015
  6. Sep 10, 2016
  7. Sep 09, 2016
  8. Aug 29, 2016
  9. Aug 26, 2016
    • Roshan Pius's avatar
      sepolicy: Add permissions for wpa_supplicant binder · 7c539b1c
      Roshan Pius authored
      Add the necessary permissions for |wpa_supplicant| to expose a binder
      interface. This binder interface will be used by the newly added
      |wificond| service (and potentially system_server).
      |wpa_supplicant| also needs to invoke binder callbacks on |wificond|.
      
      Changes in the CL:
      1. Allow |wpa_supplicant| to register binder service.
      2. Allow |wpa_supplicant| to invoke binder calls on |wificond|.
      3. Allow |wificond| to invoke binder calls on |wpa_supplicant|
      
      Denials:
      06-30 08:14:42.788   400   400 E SELinux : avc:  denied  { add } for
      service=wpa_supplicant pid=20756 uid=1010 scontext=u:r:wpa:s0
      tcontext=u:object_r:default_android_service:s0 tclass=service_manager
      permissive=1
      
      BUG:29877467
      TEST: Compiled and ensured that the selinux denials are no longer
      present in logs.
      TEST: Ran integration test to find the service.
      
      Change-Id: Ib78d8e820fc81b2c3d9260e1c877c5faa9f1f662
      (cherry picked from commit 18883a93)
      7c539b1c
  10. Jun 30, 2016
    • Roshan Pius's avatar
      sepolicy: Add permissions for wpa_supplicant binder · 18883a93
      Roshan Pius authored
      Add the necessary permissions for |wpa_supplicant| to expose a binder
      interface. This binder interface will be used by the newly added
      |wificond| service (and potentially system_server).
      |wpa_supplicant| also needs to invoke binder callbacks on |wificond|.
      
      Changes in the CL:
      1. Allow |wpa_supplicant| to register binder service.
      2. Allow |wpa_supplicant| to invoke binder calls on |wificond|.
      3. Allow |wificond| to invoke binder calls on |wpa_supplicant|
      
      Denials:
      06-30 08:14:42.788   400   400 E SELinux : avc:  denied  { add } for
      service=wpa_supplicant pid=20756 uid=1010 scontext=u:r:wpa:s0
      tcontext=u:object_r:default_android_service:s0 tclass=service_manager
      permissive=1
      
      BUG:29877467
      TEST: Compiled and ensured that the selinux denials are no longer
      present in logs.
      TEST: Ran integration test to find the service.
      
      Change-Id: Ib78d8e820fc81b2c3d9260e1c877c5faa9f1f662
      18883a93
  11. Jun 15, 2016
    • Jeff Vander Stoep's avatar
      Enforce ioctl command whitelisting on all sockets · c71c6622
      Jeff Vander Stoep authored
      Remove the ioctl permission for most socket types. For others, such as
      tcp/udp/rawip/unix_dgram/unix_stream set a default unprivileged whitelist
      that individual domains may extend (except where neverallowed like
      untrusted_app). Enforce via a neverallowxperm rule.
      
      Change-Id: I15548d830f8eff1fd4d64005c5769ca2be8d4ffe
      c71c6622
  12. Jun 06, 2016
  13. Mar 03, 2016
    • Stephen Smalley's avatar
      Update netlink socket classes. · 423fd19d
      Stephen Smalley authored
      
      Define new netlink socket security classes introduced by upstream kernel commit
      6c6d2e9bde1c1c87a7ead806f8f5e2181d41a652 ("selinux: update netlink socket
      classes").  This was merged in Linux 4.2 and is therefore only required
      for Android kernels based on 4.2 or newer (e.g. the android-4.4 branch
      of the kernel/common tree).
      
      Add the new socket classes to socket_class_set.
      Add an initial set of allow rules although further refinement
      will likely be necessary.  Any allow rule previously written
      on :netlink_socket may need to be rewritten or duplicated for
      one or more of the more specific classes.  For now, we retain
      the existing :netlink_socket rules for compatibility on older kernels.
      
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      
      (cherry picked from commit 01d95c23)
      
      Change-Id: Ic00a0d474730cda91ba3bc387e0cc14482f82114
      423fd19d
    • Stephen Smalley's avatar
      Update netlink socket classes. · 01d95c23
      Stephen Smalley authored
      
      Define new netlink socket security classes introduced by upstream kernel commit
      6c6d2e9bde1c1c87a7ead806f8f5e2181d41a652 ("selinux: update netlink socket
      classes").  This was merged in Linux 4.2 and is therefore only required
      for Android kernels based on 4.2 or newer (e.g. the android-4.4 branch
      of the kernel/common tree).
      
      Add the new socket classes to socket_class_set.
      Add an initial set of allow rules although further refinement
      will likely be necessary.  Any allow rule previously written
      on :netlink_socket may need to be rewritten or duplicated for
      one or more of the more specific classes.  For now, we retain
      the existing :netlink_socket rules for compatibility on older kernels.
      
      Change-Id: I5040b30edd2d374538490a080feda96dd4bae5bf
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      01d95c23
  14. Nov 03, 2015
    • Jeff Vander Stoep's avatar
      Create attribute for moving perms out of domain · d22987b4
      Jeff Vander Stoep authored
      Motivation: Domain is overly permissive. Start removing permissions
      from domain and assign them to the domain_deprecated attribute.
      Domain_deprecated and domain can initially be assigned to all
      domains. The goal is to not assign domain_deprecated to new domains
      and to start removing domain_deprecated where it is not required or
      reassigning the appropriate permissions to the inheriting domain
      when necessary.
      
      Bug: 25433265
      Change-Id: I8b11cb137df7bdd382629c98d916a73fe276413c
      d22987b4
  15. Nov 06, 2014
    • Nick Kralevich's avatar
      Add wpa neverallow rule · 35a4ed80
      Nick Kralevich authored
      wpa should never trust any data coming from the sdcard. Add a
      compile time assertion to make sure no rules are ever added
      allowing this access.
      
      Change-Id: I5f50a8242aa30f6cc0cfd89d82b2b153625105f6
      35a4ed80
  16. Jun 26, 2014
    • Riley Spahn's avatar
      Adding policies for KeyStore MAC. · 1196d2a5
      Riley Spahn authored
      Add keystore_key class and an action for each action supported
      by keystore. Add policies that replicate the access control that
      already exists in keystore. Add auditallow rules for actions
      not known to be used frequently. Add macro for those domains
      wishing to access keystore.
      
      Change-Id: Iddd8672b9e9b72b45ee208e6eda608cc9dc61edc
      1196d2a5
  17. Jun 17, 2014
    • Stephen Smalley's avatar
      Eliminate some duplicated rules. · 00b180df
      Stephen Smalley authored
      
      As reported by sepolicy-analyze -D -P /path/to/sepolicy.
      No semantic difference reported by sediff between the policy
      before and after this change.
      
      Deduplication of selinuxfs read access resolved by taking the
      common rules to domain.te (and thereby getting rid of the
      selinux_getenforce macro altogether).
      
      Change-Id: I4de2f86fe2efe11a167e8a7d25dd799cefe482e5
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      00b180df
  18. Mar 12, 2014
  19. Mar 06, 2014
  20. Feb 28, 2014
    • Nick Kralevich's avatar
      allow wpa_cli to work. · 673acce9
      Nick Kralevich authored
      With wpa_supplicant in enforcing, wpa_cli doesn't work.
      
      Denial:
      
      type=1400 audit(1390597866.260:59): avc:  denied  { write } for  pid=3410 comm="wpa_supplicant" name="wpa_ctrl_4852-1" dev="mmcblk0p28" ino=618993 scontext=u:r:wpa:s0 tcontext=u:object_r:wifi_data_file:s0 tclass=sock_file
      
      After I9e35cc93abf89ce3594860aa3193f84a3b42ea6e and
      I51b09c5e40946673a38732ea9f601b2d047d3b62, the /data/misc/wifi/sockets
      directory is labeled properly. This change allows the communication
      between the su domain and wpa.
      
      Steps to reproduce:
        Start wifi (so wpa_supplicant will run)
        Start wpa_cli - it will hand
        $ adb root
        $ adb shell
        # wpa_cli -g @android:wpa_wlan0
      
      Bug: 12721629
      Change-Id: I03170acc155ad122c5197baaf590d17fc1ace6a5
      673acce9
    • Stephen Smalley's avatar
      Label /data/misc/wifi/sockets with wpa_socket. · 23c65b5c
      Stephen Smalley authored
      
      This will ensure that any sockets created in this directory
      will default to wpa_socket unless a type_transition is defined.
      Define a type transition for system_server to keep its separate
      system_wpa_socket type assigned for its socket.  Allow wpa
      to create and unlink sockets in the directory.  We leave the
      already existing rules for wifi_data_file in place for compatibility
      with existing devices that have wifi_data_file on /data/misc/wifi/sockets.
      
      Change-Id: I9e35cc93abf89ce3594860aa3193f84a3b42ea6e
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      23c65b5c
  21. Feb 25, 2014
    • Stephen Smalley's avatar
      Clean up socket rules. · 16011320
      Stephen Smalley authored
      
      Replace * or any permission set containing create with
      create_socket_perms or create_stream_socket_perms.
      
      Add net_domain() to all domains using network sockets and
      delete rules already covered by domain.te or net.te.
      
      For netlink_route_socket, only nlmsg_write needs to be separately
      granted to specific domains that are permitted to modify the routing
      table.   Clarification:  read/write permissions are just ability to
      perform read/recv() or write/send() on the socket, whereas nlmsg_read/
      nlmsg_write permissions control ability to observe or modify the
      underlying kernel state accessed via the socket.
      See security/selinux/nlmsgtab.c in the kernel for the mapping of
      netlink message types to nlmsg_read or nlmsg_write.
      
      Delete legacy rule for b/12061011.
      
      This change does not touch any rules where only read/write were allowed
      to a socket created by another domain (inherited across exec or
      received across socket or binder IPC).  We may wish to rewrite some or all
      of those rules with the rw_socket_perms macro but that is a separate
      change.
      
      Change-Id: Ib0637ab86f6d388043eff928e5d96beb02e5450e
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      16011320
  22. Feb 21, 2014
    • Stephen Smalley's avatar
      Ensure that /data/misc/wifi/sockets is always labeled wpa_socket. · 7ade68d7
      Stephen Smalley authored
      
      It appears that wpa_supplicant tries to rmdir /data/misc/wifi/sockets
      and re-create it at times, so make sure that it remains labeled correctly
      when re-created in this manner via a name-based type transition rule.
      Do the same for hostapd as it also has permissions for creating/removing
      this directory.
      
      <5>[83921.800071] type=1400 audit(1392997522.105:26): avc:  denied  { rmdir } for  pid=3055 comm="wpa_supplicant" name="sockets" dev="mmcblk0p28" ino=618957 scontext=u:r:wpa:s0 tcontext=u:object_r:wpa_socket:s0 tclass=dir
      
      We no longer need the type_transition for sock_file as it will inherit
      the type from the parent directory which is set via restorecon_recursive
      /data/misc/wifi/sockets or via type_transition, so drop it.
      
      Change-Id: Iffa61c426783eb03205ba6964c624c6ecea32630
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      7ade68d7
  23. Feb 04, 2014
    • Nick Kralevich's avatar
      allow wpa_cli to work. · ba1a7315
      Nick Kralevich authored
      With wpa_supplicant in enforcing, wpa_cli doesn't work.
      
      Denial:
      
      type=1400 audit(1390597866.260:59): avc:  denied  { write } for  pid=3410 comm="wpa_supplicant" name="wpa_ctrl_4852-1" dev="mmcblk0p28" ino=618993 scontext=u:r:wpa:s0 tcontext=u:object_r:wifi_data_file:s0 tclass=sock_file
      
      After I9e35cc93abf89ce3594860aa3193f84a3b42ea6e and
      I51b09c5e40946673a38732ea9f601b2d047d3b62, the /data/misc/wifi/sockets
      directory is labeled properly. This change allows the communication
      between the su domain and wpa.
      
      Steps to reproduce:
        Start wifi (so wpa_supplicant will run)
        Start wpa_cli - it will hand
        $ adb root
        $ adb shell
        # wpa_cli -g @android:wpa_wlan0
      
      Bug: 12721629
      Change-Id: I03170acc155ad122c5197baaf590d17fc1ace6a5
      ba1a7315
    • Stephen Smalley's avatar
      Label /data/misc/wifi/sockets with wpa_socket. · 418e2abd
      Stephen Smalley authored
      
      This will ensure that any sockets created in this directory
      will default to wpa_socket unless a type_transition is defined.
      Define a type transition for system_server to keep its separate
      system_wpa_socket type assigned for its socket.  Allow wpa
      to create and unlink sockets in the directory.  We leave the
      already existing rules for wifi_data_file in place for compatibility
      with existing devices that have wifi_data_file on /data/misc/wifi/sockets.
      
      Change-Id: I9e35cc93abf89ce3594860aa3193f84a3b42ea6e
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      418e2abd
  24. Jan 14, 2014
  25. Jan 11, 2014
    • Nick Kralevich's avatar
      Support forcing permissive domains to unconfined. · 623975fa
      Nick Kralevich authored
      Permissive domains are only intended for development.
      When a device launches, we want to ensure that all
      permissive domains are in, at a minimum, unconfined+enforcing.
      
      Add FORCE_PERMISSIVE_TO_UNCONFINED to Android.mk. During
      development, this flag is false, and permissive domains
      are allowed. When SELinux new feature development has been
      frozen immediately before release, this flag will be flipped
      to true. Any previously permissive domains will move into
      unconfined+enforcing.
      
      This will ensure that all SELinux domains have at least a
      minimal level of protection.
      
      Unconditionally enable this flag for all user builds.
      
      Change-Id: I1632f0da0022c80170d8eb57c82499ac13fd7858
      623975fa
  26. Nov 13, 2013
  27. Oct 21, 2013
    • Nick Kralevich's avatar
      Move unconfined domains out of permissive mode. · 353c72e3
      Nick Kralevich authored
      This change removes the permissive line from unconfined
      domains. Unconfined domains can do (mostly) anything, so moving
      these domains into enforcing should be a no-op.
      
      The following domains were deliberately NOT changed:
      1) kernel
      2) init
      
      In the future, this gives us the ability to tighten up the
      rules in unconfined, and have those tightened rules actually
      work.
      
      When we're ready to tighten up the rules for these domains,
      we can:
      
      1) Remove unconfined_domain and re-add the permissive line.
      2) Submit the domain in permissive but NOT unconfined.
      3) Remove the permissive line
      4) Wait a few days and submit the no-permissive change.
      
      For instance, if we were ready to do this for adb, we'd identify
      a list of possible rules which allow adbd to work, re-add
      the permissive line, and then upload those changes to AOSP.
      After sufficient testing, we'd then move adb to enforcing.
      We'd repeat this for each domain until everything is enforcing
      and out of unconfined.
      
      Change-Id: If674190de3262969322fb2e93d9a0e734f8b9245
      353c72e3
  28. May 20, 2013
    • repo sync's avatar
      Make all domains unconfined. · 77d4731e
      repo sync authored
      This prevents denials from being generated by the base policy.
      Over time, these rules will be incrementally tightened to improve
      security.
      
      Change-Id: I4be1c987a5d69ac784a56d42fc2c9063c402de11
      77d4731e
  29. May 15, 2013
  30. May 08, 2013
  31. May 07, 2013
    • repo sync's avatar
      Add temporary policy for wpa_supplicant. · fb076f8b
      repo sync authored
      This allows wpa_supplicant to interact with the sockets created
      for it by init. Eventually we'll want those to be properly
      labelled, but allow until then.
      
      Change-Id: I33fcd22173a8d47bbc4ada8d6aa62b4d159cbb15
      fb076f8b
  32. May 06, 2013
  33. Aug 10, 2012
  34. Jan 04, 2012
Loading