SELinux labels change in libvirt

Daniel P. Berrangé berrange at redhat.com
Tue Jul 14 12:33:15 UTC 2020


On Tue, Jul 14, 2020 at 03:21:17PM +0300, Ram Lavi wrote:
> Hello all,
> 
> tl;dr, can you point me to the point in the libvirt repo where it's trying
> to change a tap-device's SELinux label?
> 
> I am trying to create a tap device with libvirt on a
> super-privileged container, and then use it on another,
> unprivileged container with libvirt.
> User wise, I know I need the super-privileged container to open the tap
> device with the user of the unprivileged one - that I already did and it's
> not the issue.
> But I have a problem when I open the tap device in the
> non-privileged container: the tap device currently has the spc_t label
> since the tun_socket inherited the selinux context from the
> super-privileged container who creates it. then libvirt is trying to change
> the SELinux labels, and since it's not privileged then it fails.
> But I didn't find where and how libvirt is trying to change the tap
> device's label.
> 
> Can you point me to that specific code on libvirt?

If the SELinux policy that libvirtd is running under prevents it from
re-labelling, then TAP devices label failure is just going to be one
out of 100's of labelling failures.

Either the SELinux policy needs to be changed to allow libvirtd to
relabel stuff in the normal manner, or you will have to turn off
SELinux  support in libvirtd. in /etc/libvirt/qemu.conf via the
param security_driver = "none".  If you turn off SELinux in
libvirt, then you no longer have separation of QEMU processes
which may be a security flaw depending on your deplyoment
scenario.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvirt-users mailing list