3 ms·
> Docker containers do not need to run as root and the documentation does recommend running containers as non-root users. Yet, unless something is default, it's
by eropple 11y ago
> Docker containers do not need to run as root and the documentation does recommend running containers as non-root users. Yet, unless something is default, it's hard to make users follow best practices. For that reason, user namespaces are important.
Definitely, but, in my experience, it gets worse than that, and why this is really important and not just important. Most containers are built on top of full OS images, with a full OS image's worth of vulnerabilities (some inert because services aren't running, but setuid's still respected--and I wonder how many setuid'd tools are actively tested in a containerized environment!), and it's rare in my experience that those base containers actually get updated after the end user selects one and a version to go along with it. Which means that even a properly-built container that doesn't run its internals as a non-root user may--and a pessimist might say "probably does"--have user escalation bugs squirreled away somewhere that the user not only doesn't know about, but isn't capable of auditing or is even aware that they might exist.
This, not "users don't read docs", is why I am so very, very salty about this in Docker, and while I'm glad that now Docker users (and, full disclosure, I'm not one anymore in part because of the poor security story--monolithic do-everything daemon running as root, no user namespaces--and in part just not wanting to be the stooge for somebody's platform play) don't have to "expect to wait long", this was promised in something like Docker 1.4, a year ago.
- kylequest 11y ago> Most containers are built on top of full OS images, with a full OS image's worth of vulnerabilities This is one of the problems DockerSlim (http://dockersl.im http://dockersl.im) is trying to address. You take those containers built on full OS images and you remove everything your app is not using reducing the attack surface.
- ecnahc515 11y agoDisclaimer: I work at CoreOS. Have you considered using rkt as an alternative to docker? It tries to avoid a lot of the security related problems docker has. Specifically there's no daemon which runs as root, instead rkt is invoked directly, so the only time rkt requires root, is the actual execution of a container, not downloading or verifying for example. Next, rkt by default wont run unsigned or untrusted images meaning by default you must trust the image/author, and finally rkt has the ability to run your container in a light weight VM using lkvm, getting you all the benefits of VM level isolation, but you have the ability to use the same container tooling for it all, and decreasing the overhead by optimizing for the container use-case. Recently rkt also got support for logging different events into the TPM audit log, making it possible to have tamper-proof audit trails of what containers have run on your system. User namespaces are also implemented, but I'm not sure how well tested they are. Solving the problem of using, and creating large full OS images is quite difficult. As a stepping stone we have also created a tool which scans container images on our Quay.io registry looking for images effected by CVEs. This should hopefully help until we can properly solve creating functional minimal containers easily, but that's unfortunately not quite as easy as just telling people to use buildroot (you still need a way to update those images and know when apps need have security updates). Hope this helps.
- eropple 11y ago> Have you considered using rkt as an alternative to docker? I have, and I respect it a lot more--and CoreOS in general has struck me for quite some time as being the adults in the room in this space, I think the value prop remains very shaky but I appreciate that CoreOS seems to give a damn--but I don't have a lot of use for rkt in general. The only place I have any multi-tenancy, I'm using FreeBSD and jails. (I'd like to use Illumos or OpenIndiana, as I better understand that stack than I do FreeBSD, but cperciva has done a great job with FreeBSD AMIs on AWS and I don't have the bandwidth to maintain an OpenIndiana AMI.)
- jzelinskie 11y agoHave you taken a look at jetpack[0]? Jetpack is an implementation of the appc specification, just like rkt, but is intended for use on FreeBSD. [0]: https://github.com/3ofcoins/jetpack https://github.com/3ofcoins/jetpack
- eropple 11y ago...ooh. Now this is cool. "Prototype," but totally worth watching. Thank you _very_ much for the pointer!