Blame SOURCES/0012-Use-proper-label-for-nbdkit-sockets.patch

4ebc84
From d161370dbc97786e05d476ccaed219fa14d7bf1b Mon Sep 17 00:00:00 2001
4ebc84
From: Martin Kletzander <mkletzan@redhat.com>
4ebc84
Date: Mon, 27 May 2019 13:30:05 +0200
4ebc84
Subject: [PATCH] Use proper label for nbdkit sockets
4ebc84
4ebc84
While svirt_t can be used for sockets it does not always guarantee that it will
4ebc84
be accessible from a virtual machine.  The VM might be running under svirt_tcg_t
4ebc84
context which will need a svirt_tcg_t label on the socket in order to access it.
4ebc84
4ebc84
There is, however, another label, svirt_socket_t, which is accessible from
4ebc84
virt_domain:
4ebc84
4ebc84
  # sesearch -A -s svirt_t -c unix_stream_socket -p connectto
4ebc84
  ...
4ebc84
  allow virt_domain svirt_socket_t:unix_stream_socket { ... connectto ... };
4ebc84
  ...
4ebc84
4ebc84
And virt_domain is a type attribute of both svirt_t and svirt_tcg_t:
4ebc84
4ebc84
  # seinfo -x -a virt_domain
4ebc84
  Type Attributes: 1
4ebc84
     attribute virt_domain;
4ebc84
          svirt_t
4ebc84
          svirt_tcg_t
4ebc84
4ebc84
Resolves: https://bugzilla.redhat.com/1698437
4ebc84
4ebc84
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
4ebc84
(cherry picked from commit c2918b8b74506523a723b804d452816a059c5e50)
4ebc84
---
4ebc84
 v2v/input_libvirt_vddk.ml | 2 +-
4ebc84
 v2v/output_rhv_upload.ml  | 2 +-
4ebc84
 2 files changed, 2 insertions(+), 2 deletions(-)
4ebc84
4ebc84
diff --git a/v2v/input_libvirt_vddk.ml b/v2v/input_libvirt_vddk.ml
4ebc84
index 97c7cb532..567233d58 100644
4ebc84
--- a/v2v/input_libvirt_vddk.ml
4ebc84
+++ b/v2v/input_libvirt_vddk.ml
4ebc84
@@ -290,7 +290,7 @@ object
4ebc84
       add_arg "--newstyle";         (* use newstyle NBD protocol *)
4ebc84
       add_arg "--exportname"; add_arg "/";
4ebc84
       if have_selinux then (        (* label the socket so qemu can open it *)
4ebc84
-        add_arg "--selinux-label"; add_arg "system_u:object_r:svirt_t:s0"
4ebc84
+        add_arg "--selinux-label"; add_arg "system_u:object_r:svirt_socket_t:s0"
4ebc84
       );
4ebc84
 
4ebc84
       (* Name of the plugin.  Everything following is a plugin parameter. *)
4ebc84
diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml
4ebc84
index 77c39107e..c2a5c72c7 100644
4ebc84
--- a/v2v/output_rhv_upload.ml
4ebc84
+++ b/v2v/output_rhv_upload.ml
4ebc84
@@ -217,7 +217,7 @@ See also the virt-v2v-output-rhv(1) manual.")
4ebc84
     let args =
4ebc84
       (* label the socket so qemu can open it *)
4ebc84
       if have_selinux then
4ebc84
-        args @ ["--selinux-label"; "system_u:object_r:svirt_t:s0"]
4ebc84
+        args @ ["--selinux-label"; "system_u:object_r:svirt_socket_t:s0"]
4ebc84
       else args in
4ebc84
     args in
4ebc84
 
4ebc84
-- 
4ebc84
2.21.0
4ebc84