Container Security with SELinux and CoreOS
coreos.com
coreos.com
It's great to see this being adopted more widely - it greatly improves the security of containers, and in my experience, adds nothing to the cost of administrating systems. I'm much happier running our security-sensitive applications in containers with this than I would be without it.
In this scenario SELinux will only protect you from very specific kernel bugs.
SELinux will not protect you against any kernel bug that either gives you a memory write primitive or gives you control over RIP. (Since you can just trash all the SELinux protections). It is only going to protect you from logic bugs where the kernel accidentally gives you filesystem access you weren't meant to have or something similar. Bare in mind that some of the recent kernel bugs relating to namespaces have been logic bugs.
We are exploring different operating systems for running containers and CoreOS seems like a good candidate.
Example 6. Run a container with SELinux sandbox security contexts
# chcon system_u:object_r:svirt_sandbox_file_t:s0:c0,c1 -R \
/srv/container
# systemd-nspawn -L system_u:object_r:svirt_sandbox_file_t:s0:c0,c1 \
-Z system_u:system_r:svirt_lxc_net_t:s0:c0,c1 -D /srv/container \
/bin/sh
In addition to -Z and -L, there's also --drop-capability.Apart from privilege escalation bugs, any shared resource can theoretically be used to escape containers. For example, access to main memory via a device with DMA, access to the same /proc as the host, access to a shared filesystem (replace a binary that the host executes), etc.
http://www.projectatomic.io/blog/2014/09/yet-another-reason-...