F-Droid privileged extension #253

Closed
thestinger opened this Issue May 5, 2016 · 29 comments

Comments

Projects
None yet
6 participants
@thestinger
Contributor

thestinger commented May 5, 2016

No description provided.

@oatberry

This comment has been minimized.

Show comment Hide comment
@oatberry

oatberry May 19, 2016

What's preventing this from working?

What's preventing this from working?

@alxxlc

This comment has been minimized.

Show comment Hide comment
@alxxlc

alxxlc May 19, 2016

No root access when installing the extension. At least, that's the issue I had.

alxxlc commented May 19, 2016

No root access when installing the extension. At least, that's the issue I had.

@thestinger

This comment has been minimized.

Show comment Hide comment
@thestinger

thestinger May 20, 2016

Contributor

This issue is about bundling it. Nothing is preventing it from working, it's work that has to be done. Modifying the OS partitions can never be supported and isn't what I filed the issue about.

Contributor

thestinger commented May 20, 2016

This issue is about bundling it. Nothing is preventing it from working, it's work that has to be done. Modifying the OS partitions can never be supported and isn't what I filed the issue about.

@anantshri

This comment has been minimized.

Show comment Hide comment
@anantshri

anantshri Jun 3, 2016

I can install packages on nexus 5x from f-droid directly without changing any permissions. So is this implemented or are we still waiting on it.

I can install packages on nexus 5x from f-droid directly without changing any permissions. So is this implemented or are we still waiting on it.

@thestinger

This comment has been minimized.

Show comment Hide comment
@thestinger

thestinger Jun 3, 2016

Contributor

It's not implemented. I don't think it would provide any functionality yet but it's going to need to be done.

Contributor

thestinger commented Jun 3, 2016

It's not implemented. I don't think it would provide any functionality yet but it's going to need to be done.

@eighthave

This comment has been minimized.

Show comment Hide comment
@eighthave

eighthave Aug 12, 2016

This is now implemented, you can build the F-Droid Privileged Extension using the Android.mk that has been merged in: https://gitlab.com/fdroid/privileged-extension/merge_requests/3

@relan built it into his ROM, he also wrote that merge request.

This is now implemented, you can build the F-Droid Privileged Extension using the Android.mk that has been merged in: https://gitlab.com/fdroid/privileged-extension/merge_requests/3

@relan built it into his ROM, he also wrote that merge request.

@relan

This comment has been minimized.

Show comment Hide comment
@relan

relan Aug 20, 2016

I'd like to work on this. But before I start, some questions:

  1. Will Copperhead maintain own mirror of the Privileged Extension repo or manifest should reference https://gitlab.com/fdroid/privileged-extension.git directly?
  2. What should happen to the F-Droid package that is already included into CopperheadOS? Will you continue to ship it after the Privileged Extension is included, switch to a prebuilt (by F-Droid) version, or completely remove it?
  3. Upgrade path for existing users. Depending on the answer to the previous question, we should figure out how to make OS upgrade (to a version that includes Privileged Extension) seamless.

relan commented Aug 20, 2016

I'd like to work on this. But before I start, some questions:

  1. Will Copperhead maintain own mirror of the Privileged Extension repo or manifest should reference https://gitlab.com/fdroid/privileged-extension.git directly?
  2. What should happen to the F-Droid package that is already included into CopperheadOS? Will you continue to ship it after the Privileged Extension is included, switch to a prebuilt (by F-Droid) version, or completely remove it?
  3. Upgrade path for existing users. Depending on the answer to the previous question, we should figure out how to make OS upgrade (to a version that includes Privileged Extension) seamless.
@thestinger

This comment has been minimized.

Show comment Hide comment
@thestinger

thestinger Aug 21, 2016

Contributor

Will Copperhead maintain own mirror of the Privileged Extension repo or manifest should reference https://gitlab.com/fdroid/privileged-extension.git directly?

Using it directly would be reasonable but it would have to reference a specific revision or tag in the manifest. It probably makes more sense to fork it right now since it's likely we will end up needing to at least temporarily make some changes now and then. It would also add a third code hosting site as a failure point to the manifest. I would rather not do that. I already dislike GitHub for hosting the code and would like to move it to git.copperhead.co at some point in the future when we have more resources.

What should happen to the F-Droid package that is already included into CopperheadOS? Will you continue to ship it after the Privileged Extension is included, switch to a prebuilt (by F-Droid) version, or completely remove it?

It will still be shipped by default if the privileged extension is included, and it won't be possible to use the F-Droid version due to security features that are in the process of being implemented. Android has nothing comparable to verified boot for apps outside of /system and /vendor and no unverified code is going to be used in the base system. It won't be permitted to update a base system app out-of-band.

Contributor

thestinger commented Aug 21, 2016

Will Copperhead maintain own mirror of the Privileged Extension repo or manifest should reference https://gitlab.com/fdroid/privileged-extension.git directly?

Using it directly would be reasonable but it would have to reference a specific revision or tag in the manifest. It probably makes more sense to fork it right now since it's likely we will end up needing to at least temporarily make some changes now and then. It would also add a third code hosting site as a failure point to the manifest. I would rather not do that. I already dislike GitHub for hosting the code and would like to move it to git.copperhead.co at some point in the future when we have more resources.

What should happen to the F-Droid package that is already included into CopperheadOS? Will you continue to ship it after the Privileged Extension is included, switch to a prebuilt (by F-Droid) version, or completely remove it?

It will still be shipped by default if the privileged extension is included, and it won't be possible to use the F-Droid version due to security features that are in the process of being implemented. Android has nothing comparable to verified boot for apps outside of /system and /vendor and no unverified code is going to be used in the base system. It won't be permitted to update a base system app out-of-band.

@relan

This comment has been minimized.

Show comment Hide comment
@relan

relan Aug 21, 2016

So, the point of this issue is applying the principle of least privilege to F-Droid? That is

  1. Fork Privileged Extension.
  2. Modify it to trust only Copperhead-signed F-Droid client package.
  3. Make F-Droid client package non-privileged (revert CopperheadOS/fdroidclient@4a9a01e).

relan commented Aug 21, 2016

So, the point of this issue is applying the principle of least privilege to F-Droid? That is

  1. Fork Privileged Extension.
  2. Modify it to trust only Copperhead-signed F-Droid client package.
  3. Make F-Droid client package non-privileged (revert CopperheadOS/fdroidclient@4a9a01e).
@thestinger

This comment has been minimized.

Show comment Hide comment
@thestinger

thestinger Aug 21, 2016

Contributor

To some extent, but the privileged extension is also how unattended app upgrades will be implemented which is important.

Contributor

thestinger commented Aug 21, 2016

To some extent, but the privileged extension is also how unattended app upgrades will be implemented which is important.

@thestinger

This comment has been minimized.

Show comment Hide comment
@thestinger

thestinger Aug 21, 2016

Contributor

Android 7.0 will also bring unattended upgrade support for the base system for new devices using the new partition layout style, but that will need to be implemented in the Updater app.

Contributor

thestinger commented Aug 21, 2016

Android 7.0 will also bring unattended upgrade support for the base system for new devices using the new partition layout style, but that will need to be implemented in the Updater app.

@eighthave

This comment has been minimized.

Show comment Hide comment
@eighthave

eighthave Aug 22, 2016

I agree its important to limit privileges as much as possible, but that is not the only factor we need to consider here. Timely updates and frequent auditing are also essential. Therefore, there are a lot of reasons why Copperhead should use the official F-Droid.apk binaries along side the ROM-signed Privileged Extension.

At least until you have a Copperhead repo setup for updates, I think it is important to use the f-droid.org version of F-Droid so that people can get updates as soon as possible. Also, it is important to minimize the amount of updates that are pushed through the ROM update channel because those require reboots and a lot more user interaction. With the Privileged Extension, there can be fully automatic background updates.

Also consider the app swapping functionality: since F-Droid can send an APK directly from one device to another, if a Copperhead user sends F-Droid to a non-Copperhead user, then that non-Copperhead user will not have an update channel for F-Droid since no repository distributes the Copperhead-signed F-Droid.apk.

A more productive way to ensure that Copperhead is not getting malware versions of F-Droid is for Copperhead to run an F-Droid Verification Server that automatically reproducibly rebuilds the F-Droid source and compares to what is hosted on f-droid.org. This could also optionally include an instance of the automated drozer testing that Copperhead has made for F-Droid.

I agree its important to limit privileges as much as possible, but that is not the only factor we need to consider here. Timely updates and frequent auditing are also essential. Therefore, there are a lot of reasons why Copperhead should use the official F-Droid.apk binaries along side the ROM-signed Privileged Extension.

At least until you have a Copperhead repo setup for updates, I think it is important to use the f-droid.org version of F-Droid so that people can get updates as soon as possible. Also, it is important to minimize the amount of updates that are pushed through the ROM update channel because those require reboots and a lot more user interaction. With the Privileged Extension, there can be fully automatic background updates.

Also consider the app swapping functionality: since F-Droid can send an APK directly from one device to another, if a Copperhead user sends F-Droid to a non-Copperhead user, then that non-Copperhead user will not have an update channel for F-Droid since no repository distributes the Copperhead-signed F-Droid.apk.

A more productive way to ensure that Copperhead is not getting malware versions of F-Droid is for Copperhead to run an F-Droid Verification Server that automatically reproducibly rebuilds the F-Droid source and compares to what is hosted on f-droid.org. This could also optionally include an instance of the automated drozer testing that Copperhead has made for F-Droid.

@eighthave

This comment has been minimized.

Show comment Hide comment
@eighthave

eighthave Aug 22, 2016

I forgot to add: as long as the f-droid.org-signed FDroid.apk is included in /system/app, then the F-Droid app itself will not get any extra privileges beyond the regular permissions it asks for. Only the F-Droid Privileged Extension needs to run with elevated permissions, and that grants install/delete access to F-Droid.

I forgot to add: as long as the f-droid.org-signed FDroid.apk is included in /system/app, then the F-Droid app itself will not get any extra privileges beyond the regular permissions it asks for. Only the F-Droid Privileged Extension needs to run with elevated permissions, and that grants install/delete access to F-Droid.

@eighthave

This comment has been minimized.

Show comment Hide comment
@eighthave

eighthave Aug 22, 2016

Also, for custom/whitelabel builds that aren't just defaulting to the f-droid.org repo, then it makes perfect sense to use the platform signing key. If it is F-Droid itself being included, that's the case where it should use a reproducible build and the f-droid.org signature.

Also, for custom/whitelabel builds that aren't just defaulting to the f-droid.org repo, then it makes perfect sense to use the platform signing key. If it is F-Droid itself being included, that's the case where it should use a reproducible build and the f-droid.org signature.

@relan

This comment has been minimized.

Show comment Hide comment
@relan

relan Aug 23, 2016

If Copperhead isn't going to make any modifications to F-Droid client, I believe it's better to ship F-Droid-signed version via reproducible process.

This will be a much better UX because users want to upgrade apps when new versions are available (even when version bump gives nothing to them).

How about giving users an option to sideload and use official F-Droid client instead of Copperhead-signed one? This will require changing Copperhead's F-Droid package ID and whitelisting two certificates in the Privileged Extension.

relan commented Aug 23, 2016

If Copperhead isn't going to make any modifications to F-Droid client, I believe it's better to ship F-Droid-signed version via reproducible process.

This will be a much better UX because users want to upgrade apps when new versions are available (even when version bump gives nothing to them).

How about giving users an option to sideload and use official F-Droid client instead of Copperhead-signed one? This will require changing Copperhead's F-Droid package ID and whitelisting two certificates in the Privileged Extension.

@thestinger

This comment has been minimized.

Show comment Hide comment
@thestinger

thestinger Aug 24, 2016

Contributor

@eighthave OS updates are not going to require any user interaction. Android Nougat brings support for unattended, automatic upgrades. The only required user interaction is accepting a reboot after the update is installed, but there are alternatives.

Contributor

thestinger commented Aug 24, 2016

@eighthave OS updates are not going to require any user interaction. Android Nougat brings support for unattended, automatic upgrades. The only required user interaction is accepting a reboot after the update is installed, but there are alternatives.

@thestinger

This comment has been minimized.

Show comment Hide comment
@thestinger

thestinger Aug 24, 2016

Contributor

Any bundled apps are going to have to be provided by the base system partitions unless someone implements proper signing and verification for non-bundled apps. Frequent, security updates are already required for the base system (i.e. several times a month). I have no problem with enforcing that people reboot within a certain time period after an unattended upgrade.

If someone cares about this, they should work on adding unattended upgrade support to the Updater app to take advantage of the new Android Nougat update system.

Contributor

thestinger commented Aug 24, 2016

Any bundled apps are going to have to be provided by the base system partitions unless someone implements proper signing and verification for non-bundled apps. Frequent, security updates are already required for the base system (i.e. several times a month). I have no problem with enforcing that people reboot within a certain time period after an unattended upgrade.

If someone cares about this, they should work on adding unattended upgrade support to the Updater app to take advantage of the new Android Nougat update system.

@thestinger

This comment has been minimized.

Show comment Hide comment
@thestinger

thestinger Aug 24, 2016

Contributor

(or work on implementing proper signing / verification for non-bundled apps, but that's much harder, and due to backwards compatibility will not be able to provide the requirements to use it for F-Droid)

Contributor

thestinger commented Aug 24, 2016

(or work on implementing proper signing / verification for non-bundled apps, but that's much harder, and due to backwards compatibility will not be able to provide the requirements to use it for F-Droid)

@eighthave

This comment has been minimized.

Show comment Hide comment
@eighthave

eighthave Aug 24, 2016

@thestinger

This comment has been minimized.

Show comment Hide comment
@thestinger

thestinger Aug 24, 2016

Contributor

There are a two separate things that are not considered acceptable:

  • bundled apps with non-verified apks / libraries / oat files (i.e. no dm-verity or equivalent signing for the app), unless a dire need arises to ship a quick update, but an update would still be shipped as part of an OS upgrade right away too
  • bundling code where Copperhead doesn't control updates (if we were going to use reproducible builds for F-Droid, we would still sign it with either the releasekey or another key that we control)

Many users will not reboot their phone, and hold off as long
as possible, which defeats the purpose of prompt updates.

I have no problem with enforcing a deadline like 2 days once unattended upgrades are implemented, where it will reboot when the device is idle once the delay elapses.

Contributor

thestinger commented Aug 24, 2016

There are a two separate things that are not considered acceptable:

  • bundled apps with non-verified apks / libraries / oat files (i.e. no dm-verity or equivalent signing for the app), unless a dire need arises to ship a quick update, but an update would still be shipped as part of an OS upgrade right away too
  • bundling code where Copperhead doesn't control updates (if we were going to use reproducible builds for F-Droid, we would still sign it with either the releasekey or another key that we control)

Many users will not reboot their phone, and hold off as long
as possible, which defeats the purpose of prompt updates.

I have no problem with enforcing a deadline like 2 days once unattended upgrades are implemented, where it will reboot when the device is idle once the delay elapses.

@thestinger

This comment has been minimized.

Show comment Hide comment
@thestinger

thestinger Aug 24, 2016

Contributor

F-Droid is a very, very small part of the base system. I'm not going to treat it in a special way. There are already very important security updates that need to be shipped multiple times in a month. I'm not interested in a very incomplete solution to the problem especially when it would destroy other security properties.

Contributor

thestinger commented Aug 24, 2016

F-Droid is a very, very small part of the base system. I'm not going to treat it in a special way. There are already very important security updates that need to be shipped multiple times in a month. I'm not interested in a very incomplete solution to the problem especially when it would destroy other security properties.

@thestinger

This comment has been minimized.

Show comment Hide comment
@thestinger

thestinger Aug 24, 2016

Contributor

I'm only going to be convinced by code implementing this without breaking the requirements, not debate about it. I've already considered it heavily before we even migrated to being based on AOSP and I've made up my mind about how these things should be approached. I don't plan on bundling any other apps until far in the future when things like unattended upgrades and an F-Droid server will be implemented.

Contributor

thestinger commented Aug 24, 2016

I'm only going to be convinced by code implementing this without breaking the requirements, not debate about it. I've already considered it heavily before we even migrated to being based on AOSP and I've made up my mind about how these things should be approached. I don't plan on bundling any other apps until far in the future when things like unattended upgrades and an F-Droid server will be implemented.

@thestinger

This comment has been minimized.

Show comment Hide comment
@thestinger

thestinger Aug 24, 2016

Contributor

Note that Silence is not an additional bundled app, it displaces Messenger. Chromium replaces the Browser app. There's a single additional bundled app: F-Droid. There is no upstream where we could get Chromium or the WebView and those need way more frequent upgrades than F-Droid, as do a bunch of components like the kernel (multiple times a month for critical Code Aurora Forum patches) that cannot be updated as an app.

Contributor

thestinger commented Aug 24, 2016

Note that Silence is not an additional bundled app, it displaces Messenger. Chromium replaces the Browser app. There's a single additional bundled app: F-Droid. There is no upstream where we could get Chromium or the WebView and those need way more frequent upgrades than F-Droid, as do a bunch of components like the kernel (multiple times a month for critical Code Aurora Forum patches) that cannot be updated as an app.

@eighthave

This comment has been minimized.

Show comment Hide comment
@eighthave

eighthave Aug 24, 2016

@thestinger

This comment has been minimized.

Show comment Hide comment
@thestinger

thestinger Aug 26, 2016

Contributor

I meant the unattended OS upgrade feature in N FWIW.

Contributor

thestinger commented Aug 26, 2016

I meant the unattended OS upgrade feature in N FWIW.

@eighthave

This comment has been minimized.

Show comment Hide comment
@eighthave

eighthave Aug 30, 2016

@relan if you're still up for doing this pull request, the easy path is to do it like you originally said: change the flag on the Copperhead F-Droid build to make it non-privileged, then make a fork of https://gitlab.com/fdroid/privileged-extension.git and make the build there only allow the Copperhead signing key. You can use https://github.com/guardianproject/checkey as one easy way to get the signing key, or I can help with other ways.

@relan if you're still up for doing this pull request, the easy path is to do it like you originally said: change the flag on the Copperhead F-Droid build to make it non-privileged, then make a fork of https://gitlab.com/fdroid/privileged-extension.git and make the build there only allow the Copperhead signing key. You can use https://github.com/guardianproject/checkey as one easy way to get the signing key, or I can help with other ways.

@relan

This comment has been minimized.

Show comment Hide comment
@relan

relan Aug 31, 2016

Copperhead should fork of the Privileged Extension repo first. After that we will be able to submit pull requests to

  1. platform_packages_apps_F-DroidPrivilegedExtension (or whatever they call it) -- replace F-Droid's certificate with a Copperhead's one
  2. platform_manifest -- include Privileged Extension into the repositories list
  3. platform_build -- include Privileged Extension into the build
  4. platform_packages_apps_F-Droid -- remove privileged flag

relan commented Aug 31, 2016

Copperhead should fork of the Privileged Extension repo first. After that we will be able to submit pull requests to

  1. platform_packages_apps_F-DroidPrivilegedExtension (or whatever they call it) -- replace F-Droid's certificate with a Copperhead's one
  2. platform_manifest -- include Privileged Extension into the repositories list
  3. platform_build -- include Privileged Extension into the build
  4. platform_packages_apps_F-Droid -- remove privileged flag
@thestinger

This comment has been minimized.

Show comment Hide comment
@thestinger

thestinger Sep 13, 2016

Contributor

I'll get to this soon, have been very busy with Nougat porting issues.

Contributor

thestinger commented Sep 13, 2016

I'll get to this soon, have been very busy with Nougat porting issues.

@thestinger thestinger self-assigned this Nov 17, 2016

@thestinger thestinger added the upstream label Dec 14, 2016

@thestinger

This comment has been minimized.

Show comment Hide comment
@thestinger

thestinger Dec 14, 2016

Contributor

It's integrated but needs some upstream issues fixed before we can switch over: #528.

Contributor

thestinger commented Dec 14, 2016

It's integrated but needs some upstream issues fixed before we can switch over: #528.

@thestinger thestinger closed this Dec 14, 2016

@thestinger thestinger removed the upstream label Dec 14, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment