-
-
Notifications
You must be signed in to change notification settings - Fork 567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Investigate bubblewrap for sandboxing #152
Comments
works for me too! 2016-06-03 17:28 GMT+02:00 probonopd notifications@github.com:
|
Let's see if three years later we can get this to work without needing root rights for mounting the AppImage.
Now, does Firejail also have the same fine-grained, easy controls to run applications e.g., without network access, with their own temporary r/w filesystem that gets discarded when the application quits, etc.? What woud be the upsides and downsides of using it vs. Bubblewrap? |
The Firejail easily gets around all of this because it is run as setuid root. |
Why do you need to mount anything as loop device? You can mount your AppImage via FUSE, can't you? |
Not when using Bubblewrap. Or so I believe (so far). But before I continue spending time with Bubblewrap I'd actually like to know its pros and cons vs. Firejail, which has the big plus of active AppImage support. |
IMO, I have nothing against FireJail, but I can think of at least 2 major advantages of bubblewrap right off the bat:
Along with FireJail not appearing to run AppImages correctly, even with the '--appimage' option, it failed to work with every Electron app I've tested, doesn't work with the RuneLite AppImage, and the LibreWolf AppImage is unable to utilize the Firefox profile, but that one may be a combination of issues. Regardless, it was frustrating enough to make me, who is pretty persistent about this kind of stuff, completely give up on using it with AppImages. However, I was able to get bubblewrap working with AppImages mounted via FUSE with a (pretty hacky) script that just utilizes the AppImage runtime. It's my personal script that I've been (mostly successful) running my AppImages, but hopefully other people who had the same issues will find it of use. I've been considering making some sort of modified version of the runtime that doesn't require ^C to unmount, but I don't know C worth jack :/ also even that seems like a patch job. I had tried using squashfuse which I feel like would be the best option, but it doesn't appear to have an offset option, so I was unable to mount the AppImages.
I have tested this script on Manjaro and PopOS, but I'm not at all sure what else it'll work on. PS: If bubblewrap says it fails to find "source path /tmp/.appimage_sb./.mount_", try extending the sleep time under "# Give the runtime time to mount the AppImage" |
Thanks @mgord9518 |
Possibly of interest:
A developer of Alpine Linux says:
https://gitlab.alpinelinux.org/alpine/aports/-/issues/12643 I don't want to judge the security record of anything, but I can follow the logic that SUID should be avoided if similar/the same effects can be achieved without needing it. |
I would really weight the advantages of using bubblejail vs bubblewrap. bubblejail is just some python scripts which add a python dep. Personally, as I am making an appimage installer and wanting to have as minimal deps as possible a python dep is too much compared to just having bubblewrap's binary be dropped in and calling that directly. Just my 2 cents. |
No worries, the user decides whether to use a sandbox and which one. AppImage does not require one. I will not be doing work in this area. |
How do you feel about having a standardized way for AppImages to request permissions from a sandboxing program? (in the form of a wrapper from an optional launcher/daemon). At least directories and files would be super easy to implement for any sandboxes, the more fidgety settings like which devices to restrict will be trickier. Regardless, just sandboxing files is a lot better than not sandboxing at all. Example (web browser?):
|
So what I'm getting out of this is... everyone is on the same page here, it just currently hasn't been implemented yet? I can start working on a basic tool to read minimal permissions and expand from there to make it more secure. |
I'm happy with the idea as long as sandboxing is opt-in, and as long as the requested permissions are conceptually abstract enough so that they can work with different underlying sandboxes.
First step would be to brainstorm about the different permissions. Maybe it would be useful to look into the XDG Portals as well. (I know nothing about them, really.) But the whole sandboxing thing should stay purely optional, and normal users should not be bothered with it unless the user explicitly wants it. |
Well, whether it's suid or userns, it always depends on the implementation whether something is secure. There have been exploits in userns as well. The main security issue with firejail is that it has had such bugs way too often in the past. And a kernel-provided solution is always preferred, mostly because the chance that experts have reviewed a feature thoroughly is way higher than with a third-party provided solution. At the moment, I consider implementing a standalone system that utilizes bubblewrap/bubblejail as a sandboxing solution, as user namespaces are being adopted by more and more distros, and it's in widespread use in other projects as well. I have no experience with them, but bubblejail looks like a good solution, as it's profile-based and these profiles can hopefully be generated by a nice user-friendly UI that asks for permissions. It should be clear that such a tool has a dependency on bubblewrap, and I'm not sure whether it'd be a good idea to bundle such a tool for deployment. With AppImageLauncher, I can just add a dependency on the system packages. The Lite version would have to check for a system-wide installed version. I would of course bundle this system with my own AppImageLauncher packages, but in a way so it's optional (always good for distro packaging). The UI I have in mind should be relatively simple: A set of four or five checkboxes or sliders with simple questions, like, "grant Internet access", "grant access to home directory", etc. I don't think making it more fine grained is a plus in terms of security, as users shouldn't be confused and shouldn't be annoyed too much so they just enable everything. I do want to add some feature to have AppImages suggest/request permissions, like in Android. The UI can warn the user that deactivating one of these permissions can lead to the app not working normally. One thing should be clear: sandboxing is only a "last defence" against attacks. Obviously, it can't replace the need to run untrusted applications in VMs or, better, not run them at all. @mgord9518 I suggest you join our IRC channel. See https://docs.appimage.org/contact.html#irc for more information. |
is there any update on this? Where you able to isolate appimages in a userns sandbox? tbh making it work with fuse sounds so complicated, that even unpacking and repackaging them as flatpak sounds more reasonable. (which have nearly complete GUI support around them, and vast adaption) |
Personally I am not very interested in sandboxing, so I leave this exercise to others. FUSE is the only hard dependency of AppImage, so if bubblewrap is really "so complicated" to get to work with FUSE (I don't know), then it is probably not useful for running AppImages. |
It isn't complicated. aisap has used bubblewrap with fuse for about 2 years now, you just have to manually mount it then sandbox it. The hard part is user-friendly profiles |
Closing here, since no further action is planned regarding bubblewrap. Thanks everyone for sharing information! |
@probonopd see here
somehow the app starts with limitations |
We added a easy(ish) to use appimage sandboxing in AM that uses aisap: https://github.com/ivan-hc/AM/releases/tag/6.12.1 |
Cool. So there is now a way to sandbox AppImages through bwrap for those who need it; hence closing this ticket. Thanks everyone! |
https://github.com/projectatomic/bubblewrap
To run an AppImage in a read-only sandbox so that it can only write to
$HOME/.config/leafpad/
and$HOME/leafpad/
:Works for me :-)
The text was updated successfully, but these errors were encountered: