xemu/tests/docker
Richard W.M. Jones 3d212b41e9 nbd/server: Add --selinux-label option
Under SELinux, Unix domain sockets have two labels.  One is on the
disk and can be set with commands such as chcon(1).  There is a
different label stored in memory (called the process label).  This can
only be set by the process creating the socket.  When using SELinux +
SVirt and wanting qemu to be able to connect to a qemu-nbd instance,
you must set both labels correctly first.

For qemu-nbd the options to set the second label are awkward.  You can
create the socket in a wrapper program and then exec into qemu-nbd.
Or you could try something with LD_PRELOAD.

This commit adds the ability to set the label straightforwardly on the
command line, via the new --selinux-label flag.  (The name of the flag
is the same as the equivalent nbdkit option.)

A worked example showing how to use the new option can be found in
this bug: https://bugzilla.redhat.com/show_bug.cgi?id=1984938

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1984938
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

[eblake: rebase to configure changes, reject --selinux-label if it is
not compiled in or not used on a Unix socket]
Note that we may relax some of these restrictions at a later date,
such as making it possible to label a TCP socket, although it may be
smarter to do so as a generic QMP action rather than more one-off
command lines in qemu-nbd.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20211115202944.615966-1-eblake@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
[eblake: adjust meson output as suggested by thuth]
Signed-off-by: Eric Blake <eblake@redhat.com>
2021-11-16 10:16:38 -06:00
..
dockerfiles nbd/server: Add --selinux-label option 2021-11-16 10:16:38 -06:00
common.rc tests/docker: add a debian-native image and make available 2021-10-12 08:38:10 +01:00
docker.py tests/docker: don't use BUILDKIT in GitLab either 2021-07-14 14:33:53 +01:00
Makefile.include tests/docker: split PARTIAL into PARTIAL and VIRTUAL images 2021-11-04 10:32:01 +00:00
run tests/docker: remove FEATURES env var from templates 2021-07-14 14:33:53 +01:00
test-block docker: test-block: Don't continue if build fails 2017-09-29 11:14:15 +08:00
test-build tests/docker: move DEF_TARGET_LIST setting to common.rc 2019-09-10 14:14:31 +01:00
test-clang tests/docker: remove FEATURES env var from templates 2021-07-14 14:33:53 +01:00
test-debug tests/docker: remove FEATURES env var from templates 2021-07-14 14:33:53 +01:00
test-full docker: move make check into check_qemu helper 2018-07-24 11:45:25 +01:00
test-mingw tests/docker: remove FEATURES env var from templates 2021-07-14 14:33:53 +01:00
test-misc tests/docker: remove FEATURES env var from templates 2021-07-14 14:33:53 +01:00
test-quick tests/docker: move DEF_TARGET_LIST setting to common.rc 2019-09-10 14:14:31 +01:00
test-static tests/docker: add test script for static linux-user builds 2020-08-21 06:18:35 -04:00
test-tcg tests/docker: add a test-tcg for building then running check-tcg 2021-03-10 12:13:59 +00:00
test-tsan tests/docker: remove FEATURES env var from templates 2021-07-14 14:33:53 +01:00
test-unit docker: add test-unit runner 2018-07-24 11:45:25 +01:00