Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

SELinux + KVM + CloudStack

DZone's Guide to

SELinux + KVM + CloudStack

· Cloud Zone
Free Resource

MongoDB Atlas is a database as a service that makes it easy to deploy, manage, and scale MongoDB. So you can focus on innovation, not operations. Brought to you in partnership with MongoDB.

Curator's Note: The content of this article was originally written by David over at the Build a Cloud blog.

So I am working on writing an SELinux policy for the CloudStack KVM agent so that SELinux can be left enabled. Why you ask? Well I really dislike advocating for people to turn off a security mechanism to get software to work. Additionally I really want some of the advantages of sVirt. But here is where I'd like to solicit some help. If you are running KVM with CloudStack you naturally have SELinux set to disabled or permissive. If you have it set to permissive, and would consider installing my current policy definition - it would be greatly appreciated. What's the impact of you testing my policy? Well nothing right now - you're in permissive mode, and we won't change that during testing, so all you'd be doing is hopefully cutting down on AVC denials in /var/log/messages or in /var/log/audit/audit.log

So how do you help:

First install the new policy:

You can get the current version here: cloudstack-agent.pp once you have that on the hypervisor - run:
 semodule -i cloudstack-agent.pp

Make sure you have auditd installed:


     rpm -q audit
The above should show you whether or not you have audit installed. If not you can install and start auditd with the following commands:

     yum -y install audit service auditd start chkconfig auditd on
The audit package ensures that all AVCs are logged to a dedicated file (/var/log/audit/audit.log) rather than /var/log/messages.

If you already had auditd up and running, lets rotate the logs

This will make it much easier to diagnose any missing policy items:
     service auditd stop mv /var/log/audit/audit.log /var/log/audit/oldaudit.log service auditd start 
Now go about your business, deploy machines, destroy machines, do weird and wacky things, we are essentially looking for new entries in audit.log to see what we have missed. If your audit log shows up with items in your audit log, please upload them to this bug: CLOUDSTACK-337

You have questions??

Do they match these below? If not ask on the list.

Wait, are you testing this yourself?

Of course I am - I've long since (by which I mean I applied it while writing this) applied this to all of my KVM nodes, however, I have only a small percentage of potential configuration options. Specifically, I am running CloudStack 4.0.1, with KVM on EL6.3, with NFS and local storage and VLANs for isolation.

Wait - are you making my KVM hypervisor less secure?

Probably not. I mean to begin with you are currently running with SELinux in permissive mode. This is an effort to allow us to turn on SELinux, use sVirt, and have a more secure hypervisor. Still not assuaged? Want to see the source? It's here.




 

MongoDB Atlas is the best way to run MongoDB on AWS — highly secure by default, highly available, and fully elastic. Get started free. Brought to you in partnership with MongoDB.

Topics:

Published at DZone with permission of Mark Hinkle, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}