Commit Graph

13 Commits

Author SHA1 Message Date
David King
87c9fccdb2 selinux: Install to previous location
Install flatpak.if to the same location for Autotools and meson.
2022-12-14 20:00:48 +00:00
David King
13c5326122 selinux: Install when using meson
With custom_target, providing build_by_default is not enough to install
the output, which must be explicitly requested.
2022-12-14 20:00:48 +00:00
Simon McVittie
9eb824f863 Add a Meson build system
Resolves: https://github.com/flatpak/flatpak/issues/2241
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-10-24 16:12:14 +01:00
Debarshi Ray
0329f657ee selinux: Permit read access to symbolic links in /var/lib/flatpak
Commit 8617ab0ad0 granted read and lock access to
/var/lib/flatpak but didn't cover symbolic links.  This explicitly
permits that to avoid running into SELinux denials.

https://bugzilla.redhat.com/show_bug.cgi?id=2071215
2022-07-20 20:43:54 -05:00
Debarshi Ray
4965e5d076 selinux: Permit using systemd-userdbd
The systemd-userdbd service was added in systemd 245, which was
released in March 2020 and is available in RHEL 9.  Therefore, it's
safe to assume that the systemd_userdbd_stream_connect() SELinux
interface is also available on all relevant operating systems, unless
there's reason to believe otherwise.

https://bugzilla.redhat.com/show_bug.cgi?id=2071217
2022-06-03 10:56:12 +02:00
Simon McVittie
2bfd373d6d selinux: Factor out build steps into a script
This will make them easier to share between Autotools and Meson.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-03 13:54:23 +02:00
Debarshi Ray
8617ab0ad0 selinux: Permit read access to /var/lib/flatpak
It's clearly quite important to have read access to /var/lib/flatpak
and it's contents.  This explicitly permits that to avoid running
into SELinux denials.

https://bugzilla.redhat.com/show_bug.cgi?id=2070741
2022-04-23 16:13:00 +01:00
Debarshi Ray
f8a9153d0e selinux: Let the system helper watch files inside $libexecdir
The system-helper (ie., the `flatpak-system-helper` process) is
labelled with flatpak_helper_exec_t and runs in the flatpak_helper_t
domain, and tries to set up an inotify(7) watch on it's own binary so
that it can exit when the binary is replaced.  This explicitly permits
it to do so to avoid running into SELinux denials.

The corecmd_watch_bin_dirs SELinux interface is a recent addition [1],
and is therefore used conditionally when defined.

[1] https://github.com/fedora-selinux/selinux-policy/commit/88072fd293
    https://github.com/fedora-selinux/selinux-policy/pull/1133

https://bugzilla.redhat.com/show_bug.cgi?id=2053634
2022-04-23 16:13:00 +01:00
Debarshi Ray
002e4455d8 selinux: Let the system helper have read access to /etc/passwd
The system-helper (ie., the `flatpak-system-helper` process) is
labelled with flatpak_helper_exec_t and runs in the flatpak_helper_t
domain, and needs to be able to read /etc/passwd.  This explicitly
permits it to do so to avoid running into SELinux denials.

https://bugzilla.redhat.com/show_bug.cgi?id=2070350
2022-04-21 20:57:52 +01:00
Nikola Knazekova
669a5bf671 Add unconfined_domain(flatpak_helper_t) to optional_policy block
Fixed bug where disabling unconfined module fails because macro unconfined_domain(flatpak_helper_t) wasn't in optional_policy block
2020-06-05 16:27:39 +02:00
Heiko Becker
1678d0cb9f Avoid installing empty dirs with --disable-selinux-module
...by moving everything selinux specific into the scope of the
if.
2019-08-16 12:53:52 +02:00
Alexander Larsson
a5eebf73d2 distclean the selinux module 2019-04-12 13:18:15 +02:00
Alexander Larsson
bb46c1dbd6 Add selinux module to allow system-helper to work with revokefs
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
2019-04-09 09:18:15 +00:00