Replace the best-effort semodule/setfiles workarounds with a build-time check that fails fast if flatpak-system-helper is not labeled flatpak_helper_exec_t. Also reinstall flatpak-selinux to ensure the policy is present.
This commit is contained in:
1 parent
d44912b967
commit
1174a84b28
1 file changed
+7
-20
+7
-20
@@ -57,11 +57,17 @@ RUN dnf install -y --refresh --setopt=tsflags=nodocs \
|
|||||||
gstreamer1-plugins-base \
|
gstreamer1-plugins-base \
|
||||||
gstreamer1-vaapi \
|
gstreamer1-vaapi \
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
flatpak \
|
|
||||||
&& (dnf remove -y alacritty waybar gnome-software gnome-software-rpm-ostree gnome-system-monitor showtime decibels snapshot PackageKit PackageKit-gstreamer-plugin PackageKit-command-not-found toolbox || true) \
|
&& (dnf remove -y alacritty waybar gnome-software gnome-software-rpm-ostree gnome-system-monitor showtime decibels snapshot PackageKit PackageKit-gstreamer-plugin PackageKit-command-not-found toolbox || true) \
|
||||||
&& dnf install -y flatpak \
|
&& dnf install -y flatpak \
|
||||||
|
&& dnf reinstall -y flatpak-selinux \
|
||||||
&& dnf clean all
|
&& dnf clean all
|
||||||
|
|
||||||
|
#Verifie que la politique SELinux connait bien le label du helper flatpak. Sans ce
|
||||||
|
#module (paquet flatpak-selinux), le binaire reste "unlabeled_t", systemd refuse
|
||||||
|
#de l'executer (203/EXEC) et /usr etant en lecture seule au runtime, l'image serait
|
||||||
|
#inutilisable pour flatpak. Mieux vaut un build qui echoue qu'une image cassee.
|
||||||
|
RUN matchpathcon /usr/libexec/flatpak-system-helper | grep -q flatpak_helper_exec_t
|
||||||
|
|
||||||
#Configuration de GDM : clavier FR (GNOME Initial Setup cree le premier compte au boot)
|
#Configuration de GDM : clavier FR (GNOME Initial Setup cree le premier compte au boot)
|
||||||
COPY config/xorg-keyboard.conf /etc/X11/xorg.conf.d/00-keyboard.conf
|
COPY config/xorg-keyboard.conf /etc/X11/xorg.conf.d/00-keyboard.conf
|
||||||
|
|
||||||
@@ -71,25 +77,6 @@ RUN wget https://cdn.filen.io/@filen/desktop/release/latest/Filen_linux_x86_64.r
|
|||||||
&& dnf clean all \
|
&& dnf clean all \
|
||||||
&& rm -f /tmp/filen.rpm
|
&& rm -f /tmp/filen.rpm
|
||||||
|
|
||||||
#SELinux : dans certains environnements de build (buildah rootful/overlay), les
|
|
||||||
#transactions semodule des scriptlets rpm echouent (sandbox /etc/selinux/targeted/tmp)
|
|
||||||
#et le module flatpak n'arrive jamais dans le store -> le helper reste unlabeled_t.
|
|
||||||
#On (re)installe explicitement le module puis on recompile la politique, en
|
|
||||||
#meilleur effort pour ne pas casser le build.
|
|
||||||
RUN rm -rf /etc/selinux/targeted/tmp; \
|
|
||||||
semodule -i /usr/share/selinux/packages/flatpak.pp.bz2 \
|
|
||||||
|| echo "AVERTISSEMENT: module SELinux flatpak non installe"; \
|
|
||||||
semodule -n -B \
|
|
||||||
|| { echo "AVERTISSEMENT: politique SELinux non recompilee dans ce build"; ls -la /etc/selinux/targeted; }; \
|
|
||||||
true
|
|
||||||
|
|
||||||
#Relabelle /usr depuis les file_contexts du store : rpm peut installer un binaire
|
|
||||||
#(flatpak-system-helper) avant que le module SELinux de son paquet ne soit pris en
|
|
||||||
#compte, et le fichier reste sans label. Comme /usr est en lecture seule sur le
|
|
||||||
#systeme deploye, le label doit etre correct dans l'image.
|
|
||||||
RUN setfiles -r / -F /etc/selinux/targeted/active/file_contexts /usr/libexec /usr/bin /usr/sbin \
|
|
||||||
|| echo "AVERTISSEMENT: relabel partiel de /usr"
|
|
||||||
|
|
||||||
#Installation de starship
|
#Installation de starship
|
||||||
RUN curl -sS https://starship.rs/install.sh | sh -s -- -y
|
RUN curl -sS https://starship.rs/install.sh | sh -s -- -y
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user