mirror of
https://github.com/flatpak/flatpak.git
synced 2026-04-03 14:56:47 -04:00
Historycally the system helper has been running in a generic
unconfined_service_t domain. However, this caused problems with the
new revokefs support, because passing the revokefs unix domain socket
over the system bus got it kicked of the bus, because to do this
dbus-daemon needs rw rights to the socket.
So, this module creates a custom domain flatpak_helper_t, which
allows us to add special permissions to dbus-daemon to allow
access to its sockets.
The domain is otherwise uncontained just like before. I did try
to make it contained, but that is a lot of work as the permissions
it needs are very complex.
Note to packagers on selinux systems, for flatpak to work well
you need to install this module and relabel the system-helper
binary.
In my testing on fedora I used something like this:
%post
%selinux_modules_install %{_datadir}/selinux/packages/flatpak.pp.bz2
%postun
if [ $1 -eq 0 ]; then
%selinux_modules_uninstall %{_datadir}/selinux/packages/flatpak.pp.bz2
fi
With these new files:
%{_datadir}/selinux/packages/flatpak.pp.bz2
%{_datadir}/selinux/devel/include/contrib/flatpak.if
Closes: #2657
Approved by: alexlarsson
28 lines
859 B
Plaintext
28 lines
859 B
Plaintext
policy_module(flatpak, 0.0.1)
|
|
|
|
# The flatpak-system helper used to be a regular unconfined_service_t
|
|
# but this failed because it was not allowed to pass a unix socket fd
|
|
# over dbus-daemon. This module fixes that by creating an unconfined
|
|
# domain with some additional dbus permissions.
|
|
|
|
# I did try to make the domain confined, but it needs a lot of
|
|
# permissions and my selinux-foo just isn't good enough.
|
|
|
|
type flatpak_helper_t;
|
|
type flatpak_helper_exec_t;
|
|
init_daemon_domain(flatpak_helper_t, flatpak_helper_exec_t)
|
|
|
|
unconfined_domain(flatpak_helper_t)
|
|
|
|
optional_policy(`
|
|
dbus_stub()
|
|
dbus_system_domain(flatpak_helper_t, flatpak_helper_exec_t)
|
|
|
|
# Allow passing the revokefs socket over dbus
|
|
allow system_dbusd_t flatpak_helper_t:unix_stream_socket rw_stream_socket_perms;
|
|
')
|
|
|
|
optional_policy(`
|
|
policykit_dbus_chat(flatpak_helper_t)
|
|
')
|