SELinux context for VM guests using LVM volumes

Support for security such as Firewalls and securing linux
Post Reply
Whoever
Posts: 1361
Joined: 2013/09/06 03:12:10

SELinux context for VM guests using LVM volumes

Post by Whoever » 2015/04/07 03:46:22

We have a machine which hosts a number of virtualization guests using libvirt and kvm. Each storage device that is presented to the guests is stored on the host as an individual logical volume -- each guest gets one or more of the host's logical volumes to use as storage.

How do I make this setup work with SELinux? The RedHat documents only address using file-backed storage volumes.

aks
Posts: 3073
Joined: 2014/09/20 11:22:14

Re: SELinux context for VM guests using LVM volumes

Post by aks » 2015/04/07 19:09:29

So are you presenting blocks or files?

User avatar
TrevorH
Site Admin
Posts: 33219
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: SELinux context for VM guests using LVM volumes

Post by TrevorH » 2015/04/07 19:38:25

My guest's LVM disks just have standard selinux contexts and I get no complaints from my VMs.

Code: Select all

lrwxrwxrwx. root root system_u:object_r:device_t:s0    testvm -> ../dm-3
brw-rw----. root disk system_u:object_r:fixed_disk_device_t:s0 /dev/dm-3
Though thinking about it I don't use those directly, my VMs use /dev/drbdX which uses the LV as a backing device. The context on the DRBD device looks like

Code: Select all

brw-rw----. root disk system_u:object_r:svirt_image_t:s0:c66,c143 /dev/drbd2
But I didn't have to set that - it was set automatically by something.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Whoever
Posts: 1361
Joined: 2013/09/06 03:12:10

Re: SELinux context for VM guests using LVM volumes

Post by Whoever » 2015/04/08 01:56:26

aks wrote:So are you presenting blocks or files?
blocks

aks
Posts: 3073
Joined: 2014/09/20 11:22:14

Re: SELinux context for VM guests using LVM volumes

Post by aks » 2015/04/08 16:11:36

I present blocks to my CentOS VMs and have SELinux running, with no problems whatsoever. After all you're just presenting raw storage, it's up to the VM what gets written there.
Is that what you're asking?

Whoever
Posts: 1361
Joined: 2013/09/06 03:12:10

Re: SELinux context for VM guests using LVM volumes

Post by Whoever » 2015/04/09 04:22:13

aks wrote:I present blocks to my CentOS VMs and have SELinux running, with no problems whatsoever. After all you're just presenting raw storage, it's up to the VM what gets written there.
Is that what you're asking?
Not really. The host is running in permissive mode at the moment, and I see messages in the audit log that suggest that SELinux would block the host from presenting the storage to the guest. But maybe I have mis-interpreted the message.

aks
Posts: 3073
Joined: 2014/09/20 11:22:14

Re: SELinux context for VM guests using LVM volumes

Post by aks » 2015/04/10 20:13:15

Uh.
So you're presenting block storage through something like KVM and you have some messages that suggest SELinux would prevent the presentation?
So two questions:
1) How are you presenting the block storage (FC/iSCSI though hardware or software)?
2) Post the suspect messages.

Post Reply