|
|
Log in / Subscribe / Register

Linux containers vs. VMs: A security comparison (InfoWorld)

Linux containers vs. VMs: A security comparison (InfoWorld)

Posted May 20, 2016 11:17 UTC (Fri) by spender (guest, #23067)
In reply to: Linux containers vs. VMs: A security comparison (InfoWorld) by corsac
Parent article: Linux containers vs. VMs: A security comparison (InfoWorld)

I have to say this is a really odd comment for the maintainer of grsecurity on Debian to make.

It's true that grsecurity doesn't support mount namespaces in RBAC, like several other access control systems. The difficulty being that RBAC is designed to be used system-wide and doesn't yet permit individual per-namespace policies. Mount namespaces allow for filesystems to exist which cannot be seen via the global namespace, so there's no way I can see yet for us to construct a path to represent those unreachable names when logging to dmesg, and it's not possible to have one gradm see all the files involved at load time. I also don't like the user experience of requiring individual gradm usage in each container, particularly when that's generally automated.

It's not true however that grsecurity has no namespace support. There's special handling in some of the chroot features for pid /mount namespaces, all of the code is user-namespace aware, and the net/cgroup namespaces are pretty orthogonal to anything in grsec. Several non-configurable changes also provide additional security for containers, requiring CAP_SYS_ADMIN for /proc/sys writes, for instance.

I know of many people using Docker with grsecurity -- from a read of a recent github issue about it, it seems they've also resolved an incompatibility that required disabling two chroot protections at runtime. If anyone has any compatibility issues with containers, they're of course welcome to report that on our forums (or point us to relevant Docker github issues) where we can help explain things and come up with more secure alternatives.

Finally, the reason it should have been mentioned (generally this would have happened in the paragraph starting with "Finally, the process to kernel interface (for system calls) is large and exposed in every container", or even seccomp at least) is why anyone using containers or shared hosting uses grsecurity: to protect the kernel from users and strengthen the separation between one potentially compromised user and other customers. Obviously it's no guarantee, there are still logic bugs and other one-off failures, but what is a guarantee is that any public memory corruption exploit that has a chance of working against grsecurity or demonstrates new exploit techniques will have its techniques and bug classes killed off in a short period of time. Anyone's welcome to look into our history to see many examples of this (shadow vsyscall hardening, KSTACKOVERFLOW, RANDKSTACK, STACKLEAK, USERCOPY, some very recent USERCOPY enhancements, STRUCTLEAK, removal of thread_info from the stack, MODHARDEN, etc etc).

-Brad


to post comments

Linux containers vs. VMs: A security comparison (InfoWorld)

Posted May 20, 2016 11:54 UTC (Fri) by corsac (subscriber, #49696) [Link]

In case my original comment wasn't interpreted the way I intended (that's at least the case for Brad, so maybe also for others), I wasn't implying at all that grsecurity was incompatible with containers, quite the opposite actually.

My point was more like grsecurity and containers are orthogonal to each others, and that might be the reason (pure speculation though) the original article didn't mention it.

The one place where they're not orthogonal features is with RBAC (which can be used to isolate processes a bit like containers do), and that also means it's really hard to have specific namespace support.

I stand corrected about the chroot restrictions though, that's nice.

And obviously, like Brad said on the last paragraph, since you share the same kernel on all the containers, you actually really want to protect it against the various userlands, and thus having a hardened kernel is definitely a good idea here (on top of generic container hardening like capabilities dropping, seccomp etc.). I do run some (LXC, not docker) containers and I'm glad I'm running them on a grsecurity kernel.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds