Securing and monitoring containers in enterprise environments

Did You Lock the Front Door?

You might have heard of Secure Computing Mode (known as seccomp), with which you enforce a limit on a process' abilities or on syscalls that are needed for a process to request a service from the kernel. The addition of these profiles is also possible in Kubernetes [5], currently the most popular container orchestration engine with an impressive 15-year production provenance from Google.

Creating a seccomp profile allows you to define every available syscall in a list, and after lots of testing at Google, you can take some comfort in the knowledge that the default profiles that enforce these tricky-to-fathom limits will help keep most applications available and not break anything horribly.

From a Docker perspective, a number of syscalls are run by default, but many are also switched off. At one point, their default profile blocked more than 50 syscalls with the promise that things would keep running as expected.

Want to Eat Your Cake Too?

In addition to fine-grained seccomp profiling, Docker cleverly integrates with the kernel's capabilities [6].

How to switch on only the permissions you require and not get bamboozled with the need to allow cap-add=all, which opens the floodgates to the host on which a container runs, is definitely worth understanding. I find myself referring to Linux capabilities [7] continually these days.

Be warned, however, that even worse than opening up lots of kernel capabilities for your containers is the dreaded (and I've heard it called "lazy") privileged mode. With privileged containers, in addition to unleashing system capabilities with cap-all=all, you lose all the limitations enforced by the device cgroups controller.

In terms of protecting your host from a container running in privileged mode, you might say that you're effectively leaving your front door swinging open in the wind, never mind forgetting to lock it.

As for the future of host security, it's common knowledge that Google has been working hard at spawning containers as the non-root user (and the Gnome project apparently has, too, from a desktop perspective). By all accounts, however, it's not a trivial undertaking. In case you are wondering, the popular Google Chrome browser sandboxes its Browser tabs in a not too dissimilar (and very clever) way that containers run. The surprising crossover between desktop and container spaces shows how important fine-grained kernel access for processes is.

The future is sharing VMs between distinct tenants (different customers) with fully assured safety and little fear of a compromise taking down your entire customer base at once. Kubernetes itself is not far from orchestrating containers within hypervisors for safety.

Freedom of Choice

One change that might have crept in under your radar, among those sometimes difficult-to-follow changes in the industry I mentioned earlier, is that Kubernetes has moved to allowing you to state your container runtime of choice.

Kubernetes reminds you that there's more than one way to launch a container – namely, using the cri= switch (i.e., for the container run-time interface, CRI). The CRI means you are no longer tied to the Docker runtime but can choose other run-time engines, such as rkt or the soon to be a la mode runtime that will comply with OCI standards (i.e., cri-o).

Conveniently, the container network interface (CNI) improvements also integrate nicely with the chosen container runtime's networking in Kubernetes. The project's page can be seen on GitHub [8].

Although easy to miss, progress is well underway on other lesser known projects to bestow more run-time choice. You might have a look at the README files for rktlet [9] and frakti [10] on their respective GitHub sites.

I recommend having a quick read of both pages for some valuable insight into what you might be working with very soon. Each choice is sophisticated and ultimately could have different agendas.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Docker Open Source Developer Tools

    Docker provides the open source tools and resources for compiling, building, and testing containerized applications.

  • Docker

    Docker is an economical alternative to conventional virtualization. Because each Docker container shares the underlying operating system, it enjoys the resource isolation and allocation benefits of VMs but is much more portable and efficient.

  • Docker with OwnCloud

    Run your application smoothly and portably in the cloud with the Docker container system. This workshop takes a practical look deploying Docker with the OwnCloud cloud environment.

  • Docker

    Do you work with Ubuntu but want to test something quickly on an openSUSE system? You don't need a second PC or a virtual machine to do it – a single container is quite enough.

  • Red Hat Acquires CoreOS

    One of the biggest contributors to the Kubernetes project has joined the Red Hat family.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More