I propose workarounds for restrictions built in the "run-as" utility#994
I propose workarounds for restrictions built in the "run-as" utility#994ChrysoliteAzalea wants to merge 1 commit into
Conversation
f3595e6 to
5845da9
Compare
|
Ok, I will abstain from switching profiles into If that PR will get merged before this, I'll make changes here accordingly. |
|
Well, I've run into something interesting in the way |
|
I've looked how |
|
Closing this PR in favor of patching the |
Hello everyone!
Recently, I was researching the
run-asutility pre-installed in the Android. It allows to run an arbitrary command in the context of an arbitrary package (kind of likesudo, but with apps instead of users). However, it has restrictions which seriously limit it usefulness -- the one I have the problem with, is that it does not accept packages which are not marked as debuggable. In this pull request, I solve this problem by tampering with the Android package list and marking the requested package as debuggable. This is done in a manner similar to thewaydroid shellcommand, however, instead of running an arbitrary command, it will executesedwith a custom script that lists the given package as debuggable. After that,run-asaccepts this package name.Problems I've run into while making this PR
shmay fail due to lack of controlling tty -- one of the possible solutions that worked for me was described in Issues opening waydroid shell #145run-asstill conforms to other restrictions, for example, it will refuse to accept some system applicationslibpackagelistparser(and torun-as). Unlike true debuggability, this one is not preserved across reboot or package installations and uninstallations -- the user may have to run this command again after container reboots or any changes to the package list.run-asis unaware of AppArmor and will not switch to the necessary profile. All commands run withrun-aswill run underlxc-waydroidprofile, andrun-asis not able to run withandroid_appprofile.In this pull request, I solve this by AppArmor policy amendment that introduces the fourth profile,(see below)run-as, designed specifically for this utility, in whichexecveon all binaries leads to transition to theandroid_appprofile (it's just a modified copy of thelxc-waydroidprofile