Commit graph

2084 commits

Author SHA1 Message Date
Daniel Cashman
969f53a97f am f094e58f: am 715023eb: Merge "Changed unconfined process policy to a whitelist."
* commit 'f094e58fa3b2dda7b41ca988602285688e17c7a7':
  Changed unconfined process policy to a whitelist.
2014-06-02 17:36:38 +00:00
Daniel Cashman
f094e58fa3 am 715023eb: Merge "Changed unconfined process policy to a whitelist."
* commit '715023eba196cb5dd226df89181c17d9e0c6936f':
  Changed unconfined process policy to a whitelist.
2014-06-02 17:31:04 +00:00
Daniel Cashman
715023eba1 Merge "Changed unconfined process policy to a whitelist." 2014-06-02 17:28:44 +00:00
Riley Spahn
52dcc94deb Changed unconfined process policy to a whitelist.
Rewrote the process policy in external/sepolicy/unconfined.te
from a blacklist to a whitelist to be more easily understood.
There were previously 11 disallowed permissions and now there are
19 allowed permissions.

Change-Id: Ida4dc881c5fedc56980324774f40e09a9b8a830a
2014-06-02 09:18:55 -07:00
Robert Craig
ec87ecb991 am 8571ed16: am 8b7545bf: Build the selinux_version file.
* commit '8571ed162e85c507ea93b06c6816cdf99019625a':
  Build the selinux_version file.
2014-05-31 08:49:29 +00:00
Robert Craig
8571ed162e am 8b7545bf: Build the selinux_version file.
* commit '8b7545bf5745e1e0aba55b0334de40d2334728b1':
  Build the selinux_version file.
2014-05-31 04:56:21 +00:00
Robert Craig
8b7545bf57 Build the selinux_version file.
The selinux_version file is used to perform policy
versioning checks by libselinux and SELinuxMMAC. When
loading policy a check is first performed to determine
if the policy out in /data/security/current should be
used to override the base policy shipped with the device.
The selinux_version file is used to make that choice. The
contents of the file simply contains the BUILD_FINGERPRINT
that the policy was built against. A simple string comparison
is then performed by libselinux and SELinuxMMAC.

Change-Id: I69d9d071743cfd46bb247c98f94a193396f8ebbd
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
2014-05-30 20:24:18 +00:00
Stephen Smalley
fb2648191c am 7ac88000: am 3235f61a: Restrict /data/security and setprop selinux.reload_policy access.
* commit '7ac880005144b7444fb92595c2acea0b54955989':
  Restrict /data/security and setprop selinux.reload_policy access.
2014-05-30 20:10:08 +00:00
Stephen Smalley
7ac8800051 am 3235f61a: Restrict /data/security and setprop selinux.reload_policy access.
* commit '3235f61aa859af1d1c3d060eb55cf1929bc6914f':
  Restrict /data/security and setprop selinux.reload_policy access.
2014-05-30 20:06:23 +00:00
Stephen Smalley
3235f61aa8 Restrict /data/security and setprop selinux.reload_policy access.
Remove /data/security and setprop selinux.reload_policy access
from unconfineddomain, and only add back what is needed to
init (system_server already gets the required allow rules via
the selinux_manage_policy macro).

init (via init.rc post-fs-data) originally creates /data/security
and may later restorecon it.  init also sets the property (also from
init.rc post-fs-data) to trigger a reload once /data is mounted.
The system_server (SELinuxPolicyInstallReceiver in particular) creates
subdirectories under /data/security for updates, writes files to these
subdirectories, creates the /data/security/current symlink to the update
directory, and sets the property to trigger a reload when an update bundle
is received.

Add neverallow rules to ensure that we do not allow undesired access
to security_file or security_prop.

This is only truly meaningful if the support for /data/security policies
is restored, but is harmless otherwise.

Also drop the persist.mmac property_contexts entry; it was never used in
AOSP, only in our tree (for middleware MAC) and is obsolete.

Change-Id: I5ad5e3b6fc7abaafd314d31723f37b708d8fcf89
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-30 18:30:11 +00:00
Stephen Smalley
c664083bad am ffbba62e: am e60723ab: Create a separate recovery policy.
* commit 'ffbba62eafb759573aad4bcdc77d56026697ea00':
  Create a separate recovery policy.
2014-05-30 18:27:02 +00:00
Stephen Smalley
ffbba62eaf am e60723ab: Create a separate recovery policy.
* commit 'e60723ab59f48626c6a700ba645bfe5eac6f0fc3':
  Create a separate recovery policy.
2014-05-30 18:23:41 +00:00
Stephen Smalley
e60723ab59 Create a separate recovery policy.
Create a separate recovery policy and only include the
recovery domain allow rules in it.

Change-Id: I444107f9821eabf4164ba07a44d03bd71e719989
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-30 12:53:32 -04:00
Nick Kralevich
422d2e6ed9 am 7b601c31: am ac664270: Merge "Only auditallow unlabeled accesses not allowed elsewhere."
* commit '7b601c3105cf66c330f19a86eb8a74759277054d':
  Only auditallow unlabeled accesses not allowed elsewhere.
2014-05-30 16:00:45 +00:00
Stephen Smalley
f509c81c72 am 871b832c: am 73b0346a: Explictly allow init and kernel unlabeled access.
* commit '871b832cee49a14ca9265451a7c902d32585c603':
  Explictly allow init and kernel unlabeled access.
2014-05-30 16:00:44 +00:00
Nick Kralevich
7b601c3105 am ac664270: Merge "Only auditallow unlabeled accesses not allowed elsewhere."
* commit 'ac6642703f179f8d36b1cca4fe5bd261de65b4b4':
  Only auditallow unlabeled accesses not allowed elsewhere.
2014-05-30 15:56:35 +00:00
Stephen Smalley
871b832cee am 73b0346a: Explictly allow init and kernel unlabeled access.
* commit '73b0346a7d8c500c24731575c118b2fefb8075ea':
  Explictly allow init and kernel unlabeled access.
2014-05-30 15:56:34 +00:00
Nick Kralevich
ac6642703f Merge "Only auditallow unlabeled accesses not allowed elsewhere." 2014-05-30 15:54:30 +00:00
Stephen Smalley
73b0346a7d Explictly allow init and kernel unlabeled access.
These permissions are already allowed indirectly via unconfineddomain
and via domain, but ultimately we plan to remove them from those two
attributes.  Explicitly allow the ones we expect to be required,
matching the complement of the auditallow rules in domain.te.

Change-Id: I43edca89d59c159b97d49932239f8952a848031c
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-30 09:53:00 -04:00
Stephen Smalley
2c8bf56f96 Only auditallow unlabeled accesses not allowed elsewhere.
https://android-review.googlesource.com/#/c/95900/ added further
unlabeled rules for installd and added explicit unlabeled rules for
vold and system_server.  Exclude these permissions from the auditallow
rules on unlabeled so that we only see the ones that would be denied if
we were to remove the allow domain rules here.

Change-Id: I2b9349ad6606bcb6a74a7e67343a8a9e5d70174c
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-30 09:42:01 -04:00
Stephen Smalley
9890c746b5 am e3a92d50: am f85c1fc2: Allow installd, vold, system_server unlabeled access.
* commit 'e3a92d5067e2c4b1801fc73b3b527c0dcbe940c5':
  Allow installd, vold, system_server unlabeled access.
2014-05-29 21:06:36 +00:00
Stephen Smalley
1915d0e94c am c0254385: am eb1bbf26: Clean up kernel, init, and recovery domains.
* commit 'c0254385eb5382aebb524132590098a0ac57e5b2':
  Clean up kernel, init, and recovery domains.
2014-05-29 21:06:26 +00:00
Stephen Smalley
e3a92d5067 am f85c1fc2: Allow installd, vold, system_server unlabeled access.
* commit 'f85c1fc293523db241c48d815b165067b8a0f471':
  Allow installd, vold, system_server unlabeled access.
2014-05-29 20:39:32 +00:00
Stephen Smalley
f85c1fc293 Allow installd, vold, system_server unlabeled access.
The bugs that motivated bringing back the unlabeled allowall rules,
https://android-review.googlesource.com/#/c/94971/
should be resolved by the following changes:
https://android-review.googlesource.com/#/c/94966/
https://android-review.googlesource.com/#/c/96080/

Beyond those changes, installd needs to be able to remove package directories
for apps that no longer exist or have moved (e.g. to priv-app) on upgrades, so
allow it the permissions required for this purpose.  vold needs to be able
to chown/chmod/restorecon files in asec containers so allow it the
permissions to do so.  system_server tries to access all /data/data
subdirectories so permit it to do so.  installd and system_server
read the pkg.apk file before it has been relabeled by vold and therefore
need to read unlabeled files.

Change-Id: I70da7d605c0d037eaa5f3f5fda24f5e7715451dc
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-29 16:35:01 -04:00
Stephen Smalley
c0254385eb am eb1bbf26: Clean up kernel, init, and recovery domains.
* commit 'eb1bbf2632dc20e836f3d340feab548ee496e291':
  Clean up kernel, init, and recovery domains.
2014-05-29 20:01:26 +00:00
Stephen Smalley
eb1bbf2632 Clean up kernel, init, and recovery domains.
Narrow the relabelto rules to a more specific type set
for each domain.

Drop mount permissions from the kernel domain since mounting
occurs after switching to the init domain.  This was likely
a residual of when all processes were left in the kernel domain
on a recovery boot due to the missing setcon statement in the
recovery init.rc.

Be consistent with unlabeled filesystems (i.e. filesystems
without any matching fs_use or genfs_contexts entry) so
that we can also unmount them.

Add comments to note the reason for various rules.

Change-Id: I269a1744ed7bf8c6be899494c5dc97847e5a994d
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-29 14:35:55 -04:00
Nick Kralevich
d39c925bdc am 24cf6d63: am 4553074c: Merge "Remove /system write from unconfined"
* commit '24cf6d63ca99ceb087fe617fd4003bec67bbc1f2':
  Remove /system write from unconfined
2014-05-29 16:08:30 +00:00
Nick Kralevich
24cf6d63ca am 4553074c: Merge "Remove /system write from unconfined"
* commit '4553074c5e01cbfbd377e6b2b0cfeb695aff0376':
  Remove /system write from unconfined
2014-05-29 16:06:36 +00:00
Nick Kralevich
4553074c5e Merge "Remove /system write from unconfined" 2014-05-29 16:05:09 +00:00
Nick Kralevich
03ce512072 Remove /system write from unconfined
Don't allow writes to /system from unconfined domains.
/system is always mounted read-only, and no process should
ever need to write there.

Allow recovery to write to /system. This is needed to apply OTA
images.

Change-Id: I11aa8bd0c3b7f53ebe83806a0547ab8d5f25f3c9
2014-05-29 12:04:35 -04:00
Nick Kralevich
3c11c348de am 2c6fbb30: am d6aa23df: Merge "Label ril.cdma with radio_prop."
* commit '2c6fbb30479d82b6816986129ac1d8952b21aabe':
  Label ril.cdma with radio_prop.
2014-05-29 15:50:36 +00:00
Nick Kralevich
2c6fbb3047 am d6aa23df: Merge "Label ril.cdma with radio_prop."
* commit 'd6aa23dfb1251feff87b5c5f9ab47b61bffd4fed':
  Label ril.cdma with radio_prop.
2014-05-29 15:48:10 +00:00
Nick Kralevich
d6aa23dfb1 Merge "Label ril.cdma with radio_prop." 2014-05-29 15:45:56 +00:00
Stephen Smalley
fdfae4deb6 am 040b21d9: am ad0d0fc7: Protect /data/property.
* commit '040b21d95e412e9ee241edb9991f5eb2300c37d3':
  Protect /data/property.
2014-05-29 15:01:15 +00:00
Stephen Smalley
040b21d95e am ad0d0fc7: Protect /data/property.
* commit 'ad0d0fc722d04e465ce2b0bfd2f8e04714c75391':
  Protect /data/property.
2014-05-29 14:57:57 +00:00
Stephen Smalley
ad0d0fc722 Protect /data/property.
/data/property is only accessible by root and is used by the init
property service for storing persistent property values.  Create
a separate type for it and only allow init to write to the directory
and files within it.  Ensure that we do not allow access to other domains
in future changes or device-specific policy via a neverallow rule.

Change-Id: Iff556b9606c5651c0f1bba902e30b59bdd6f063a
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-29 13:43:37 +00:00
Stephen Smalley
3a099879fb Label ril.cdma with radio_prop.
Resolves denials such as:
avc:  denied  { set } for property=ril.cdma.inecmmode scontext=u:r:radio:s0 tcontext=u:object_r:rild_prop:s0 tclass=property_service

This makes ril.cdma consistent with net.cdma.

We may ultimately need to coalesce rild_prop and radio_prop; they
were an attempt to distinguish what can be set by rild from what can be
set by com.android.phone, but the init property service DAC checking
permits any of them to be set by anything with the radio AID.  We
presently allow rild to set either type, but radio can only set radio_prop.

Change-Id: Ia3852db187e52427e18075e24b2beab19dd59c1f
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-29 09:12:08 -04:00
Nick Kralevich
4731688a13 am 8c49978f: am c8859c2d: Merge "remove syslog_* from unconfined"
* commit '8c49978f68d43a65160aaa5a27bbb9baa9a86432':
  remove syslog_* from unconfined
2014-05-29 13:01:01 +00:00
Nick Kralevich
8c49978f68 am c8859c2d: Merge "remove syslog_* from unconfined"
* commit 'c8859c2d152e42b8084fa1cd08c875afc1bf2451':
  remove syslog_* from unconfined
2014-05-29 12:58:00 +00:00
Nick Kralevich
c8859c2d15 Merge "remove syslog_* from unconfined" 2014-05-29 12:55:55 +00:00
Nick Kralevich
1dd5b3aa10 am 0d5df963: am 8dd5053f: Merge "Restore system_app access to system-owned /data directories."
* commit '0d5df96350db09b4bf75cce865f504e15f3e0ae6':
  Restore system_app access to system-owned /data directories.
2014-05-28 21:04:53 +00:00
Nick Kralevich
0d5df96350 am 8dd5053f: Merge "Restore system_app access to system-owned /data directories."
* commit '8dd5053f928a4cff19aba4da2aee30e9bffaf93d':
  Restore system_app access to system-owned /data directories.
2014-05-28 21:01:13 +00:00
Nick Kralevich
8dd5053f92 Merge "Restore system_app access to system-owned /data directories." 2014-05-28 20:56:34 +00:00
Nick Kralevich
685e2f9d9c remove syslog_* from unconfined
As suggested in https://android-review.googlesource.com/95966 , remove
various syslog_* from unconfined. SELinux domains which want to use
syslog_* can declare it themselves.

Change-Id: I7a8335850d1b8d3463491b4ef8c657f57384cfa4
2014-05-28 13:48:52 -07:00
Nick Kralevich
65a6c29d87 am 9c463fe7: am 27c702dd: Merge "dontaudit su"
* commit '9c463fe7af273cb33207865c58dfcf16403ac130':
  dontaudit su
2014-05-28 13:14:55 +00:00
Nick Kralevich
8fd6da9c24 am 87fa2640: am f821b5a7: allow shell dmesg
* commit '87fa26409c05655875efbe3cd6ce65f5a194740e':
  allow shell dmesg
2014-05-28 13:14:54 +00:00
Nick Kralevich
9c463fe7af am 27c702dd: Merge "dontaudit su"
* commit '27c702dd5413764d4d50e33bf33f3da40261c5a1':
  dontaudit su
2014-05-28 13:11:39 +00:00
Nick Kralevich
87fa26409c am f821b5a7: allow shell dmesg
* commit 'f821b5a7977102a417b32f358bf87d1e0cdeb06d':
  allow shell dmesg
2014-05-28 13:11:38 +00:00
Nick Kralevich
27c702dd54 Merge "dontaudit su" 2014-05-28 13:10:46 +00:00
Nick Kralevich
f821b5a797 allow shell dmesg
Allow the shell user to see the dmesg output. This data is already
available via "adb bugreport", but isn't easy to access.

Bug: 10020939
Change-Id: I9d4bbbd41cb02b707cdfee79f826a39c1ec2f177
2014-05-28 13:09:53 +00:00