-
Notifications
You must be signed in to change notification settings - Fork 88
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
Creating a Flatpak for Linux #1053
Comments
Sorry for the ignorance, is something that respects what has been requested in #771 ?
Let me get this straight, how can users verify the source of the package? the file is not signed in any way.
allow me time to read up on it.
currently for android is org.cromite.cromite, it would be better to use the same. |
This would, indeed, solve the issue of Auto update on Linux #771 which suggested using a script for it (and also #890 & #621).
The Flatpak would be hosted on Flathub.org and the manifest would be public. Here is what the Flatpak manifest looks like so far : app-id: org.cromite.cromite
runtime: org.freedesktop.Platform
runtime-version: '23.08'
sdk: org.freedesktop.Sdk
base: org.chromium.Chromium.BaseApp
base-version: '23.08'
command: cromite
separate-locales: false
finish-args:
- --allow=multiarch
- --device=all
- --env=GTK_PATH=/app/lib/gtkmodules
- --env=XCURSOR_PATH=/run/host/user-share/icons:/run/host/share/icons
- --share=ipc
- --share=network
- --socket=cups
- --socket=pcsc # FIDO2
- --socket=pulseaudio
- --socket=x11
- --socket=wayland
- --require-version=1.8.2
- --system-talk-name=org.freedesktop.UPower
- --talk-name=org.freedesktop.FileManager1
- --talk-name=org.freedesktop.Notifications
- --talk-name=org.freedesktop.ScreenSaver
- --talk-name=org.freedesktop.secrets
- --talk-name=org.kde.kwalletd5
- --talk-name=org.kde.kwalletd6
- --talk-name=org.gnome.SessionManager
- --talk-name=org.gnome.Mutter.IdleMonitor.*
- --system-talk-name=org.freedesktop.Avahi
- --own-name=org.mpris.MediaPlayer2.chromium.*
- --filesystem=xdg-run/pipewire-0
# To load policies on the host /etc/chromium/policies
- --filesystem=host-etc
# To install a PWA application
- --filesystem=home/.local/share/applications:create
- --filesystem=home/.local/share/icons:create
- --filesystem=xdg-desktop
# For default download directory to work as expected
- --filesystem=xdg-download
# For GNOME proxy resolution
- --filesystem=xdg-run/dconf
- --filesystem=~/.config/dconf:ro
- --talk-name=ca.desrt.dconf
- --env=DCONF_USER_CONFIG_DIR=.config/dconf
- --env=GIO_EXTRA_MODULES=/app/lib/gio/modules
- --env=GSETTINGS_BACKEND=dconf
# For KDE proxy resolution (KDE5 only)
- --filesystem=~/.config/kioslaverc
- --filesystem=/run/.heim_org.h5l.kcm-socket
- --persist=.pki
modules:
- name: zypak
sources:
- type: git
url: https://github.com/refi64/zypak
tag: v2024.01.17
commit: ded79a2f8a509adc21834b95a9892073d4a91fdc
x-checker-data:
type: git
tag-pattern: ^v([\d.]+)$
- name: cromite
buildsystem: simple
build-commands:
- mkdir -p /app
- bsdtar -xf cromite.tar.gz -C /app
- mv /app/chrome-lin /app/cromite
- mv /app/cromite/chrome /app/cromite/cromite
- install -Dm 644 LICENSE /app/cromite/LICENSE
- install -Dm 644 cromite.desktop /app/share/applications/org.cromite.cromite.desktop
- install -Dm 644 cromite.svg /app/share/icons/hicolor/scalable/apps/org.cromite.cromite.svg
- install -Dm 755 cromite.sh /app/bin/cromite
- install -Dm 644 -t /app/etc cobalt.ini
- install -Dm 644 -t /app/share/metainfo org.cromite.cromite.metainfo.xml
sources:
- type: file
url: https://github.com/uazo/cromite/releases/download/v124.0.6367.91-16f4295a45228d50667be3dc7463efde9f3002f6/chrome-lin64.tar.gz
sha256: 01d253e2cd3380a4116eb6adebb127dcf12ba670599a9192f77f7996736fe3c2
dest-filename: cromite.tar.gz
only-arches: [x86_64]
- type: file
path: cobalt.ini
- type: file
path: org.cromite.cromite.metainfo.xml
- type: file
path: LICENSE
- type: file
path: cromite.svg
- type: file
path: cromite.desktop
- type: file
path: cromite.sh
No problem. Basically, when you call Ninja, you can add the build target: ninja -C out/lin64 chrome chrome_sandbox It usually take a few seconds to build, but I don't know how much compute time it represents on Github. Perfect!
Indeed. |
thank you for your answers.
So I should create a login, and then what? Can you give me any other pointers?
How would I update this information? |
I have uploaded all the files to Github. To publish it on Flathub, they have a short section on their documentation for it: How to submit an app. You might want to edit the "org.cromite.cromite.metainfo.xml" to change the description and/or add screenshots.
The URL for the file is "https://github.com/uazo/cromite/releases/download/" + [Your Github Release Tag] + "/chrome-lin64.tar.gz" The sha256 is the checksum of the "chrome-lin64.tar.gz" that you create during Cromite's build. sha256sum chrome-lin64.tar.gz |
thank you very much for your suggestions. |
FYI, I added a readme with basic instructions to test the Flatpak. |
any news here? |
Can you make it all corners rounded to make it better looking in gtk4 desktop like gnome. |
@syhlx as far as chrome-sandbox is concerned, I understand from https://issues.chromium.org/issues/40338793 that it is no longer necessary. |
um. i was looking at your repo. i guess it is too complex for me, i am not able to assess what all those permissions in https://github.com/syhlx/cromite-flatpak/blob/main/org.cromite.cromite.yaml mean. but that seems to me to be the minimum necessary, correct? another thing, in https://github.com/syhlx/cromite-flatpak/blob/main/cromite.sh you use the file /etc/chromium/policies, why?
if it can be done. again:
can be removed, as the PWA are not supported.
ah maybe I understand, is it to make zypak work? and why is zypak needed, otherwise the flatpack sandbox won't work? Sorry to bother you, but I am ignorant on the subject. |
When running Chromium directly on the system as normal application, the chrome-sandbox binary is, indeed, not used anymore. Chromium now uses the Linux kernel's unprivileged user namespaces. However, since Flatpak sandboxes everything, Chromium will generate the following error if run without SUID, as Flatpak will not allow it to use unprivileged user namespaces:
Here is a little more details about each permission: Details
# Allow non x86_64 binaries to run (eg. an extension was meant for 32-bits systems)
# Not strictly required and we should probably not include it by default as extensions should not use binaries anyway...
- --allow=multiarch
# Allow access to all devices (GPU, webcam, input devices...)
- --device=all
# I forgot to remove this environment variable... I'll remove it in my repo
- --env=GTK_PATH=/app/lib/gtkmodules
# Environment variable to point to mouse cursor icons (in case the user uses a custom mouse cursor theme)
- --env=XCURSOR_PATH=/run/host/user-share/icons:/run/host/share/icons
# Inter-process communication to allow Cromite to send/receive communication to/from other processes
- --share=ipc
# Access the network
- --share=network
# Access to printers
- --socket=cups
# Access to smartcards, YubiKeys...
- --socket=pcsc # FIDO2
# Access to the sound system
- --socket=pulseaudio
# Use Linux's old graphical server
- --socket=x11
# Use Linux's new graphical server
- --socket=wayland
# Require Flatpak version >1.8.2 (Older versions will not work properly)
- --require-version=1.8.2
# Access to power information (Battery level, power connected). Also includes the power level of gaming controllers and other accessories
- --system-talk-name=org.freedesktop.UPower
# Open file picker to open a file (eg. uploads)
# This allows users to select a file outside of the allowed paths for Cromite
- --talk-name=org.freedesktop.FileManager1
# Allows users to receive notifications from Cromite
- --talk-name=org.freedesktop.Notifications
# Allows Cromite to inhibit/prevent the screensaver (eg. when playing a video)
- --talk-name=org.freedesktop.ScreenSaver
# Allows Cromite to store passwords and keys into a compatible "keyring" / "wallet"
- --talk-name=org.freedesktop.secrets
# KDE (desktop environment) has a seperate service to access KDE Wallet for each version
- --talk-name=org.kde.kwalletd5
- --talk-name=org.kde.kwalletd6
# Interface with Gnome (desktop environment)
- --talk-name=org.gnome.SessionManager
# Tell Gnome's window manager if Cromite is idle (eg. to prevent screensaver while watching a video)
- --talk-name=org.gnome.Mutter.IdleMonitor.*
# To access multicast DNS and ZeroConf devices on the network (media centers, NAS, printer UIs...)
- --system-talk-name=org.freedesktop.Avahi
# Allow Cromite to tell the rest of the system what media content it is currently playing (Name of a video, music artist...)
# Also allows Cromite to receive Play/Pause, Next, Previous requests while playing media content
- --own-name=org.mpris.MediaPlayer2.chromium.*
# Access to the new sound server. Also allows screen sharing (eg. for webmeetings)
- --filesystem=xdg-run/pipewire-0
# Access to system policies for Chromium-based browsers
# Either set by an organisation for their employees or by a user to enforce certain features / settings in Cromite
- --filesystem=host-etc
# To install a PWA application -> Since it is not supported in Cromite, no point in keeping it
- --filesystem=home/.local/share/applications:create
- --filesystem=home/.local/share/icons:create
- --filesystem=xdg-desktop
# For default download directory to work as expected
- --filesystem=xdg-download
# Detect what proxy settings are set in Gnome
- --filesystem=xdg-run/dconf
- --filesystem=~/.config/dconf:ro
- --talk-name=ca.desrt.dconf
# Detect what proxy settings are set in KDE 5
- --filesystem=~/.config/kioslaverc
- --filesystem=/run/.heim_org.h5l.kcm-socket
# Fixes this: https://github.com/flathub/com.github.Eloston.UngoogledChromium/issues/34
- --persist=.pki Users can also control these permissions as they see fit using either Flatpak's CLI or a GUI tool like Flatseal:
The /etc inside of the Flatpak sandbox is not the system's /etc. The bash script is a very inelegant way to copy the host's policies inside of the Flatpak sandbox's /etc where Cromite is going to look for the files. I'll see if I can find a cleaner way to do this.
Not point in keeping it, then. I'll remove it.
It is indeed for Zypak. Zypak acts as a middleman between chrome-sandbox and Flatpak for the sandboxing in order to make sure that every process is properly opened the "Flatpak way" while keeping Cromite's sandbox running properly.
No worries. I'm here to help! |
perfect!
as before, unsupported, you can delete it.
OK, that's clear. but where is the sudo chown of chrome-sandbox launched? or the launching of Zypak?
I realise this, but it should not be by default.
technically I don't like it, Having another implementation made not by the chromium team on a component as sensitive as the sandbox does not inspire me with confidence. searching I found https://github.com/flathub/org.chromium.Chromium/blob/master/patches/chromium/flatpak-Add-initial-sandbox-support.patch but I don't know exactly what it is. I guess the sandbox problem is a big one: what tells me that flatpak's sandbox is better than chromium's? |
OK. I'll remove it.
In the manifest, when building the Flatpak the Zypak is launched by the bash script: exec cobalt "$@" --no-default-browser-check
Sadly, Flatpak does not allow partial access to However, we could simply remove the permission to
Me neither. But since Zypak is widely used for Chromium-based applications on Flatpak. It seemed like the way to go. I would definitely prefer not having it at all. One less security vulnerability to worry about...
It seems to allow Chromium to directly support Flatpak's sandbox in addition to kernel unprivileged user namespaces and SUID. Might be a good option to get rid of Zypak.
Flatpak's sandbox would be in addition to Chromium's. Chromium's sandbox prevents webpages from accessing things they shouldn't. It is an additional security layer, not a replacement of Chromium's. The main advantage for users would be to prevent rogue web extensions from accessing things they shouldn't, like the user's private files. |
It seems that ungoogled-chromium took the same approach: https://github.com/flathub/io.github.ungoogled_software.ungoogled_chromium/blob/master/patches/chromium/flatpak-Add-initial-sandbox-support.patch |
Flatpak uses exactly the same kernel backends as Chromium for its own sandbox: unprivileged user namespaces and SUID. https://github.com/flatpak/flatpak/wiki/User-namespace-requirements |
in fact, it seems like the best choice. i'm trying to figure out what exactly that patch does. |
then, I saw how it works, technically it makes it possible to spawn processes via dbus to the flatpak interface.
|
which is equivalent to saying that flatpak's sandbox is better than chromium's, since chromium already protects indiscriminate access to resources. which may well be true, I have no basis for saying.
What I question is that it may not be an additional layer, but something that limits the one already present. |
Excited to see this on flathub. Looking forward to it. Well done to everyone helping. Unfortunately I'm not skilled to help. But you have my emotional support. you can do it! ✊ |
I make available here https://github.com/uazo/cromite/releases/tag/flatpak-sandbox-patch the release I haven't tested it because I don't know how. |
of course you can. |
@userforsource
Or we can publish something clean. I understand that you are eager to get the Flatpak, but Cromite is focused on security and privacy. I don't think that publishing something half-baked would be the right idea, even as a beta. In the meantime, if you want to test out the Flatpak and give feedback, you can:
I'll test it out and also make the necessary changes to the test repo to accommodate the patched version. |
I can also confirm that everything seems to work as it should. I updated the test repo to work with the new patched version. |
The question of Flatpak is now resolved. Flatpak poses too many security concerns to be used.
I opened a new issue dedicated to this new discussion of packaging for Linux. |
it must be considered whether to insert a warning message |
Releasing Cromite as a Flatpak with a warning message could be a middle ground to allow users to choose for themselves if they are OK with the risks involved. Where would you put the warning, though? On the Flathub/Github page or directly in Cromite? |
As a common user reading this discussion lefts questions about security issues flatpak introduces. It would be good to describe them on github readme, so users could choose the distribution themselves. As a Silverblue user Flatpak is preferred and it also has benefits too, easy to install and manage/update browser and data. |
directly into cromite, if it detects the flatpak sandbox.
@iamgitcat you are welcome, go ahead and make a pull |
Hey I want to add some comments here @valtoree your quotes are not really useful. Brave does not refer to security. They just say "the experience is worse". This may be due to missing drag&drop or "native messaging" needed for some extensions. These are portals being worked on, and will be fixed in the future. Vivaldi referred to security implications, but they may not be on the latest point of information. Secureblue is a very opinionated project, and security is a complicated, not black-white topic. Flatpak Chromium may very well be more secure than non-flatpak Chromium.
in short: This is simply "chromiums filesystem sandbox" vs. "bubblewrap filesystem sandbox", additionally to the point that Flatpak Chromium IS sandboxed, while native Chromium is not. I hope you reconsider your choice. But it is really not transparent, which is why these discussions need to exist. Btw Flatpak Firefox just relies on |
This is all good theory, but @uazo seems to have empirical evidence to the contrary. Flatpak does not merely add a security layer on top Chromium because Chromium does not work out of the box with Flatpak. The Chromium flatpak significantly modifies the Chromium sandbox to adapt it to Flatpak's confinement model. |
#1053 (comment) I fully agree |
Hello, Chromium Flatpak maintainer here. I think there are a few points in this issue that aren't quite accurate:
I don't understand what this is testing? First of all, Now, I also don't understand your test results. In there, I see that the Flatpak Chromium's /proc/PID is owned by root, which would imply that The purpose of this is to block the ability to use ptrace, but Flatpak already disables the use of ptrace anyway, so the utility isn't really high.
This check is flawed. Flatpaks run inside of an isolated rootfs, but that rootfs is mounted on top of the existing rootfs. If you actually nsenter /
See the above. Two more things I'd like to add:
|
do you have any way of telling me how to test it in the field?
so you are telling me that different (render) processes do not share the same folder and that that folder is not the same as the browser process? |
Hi, I am just a lurker watching this. Since I actually do know how to test this I figured I would create an account and answer. Chromium actually uses ptrace for creating crashdumps. Because Chromium under flatpak does not have access to ptrace, it cannot create crashdump files. So this actually provides a way you can confirm that ptrace is not available to Chromium. If you launch org.chromium.Chromium from flathub and load
However, if you launch org.chromium.Chromium again with
|
and concerning the same process? is allowed to ptrace itself? |
I don't think so. I thought of another way to test this.
|
Ok, I realised that I was not testing a process ptracing itself. And in fact I am not sure how to easily test that because the
Cool, error message from strace though. 🙂 Ultimately I think someone who knows flatpak better than me would have to answer but my understanding is that ptrace is not possible at all in a flatpak environment by default, outside of enabling devel (edit, @Erick555 beat me to it and confirms below). |
whole ptrace syscall is blocked by default |
This isn't necessarily good thing for chromium as crash reports are useful. For this reason mozilla does enable ptrace for firefox flatpak. |
Something you can answer @refi64? Or any thoughts at least? How does this compare with say the SUID sandbox? Do you know? |
btw just noticed, even though the package name is already changed, the correct github name would be io.github.author.project according to the docs |
I'm building a Flatpak to make it easier to distribute and update Cromite across all Linux distributions.
Everything is about ready and seems to work fine. I just need a few things:
The text was updated successfully, but these errors were encountered: