-
Notifications
You must be signed in to change notification settings - Fork 216
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
Don't assume libselinux.so.1 to be present in the target systems #83
Comments
In kdenlive-16.12-alpha1-x86_64, the issue is
loads
Since the latter two are bundled from a CentOS system, they depend on libselinux. But not all users appreciate that: For example, on Manjaro Linux:
Deleting So the question is, can these libraries be rebuilt without the need for libselinux, or could we have some dummy selinux replacement library that does nothing. Of course we could just bundle libselinux inside the AppImage but this is not recommended as it would draw in additional dependencies. Please comment here if you have an idea how to solve this. |
https://fedoraproject.org/wiki/Using_Mock_to_test_package_builds says
Where can we get this? |
@darealshinji can you do a dummy libselinux.so.1 similar to what you did on #127? Thanks :-) |
Try to build this as a shared library: But I'd say if selinux is not available in all distros the AppImage should not include anything depending on it in the first place. The current kdenlive AppImage release is 16.12.2. Maybe it's no longer an issue there? |
It's an issue in the Subsurface AppImage and other ones built on Travis CI and many first-time AppImage users have been complaining (because Subsurface is linked as an example on the AppImage homepage), so a thousand thanks for your hint. :+1 |
What happens if the |
That would also be an option, but adding to the size of the AppImage. |
Well, it's only about 120k uncompressed... |
What is the current state of this problem? i have a Qt application for what I wanted to create an AppImage using linuxdeployqt. I am using a centos7 based docker image to build the application and the AppImage. Unfortunately I ran in the same issue with |
When you compile on Ubuntu, your binaries won't have a dependency on libselinux. Although I am almost sure there must be an easier way to achieve the same without switching the entire build operating system. |
Possibly removing |
Try to figure out with libraries have a dependency on libselinux and install them as non-selinux builds from another repository. That might help. |
@probonopd I wasn't able to remove selinux without breaking the system. As this build system was docker based it wasn't that difficult to move to ubuntu:trusty. LinuxDeployQt works perfectly there and the generated AppImage seems to work on most distributions (have only checked a few myself). Thanks for bringing AppImage and linuxdeployqt to us! |
@crapp glad it is working for you; feel free to add your software to https://github.com/probonopd/AppImageKit/wiki/AppImages. |
Hey, facing this in Archlinux, with an AppImage generated in a local docker, derived from ubuntu:xenial.
I got:
My work in progress Dockerfile is here: https://github.com/phcerdan/FFT-from-image-compute-radial-intensity/blob/master/extra/Docker/xenial_linuxdeployqt/Dockerfile |
What's the problem of bundling a libselinux.so, as @darealshinji suggested? |
@phcerdan Good question. I don't know how much of an security issue it may be or if bundling it works at all (I don't know much about SELinux and what it's actually used for). One option could be: use It makes me actually wonder why libselinux.so.1 isn't dlopen()ed in the first place, if applications can work without it. |
Nothing, apart from it making the AppImage unneccessarily larger. Since we don't want or need its functionality, maybe we could replace it by a dummy library that resolves all of its symbols but just does nothing. |
Added it as an annoyance to the list of Desktop Linux Platform Issues https://github.com/AppImage/AppImageKit/wiki/Desktop-Linux-Platform-Issues#selinux |
The reason why libselinux.so.1 was blacklisted:
So it depends on libpcre.so.3 which was blacklisted, but isn't anymore. I'd say libselinux.so.1 shouldn't be blacklisted anymore. Uncompressed filesize on Ubuntu is less than 200k. |
Hi @probonopd,
How is this unnecessary? Isn't the aim of AppImage to generate binaries for all distros? For 200k increase, solving this issue sounds worthy, IMHO. Not working on Arch and derivatives distros at the moment. I will try the workaround. Thanks. |
Hey this workaround works in Arch: create a fake library from this
And compile it in the folder Then execute your AppImage with:
|
For bundling the fake libselinux.so in docker, so Arch users can run it without any workaround:
Where |
That's awesome indeed. Maybe we could make
This was made by
You have just delivered the proof that it is unneccessary to ship the full library, haven't you? Now, could the mock be made a bit more clever, and "route through" (e.g., using |
That's great!
Well, yes, but if bundling a small library solves all these workarounds... . What's the matter with 200k? Maybe it doesn't work at all to bundle the library, and this fake is a good solution, with selinux enabled or disabled.
Good point indeed, does it do something? selinux archwiki. I have no idea about selinux, how secure is it to execute a binary from a 3rd party for selinux to matter though? |
The question is, will an AppImage that contains the mock library run on a system that has SELinux in "enforcing" mode at all. |
I have no way to access such a SElinux system, but I would love to find out. |
The easiest way to find out would probably be to run a Fedora Live ISO. According to https://fedoraproject.org/wiki/FedoraLiveCD, it
(It is the first thing I always disable when running Fedora...) |
Cool, will test it in a VM. |
This is completely idiotic. Both major LSMs (AppArmor and SELinux) have userspace libraries that applications link into. If your library chain includes As far as I know, the only dependency of both libraries is libpcre and glibc. |
Sorry for being ignorant here, but in order for the security to work, AppArmor and SELinux require the "suspect" application to "cooperate" by linking to these libraries? Don't think this provides any real security then, since the AppImage could ship some random fake "AppArmor" or "SELinux" library. If that is true, then the best advice would be to disable AppArmor and SELinux when building, and if this is not possible (e.g., because the source code is not available), then ship a dummy library. I might be wrong though. If so, please correct me. |
@probonopd The AppArmor and SELinux libraries are basically programmer's interfaces to kernel ioctls and common utils functions. They don't do much and the real meat is still in the kernel itself. That's why the soversion of the libraries hasn't changed in almost a decade. |
Which means that the security of AppArmor and SELinux works regardless of wheter the application links the corresponding libraries, do I understand you right @Conan-Kudo? |
@probonopd Yep. Lots of things are confined without userspace level integration. The userspace integration just lets the library/app itself do cool things and be smarter. |
And how to get it working on distros without those libs? |
Just bundle the libraries and leave it be. They don't hurt anything. |
Yes, please! Otherwise AppImages are likely to not run on distros like Arch. --- a/excludelist
+++ b/excludelist
@@ -79,16 +79,6 @@
# Workaround for:
# Application stalls when loading fonts during application launch; e.g., KiCad on ubuntu-mate
-libselinux.so.1
-# Workaround for:
-# sed: error while loading shared libraries: libpcre.so.3: cannot open shared object file: No such file or directory
-# Some distributions, such as Arch Linux, do not come with libselinux.so.1 by default.
-# The solution is to bundle a dummy mock library:
-# echo "extern int is_selinux_enabled(void){return 0;}" >> selinux-mock.c
-# gcc -s -shared -o libselinux.so.1 -Wl,-soname,libselinux.so.1 selinux-mock.c
-# strip libselinux.so.1
-# More information: https://github.com/AppImage/AppImages/issues/83
-
# The following are assumed to be part of the base system
# Removing these has worked e.g., for Krita. Feel free to report if
# you think that some of these should go into AppImages and why. |
@darealshinji with this workaround, they will work |
The problem is that "not by default" doesn't mean it might not be there and useful. The Arch/Gentoo Hardened projects offers SELinux enablement. Debian and SUSE both offers SELinux and AppArmor support and policies. Red Hat/Fedora, of course, offers SELinux and Ubuntu offers AppArmor. The dummy libraries means that applications can't detect when such things are active and automatically use them properly, which defeats the point of making applications that can secure themselves. |
This "workaround" is obsolete, since libpcre.so.3 is now bundled by default, as not all distros provide it themselves. Therefor there's no point IMO to exclude libselinux. |
Please bundle the proper |
Can you explain to me what that library does for your application @phcerdan? |
@probonopd it is beyond the scope of my application. It is a dependency imposed by bundling my app in a SElinux system. But in short, it allows my application to run on all linux distros. It does nothing in systems without SELinux, as people that know way more than I have stated in this conversation but allow people in SELinux systems to use their SELinux policy with the app. I think is super important to worry about privacy, and NSA, as you do, but |
Again the question, do you think your application will run less secure when this library is replaced with a stub? My point is, we don't even know what it does... |
Some people do know and choose to use it. I think it is beyond the scope of And we should define secure, I guess you can package a super vital app with appimage and then use SELinux to enforce a policy for its usage, or whatever it does. |
Please bundle it by default. AppImage distributors should decide whether they want to replace any of their libs with stubs or not. libselinux.so.1 is not available on all distros, small and portable between distros (unlike i.e. glibc). So there's no point to exclude it by default. |
I agree with that. But for the AppImages that I make, I don't want to include NSA-originated software that I do not understand and that has no apparent use to me. This is not to say that AppImages that others make should necessarily follow the same logic. |
That's fine. But in this case I think you should still remove |
True! Doing it now. |
While there are often zero open source alternatives available for some device classes like hard drives and motherboards, is wonderful support for graphics available by AMD and Intel provides at least a bare minimum, which is enough for most users. 😃 |
Thanks for solved the problem of install seafile😃 |
Based on discussion here: AppImageCommunity/pkg2appimage#83 and a report of failure to run on gentoo: https://github.com/denix0/gentoo/commit/ 34193ecece9f94c9ba3f337756ff5be4e3c36d1a#comments
qutebrowser/qutebrowser#1912 (comment)
The text was updated successfully, but these errors were encountered: