mirror of
https://github.com/systemd/systemd.git
synced 2025-01-05 13:18:06 +03:00
TEST-06-SELINUX: Various fixes
- Stop installing the policy in the initramfs as it's not really supported anyway (https://github.com/fedora-selinux/selinux-policy/issues/2221) - Stop relabeling on first boot and prefer to do it at image build time - Disable mkosi relabeling by default but enable it in CI - Build image as root in CI so the SELinux relabeling works properly
This commit is contained in:
parent
877842ed52
commit
dedd712dd9
11
.github/workflows/mkosi.yml
vendored
11
.github/workflows/mkosi.yml
vendored
@ -59,36 +59,43 @@ jobs:
|
|||||||
sanitizers: ""
|
sanitizers: ""
|
||||||
llvm: 0
|
llvm: 0
|
||||||
cflags: "-O2 -D_FORTIFY_SOURCE=3"
|
cflags: "-O2 -D_FORTIFY_SOURCE=3"
|
||||||
|
relabel: no
|
||||||
- distro: debian
|
- distro: debian
|
||||||
release: testing
|
release: testing
|
||||||
sanitizers: ""
|
sanitizers: ""
|
||||||
llvm: 0
|
llvm: 0
|
||||||
cflags: "-Og"
|
cflags: "-Og"
|
||||||
|
relabel: no
|
||||||
- distro: ubuntu
|
- distro: ubuntu
|
||||||
release: noble
|
release: noble
|
||||||
sanitizers: ""
|
sanitizers: ""
|
||||||
llvm: 0
|
llvm: 0
|
||||||
cflags: "-Og"
|
cflags: "-Og"
|
||||||
|
relabel: no
|
||||||
- distro: fedora
|
- distro: fedora
|
||||||
release: "40"
|
release: "40"
|
||||||
sanitizers: ""
|
sanitizers: ""
|
||||||
llvm: 0
|
llvm: 0
|
||||||
cflags: "-Og"
|
cflags: "-Og"
|
||||||
|
relabel: yes
|
||||||
- distro: fedora
|
- distro: fedora
|
||||||
release: rawhide
|
release: rawhide
|
||||||
sanitizers: address,undefined
|
sanitizers: address,undefined
|
||||||
llvm: 1
|
llvm: 1
|
||||||
cflags: "-Og"
|
cflags: "-Og"
|
||||||
|
relabel: yes
|
||||||
- distro: opensuse
|
- distro: opensuse
|
||||||
release: tumbleweed
|
release: tumbleweed
|
||||||
sanitizers: ""
|
sanitizers: ""
|
||||||
llvm: 0
|
llvm: 0
|
||||||
cflags: "-Og"
|
cflags: "-Og"
|
||||||
|
relabel: no
|
||||||
- distro: centos
|
- distro: centos
|
||||||
release: "9"
|
release: "9"
|
||||||
sanitizers: ""
|
sanitizers: ""
|
||||||
llvm: 0
|
llvm: 0
|
||||||
cflags: "-Og"
|
cflags: "-Og"
|
||||||
|
relabel: yes
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
||||||
@ -141,6 +148,8 @@ jobs:
|
|||||||
MESON_OPTIONS=--werror
|
MESON_OPTIONS=--werror
|
||||||
LLVM=${{ matrix.llvm }}
|
LLVM=${{ matrix.llvm }}
|
||||||
|
|
||||||
|
SELinuxRelabel=${{ matrix.relabel }}
|
||||||
|
|
||||||
[Host]
|
[Host]
|
||||||
QemuMem=4G
|
QemuMem=4G
|
||||||
# We build with debuginfo so there's no point in mounting the sources into the machine.
|
# We build with debuginfo so there's no point in mounting the sources into the machine.
|
||||||
@ -187,7 +196,7 @@ jobs:
|
|||||||
-Dvmspawn=enabled
|
-Dvmspawn=enabled
|
||||||
|
|
||||||
- name: Build image
|
- name: Build image
|
||||||
run: meson compile -C build mkosi
|
run: sudo meson compile -C build mkosi
|
||||||
|
|
||||||
- name: Run integration tests
|
- name: Run integration tests
|
||||||
run: sudo --preserve-env meson test -C build --no-rebuild --suite integration-tests --print-errorlogs --no-stdsplit --num-processes "$(($(nproc) - 1))"
|
run: sudo --preserve-env meson test -C build --no-rebuild --suite integration-tests --print-errorlogs --no-stdsplit --num-processes "$(($(nproc) - 1))"
|
||||||
|
@ -11,7 +11,6 @@ BuildDirectory=build/mkosi.builddir
|
|||||||
CacheDirectory=build/mkosi.cache
|
CacheDirectory=build/mkosi.cache
|
||||||
|
|
||||||
[Content]
|
[Content]
|
||||||
SELinuxRelabel=no
|
|
||||||
BuildSourcesEphemeral=yes
|
BuildSourcesEphemeral=yes
|
||||||
Autologin=yes
|
Autologin=yes
|
||||||
|
|
||||||
@ -24,6 +23,10 @@ ExtraTrees=
|
|||||||
Environment=
|
Environment=
|
||||||
SYSTEMD_REPART_OVERRIDE_FSTYPE_ROOT=%F
|
SYSTEMD_REPART_OVERRIDE_FSTYPE_ROOT=%F
|
||||||
|
|
||||||
|
# Disable relabeling by default as it only matters for TEST-06-SELINUX, takes a non-trivial amount of time
|
||||||
|
# and results in lots of errors when building images as a regular user.
|
||||||
|
SELinuxRelabel=no
|
||||||
|
|
||||||
# Adding more kernel command line arguments is likely to hit the kernel command line limit (512 bytes) in
|
# Adding more kernel command line arguments is likely to hit the kernel command line limit (512 bytes) in
|
||||||
# various scenarios. Consider adding support for a credential instead if possible and using that.
|
# various scenarios. Consider adding support for a credential instead if possible and using that.
|
||||||
KernelCommandLine=systemd.crash_shell
|
KernelCommandLine=systemd.crash_shell
|
||||||
|
@ -1,20 +1,13 @@
|
|||||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
|
||||||
|
# libselinux does not work in the slightest with /usr-only images so don't install the packages if we're
|
||||||
|
# building a /usr-only image.
|
||||||
|
|
||||||
[Match]
|
[Match]
|
||||||
Profile=!particle
|
Profile=!particle
|
||||||
|
|
||||||
[Content]
|
[Content]
|
||||||
# libselinux does not work in the slightest with /usr-only images so don't install the packages if we're
|
|
||||||
# building a /usr-only image.
|
|
||||||
Packages=
|
Packages=
|
||||||
selinux-policy
|
selinux-policy
|
||||||
selinux-policy-targeted
|
selinux-policy-targeted
|
||||||
setools-console
|
setools-console
|
||||||
|
|
||||||
# We relabel on first boot instead of at build time because it is only possible to label without root
|
|
||||||
# if the labels exist in the host system, and we want to be able to cross-build to other distributions.
|
|
||||||
SELinuxRelabel=no
|
|
||||||
|
|
||||||
InitrdPackages=
|
|
||||||
selinux-policy
|
|
||||||
selinux-policy-targeted
|
|
||||||
|
@ -32,10 +32,10 @@ disable auditd.service
|
|||||||
# systemd-timesyncd is not enabled by default in the default systemd preset so enable it here instead.
|
# systemd-timesyncd is not enabled by default in the default systemd preset so enable it here instead.
|
||||||
enable systemd-timesyncd.service
|
enable systemd-timesyncd.service
|
||||||
|
|
||||||
# Skipped if selinux is not enabled, required for TEST-06-SELINUX.
|
|
||||||
enable autorelabel.service
|
|
||||||
|
|
||||||
# Enabled by default on OpenSUSE and not conditioned out in containers, so let's disable these here instead.
|
# Enabled by default on OpenSUSE and not conditioned out in containers, so let's disable these here instead.
|
||||||
disable iscsi.service
|
disable iscsi.service
|
||||||
disable iscsid.socket
|
disable iscsid.socket
|
||||||
disable iscsiuio.socket
|
disable iscsiuio.socket
|
||||||
|
|
||||||
|
# mkosi relabels the image itself so no need to do it on boot.
|
||||||
|
disable selinux-autorelabel-mark.service
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
integration_tests += [
|
integration_tests += [
|
||||||
integration_test_template + {
|
integration_test_template + {
|
||||||
'name' : fs.name(meson.current_source_dir()),
|
'name' : fs.name(meson.current_source_dir()),
|
||||||
'cmdline' : integration_test_template['cmdline'] + ['systemd.wants=autorelabel.service', 'selinux=1', 'lsm=selinux'],
|
'cmdline' : integration_test_template['cmdline'] + ['selinux=1', 'lsm=selinux'],
|
||||||
# FIXME; Figure out why reboot sometimes hangs with 'linux' firmware.
|
# FIXME; Figure out why reboot sometimes hangs with 'linux' firmware.
|
||||||
# Use 'auto' to automatically fallback on non-uefi architectures.
|
# Use 'auto' to automatically fallback on non-uefi architectures.
|
||||||
'firmware' : 'auto',
|
'firmware' : 'auto',
|
||||||
|
Loading…
Reference in New Issue
Block a user