1

I'm trying to build a custom ROM with secure access via adb. My goal is to secure the android image so that it can only be accessed with a certain adb RSA key pair.

When I build AOSP with 'user' variant, adb doesn't work, cannot connect to it in x86, always get 'connection refused by host', but when I build it with another variant (userdebug or eng), adb connect with no restrictions.

How can I secure adb in order to allow connections only from clients that uses certain RSA pairs?

2
  • Have you checked that adb is running at all (is enabled) in the non-debug builds?
    – Robert
    Feb 25, 2021 at 10:10
  • I enable it manually from developer options (usb debug), but in x86 virtual machine there is no easy way to connect via USB and enable adb via tcpip. I am trying to create a custom ROM that get ADB enabled via tcpip by default and secure with specific RSA keys.
    – dgcipp
    Feb 26, 2021 at 7:25

1 Answer 1

0

You can find information about this on the AOSP pages about adding support for a new device. Briefly, it goes like this:

  1. Create a key pair with adb keypair.
  2. Put the keypair into your source tree.
  3. Set the build variable PRODUCT_ADB_KEYS to point to the directory containing the key pair.
  4. Do your build.
  5. To connect to this build, once it is running on device or emulator, set the environment variable ADB_VENDOR_KEYS to point to the directory with the key pair.

You must log in to answer this question.

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