Mark M. | has entered the room |
Mark M. | turned on guest access |
Nov 14 | 8:05 PM |
Tom R. | has entered the room |
Tom R. |
Hi Mark, how are you?
|
Mark M. |
OK, and you?
|
Tom R. |
I'm good
|
Tom R. |
Well, I'll be better when I've got my problem solved
|
Mark M. |
how can I help you?
|
Tom R. |
My question is regarding obtaining root perms
|
Mark M. |
I haven't done that, sorry
|
Tom R. |
Let me give you some background
|
Mark M. |
so, while I can try to help, I may not be of a ton of use
|
Tom R. |
ok, well hopefully you can at least give me in the right direction
|
Tom R. |
My company build a scientific instrument based Android and some custom hardware
|
Mark M. |
so, Android is running on your hardware?
|
Nov 14 | 8:10 PM |
Tom R. |
We are building our own AOSP image and some C++ services using Binder to talk to UI written in Java
|
Tom R. |
One of the apps we have is an updater app that allows the user to choose a file from the sd card which is a zip file that can contain new versions of our app apks, service executables, etc
|
Mark M. |
OK
|
Tom R. |
We have an existing product that is built on API 17 and the updater app gains the ACCESS_SUPERUSER perm, then calls a script that it gets from the zip file using: ProcessBuilder("su", "-c", "sh", updateScriptPath);
|
Tom R. |
The problem comes in trying to make that work on the new version of the device which is based on API 22
|
Nov 14 | 8:15 PM |
Tom R. |
The ACCESS_SUPERUSER perm has been removed in 22
|
Tom R. |
And that same su call fails with Perm denied
|
Tom R. |
The app is a priviliged system app, living in /system/priv-app
|
Tom R. |
it's signed with the platform cert
|
Tom R. |
I'm attempting to use libsuperuser from https://su.chainfire.eu/
|
Tom R. |
I can see the app is running in the u:r:platform_app:s0 secontextg
|
Tom R. |
But it fails to gain su.
|
Tom R. |
I can successfully execute a script that does not require elevated privs, so I'm confident the basic mechanism working
|
Nov 14 | 8:20 PM |
Mark M. |
I can't help you with libsuperuser, or getting root generally
|
Tom R. |
I there a different approach I should be considering?
|
Mark M. |
I would not recommend updating your device this way
|
Mark M. |
I would recommend that you speak with experts in creating Android hardware, such as Karim Yaghmour
|
Mark M. |
Running an arbitrary shell script from removable media with root privileges is a security nightmare
|
Tom R. |
I know
|
Tom R. |
But there's no sensitive content, no PII, etc
|
Mark M. | |
Mark M. |
but, let's assume for the moment that you are stuck with this setup
|
Mark M. |
if it is your firmware and your AOSP build, you are in control of *everything*
|
Tom R. |
yes
|
Mark M. |
AFAIK, libsuperuser is for trying to make minimally-invasive changes to get root
|
Nov 14 | 8:25 PM |
Mark M. |
in your case, you should be able to just make it happen
|
Mark M. |
for example, you control the init scripts
|
Tom R. |
and the selinux policies
|
Mark M. |
so, I would consider having this update process be outside of the Android SDK entirely
|
Mark M. |
to some extent, Android is just a really funny-looking Linux distro
|
Tom R. |
like a script that runs on boot?
|
Mark M. |
I don't know whether that would make sense in your case -- I mentioned init scripts as a level of control you have, more so than it necessarily being part of the solution
|
Tom R. |
the init script looks for the update script in a known location, something like that?
|
Tom R. |
runs it then deletes it?
|
Mark M. |
I can't answer that, as I don't know enough about this overall process
|
Mark M. |
my point is more that since you're not really working with normal Android stuff here anyway, pretend that you're on Ubuntu, and figure out how you would approach it there
|
Mark M. |
then, figure out how to adapt that to Android
|
Mark M. |
and do all of this from normal Linux binaries, not Android SDK apps
|
Mark M. |
Android apps are tied to all these sandboxes, which is why all these root things are needed
|
Mark M. |
you aren't limited to those sandboxes, since it is your firmware
|
Mark M. |
so, I'd be looking more to how custom ROMs grant durable root access to some of their stuff
|
Tom R. |
And when your Mac updates is downloads stuff then reboots, so users should be used to that paradigm
|
Nov 14 | 8:30 PM |
Mark M. |
I cannot say whether that would make sense for your equipment, but it is certainly a possibility
|
Tom R. |
Would a selinux policy be involved in granting durable root access?
|
Mark M. |
I have no idea, sorry
|
Tom R. |
I was looking for some message to that effect in dmesg
|
Tom R. |
but didn't see any
|
Mark M. |
I'm sorry that I could not be of greater assistance
|
Mark M. |
but, that's a wrap for today's chat
|
Tom R. |
ok, well thanks for your help
|
Mark M. |
the next chat is Tuesday, also at 7:30PM US Eastern
|
Mark M. |
the transcript will go up on https://commonsware.com/office-hours/ shortly
|
Mark M. |
have a pleasant day!
|
Tom R. |
you too
|
Tom R. | has left the room |
Mark M. | turned off guest access |