5

I usually get packages from http://f-droid.org/ repository through their package browser (because then I have a guarantee that I use free (= libre) software); and they are signed with their key.

I use CyanogenMod 10; and I have root access.

I don't like allowing packages from "unknown sources" for this.

Can I set up the system so that f-droid counts as a known source, and packages from all other unknown sources are not allowed to be installed by default as before.

Perhaps, something can be patches in the CyanogenMod distro to add f-droid's key as a key for a "known source" of packages.

3 Answers 3

4

Almost every F-Droid app is signed with a different key, though all keys are in the same key store. In order for the switch to be bypassed, F-Droid client would have to be installed as a system app and made to work safely as such. Some code has been supplied for this to work, but it hasn't been integrated yet.

4
  • So, in principle, one could add a new "known" key, but in the case of apps from f-droid, there are so many keys, that this is not practical; the only practical way is to have the f-droid client itself as a system app which would perform the signature check. Have I understood the situation correctly? Commented May 23, 2013 at 18:52
  • data/app is owned by the system user, so any system app can put an apk in there without having to go through package installer. So it's nothing to do with signatures of the apps but F-Droid would need to be signed with the system key.
    – daithib8
    Commented May 24, 2013 at 9:08
  • I'm not sure why but it's not necessary for F-Droid apk to be signed with the system key, at least if one is using CyanogenMod.
    – daithib8
    Commented Jan 6, 2014 at 20:27
  • So, should I try a new f-droid or new CM for this feature? Commented Jan 7, 2014 at 21:56
4

According to this changelog the upcoming f-droid version 0.71 should support this.

Another mention of this is in: https://github.com/WhisperSystems/TextSecure/issues/127#issuecomment-51065857

2

there is f-droid privilege extension

https://f-droid.org/en/packages/org.fdroid.fdroid.privileged.ota/

with it you should be able to install apps without having to enable "unknown source".

there are two ways to install. one using sideload. another using adb root. i will explain both below.

if done correctly fdroid with the privilege extension should even survive a reset to factory settings. it is a part of the system then.


preparations for both install methods

  • download the f-droid privilege extension from f-droid website to your pc.

    https://f-droid.org/en/packages/org.fdroid.fdroid.privileged.ota/

    to download you need to scroll down then download the latest zip. the filename should be something like this: org.fdroid.fdroid.privileged.ota_2110.zip

  • install adb on your pc and enable "usb debugging" on your device. search the internet for how to do that.

    adb is a command line tool so open a terminal. then navigate to the directory where the privileged extension zip file is located.

  • connect the device to your pc using an usb cable.

  • verify that the device is recognized using the command adb devices.

    it should show something like this:

    $ adb devices
    List of devices attached
    <some number> device
    

    if it says unauthorized or anything else you need to debug your connection. search the internet for how to do that.


the sideload method

for this you need a custom recovery which allows sideload installed on your device.

if you have lineageos installed you typically already have a suitable custom recovery. otherwise download and install twrp (https://twrp.me/).

  1. connect your device to pc with usb cable. verify device is listed under

     adb devices
    
  2. boot your device to sideload

     adb reboot sideload
    

    OR: boot your device to recovery

     adb reboot recovery
    

    then on your device in recovery set the device to sideload. in the lineageos recovery this is called "apply update" then "apply from ADB".

  3. install privilege extension by sideload

     adb sideload org.fdroid.fdroid.privileged.ota_2110.zip
    
  4. reboot device back to android.

     adb reboot
    

    OR: click on reboot in the recovery menu

check if privilege extension is enabled. see below for how to do that.

more information:


the adb root method

for this you also need "rooted debugging" enabled on your device (alongside "usb debugging").

it seems "rooted debugging" is only available if you have a custom rom like lineageos installed.

unzip the downloaded privilege extension.

now run the following adb commands one by one

adb root
adb remount
adb push F-DroidPrivilegedExtension.apk /system/priv-app/
adb push permissions_org.fdroid.fdroid.privileged.xml /system/etc/permissions/
adb push F-Droid.apk /system/app/
adb push 80-fdroid.sh /system/addon.d/
adb reboot

verify that there are no error messages after each step. except adb remount which seems to be unnecessary on recent lineageos versions. but no harm done (as far as i understand) so continue anyway.

after reboot check if privilege extension is enabled.

more information:


how to check if the privilege extension is enabled

  1. open f-droid
  2. go to settings
  3. scroll all the way down
  4. enable expert mode (will open more settings to the bottom)
  5. scroll all the way down again
  6. if you see a green checkmark beside "privileged extension" then it is enabled.

"privileged extension" is the very last option in the settings page. if you have scrolled all the way to the bottom and the last option is not "privileged extension" then the privileged extension is not enabled. also probably not correctly installed.


notes:

i have installed many fdroid with privilege extensions on many lineageos on many devices. often there were hiccups along the way and it does not work for reasons that i do not understand.

most of the time i managed to get it working after some searching on the internet and some tinkering. sometimes it seems just dumb luck getting the right command combination by coincidence to get it to work.

sometimes it just does not work. sorry that i cannot help you further then.


1
  • You have this as Magisk module too
    – beeshyams
    Commented Dec 29, 2019 at 23:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .