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

Container Images Compliance: Removing Security Pain Points With ManageIQ and OpenSCAP

DZone's Guide to

Container Images Compliance: Removing Security Pain Points With ManageIQ and OpenSCAP

Can we trust developers to use only good packages? In container-based dev flows, we want to ensure that images are compliant... but how do we even define compliance? Using ManageIQ’s Smart State Analysis as a means of automating Cloud and Container based workflows and OpenSCAP as a means of of measuring compliance, we'll show one way to solve this problem.

· Cloud Zone
Free Resource

Site24x7 - Full stack It Infrastructure Monitoring from the cloud. Sign up for free trial.

"Docker is about running random crap from the Internet as root on your host" - Dan Walsh

Do You Trust Your Containers?

In container-based development flows, a developer will create an image to be the base for an application. Images are stateless, read only, and they are built in layers. These layers represent everything in an application's runtime environment but the kernel, which will be “borrowed” from the hosting machine. Such layers include distribution, packages, environment, and additional configurations. It is not uncommon to see images on the Docker hub using wget to grab random stuff off the Internet to make up some of these layers.

This represents a paradigm shift over the pre-container world where there was a clearer line between developers writing application code and IT specialists taking care of package upgrades. Can we trust developers to use only good packages? When the next Heartbleed is discovered will there be someone monitoring CVE streams to make sure packages are updated in a timely manner? What if the developer leaves the company?

One solution is to use a container registry from a trusted authority. Red Hat's container registry, for example, provides secure base images and removes the above-mentioned concern. However, in order to have containerized applications with any value, a developer must create his own Images on top and distribute them somehow.

How can we check a given Image for compliance?

How do we even define such compliance?

Introductions to OpenSCAP and ManageIQ

ManageIQ, the open source project that powers Red Hat's CloudForms, is a hybrid cloud management platform.

Image title

Cloud management platforms are used by organizations to control complex environments composed of nodes coming from multiple sources including traditional virtualization, private and public clouds, containers, and much more. ManageIQ supports container providers including OpenShift and Kubernetes.

OpenSCAP is free software Implementation of SCAP: The Security Content Automation Protocol.

SCAP is a NIST authored set of standards. Combined together, these standards allow for:

  • Naming systems components such as Operating Systems, Packages, and configurations.
  • Defining possible Vulnerabilities (CVE) and Weaknesses (CWE) against those systems.
  • Defining checklists (‘Content’) on systems against Vulnerabilities and Weaknesses.

With these components and content from a trusted source, we can now look at one system or a complete environment and say if they are compliant or not.

SCAP is trusted & used by many organizations including the US government & military.

Image title

Thus far, we've mentioned a pain point in Container based environments, introduced SCAP as a means to measure compliance in computer systems, and presented ManageIQ as a means of automating Cloud & Container based workflows.

Now, we will demo using ManageIQ’s Smart State Analysis to introspect container images and view SCAP results for them. We will then go further, and use the Control subsystem of ManageIQ, see how the system can monitor compliance for us, and even take authoritative action when a predefined baseline is not met.

Tutorial: Using the OpenSCAP Integration in ManageIQ

At ManageIQ we have been working on leveraging OpenSCAP to show container images that infringe known vulnerabilities based on the latest CVE content distributed by Red Hat. Integrating with ManageIQ’s “Control” subsystem allows defining workflows & compliance based on SCAP results. The integration was first introduced in the Darga release of ManageIQ and improved for the coming Euwe release.

ManageIQ has a mechanism for introspecting its objects – VMS, Hosts, Container Images, and much more. When running Smart State Analysis on container images, scanning containers are created on the target provider. The container Image being inspected is pulled, mounted, and analyzed for Vulnerabilities. Cluster Load is taken into account.

We will show two flavors of this integration:

  • Run one scan and view result
  • Full blown integration with ManageIQ ‘Control’ subsystem for a container provider

This tutorial requires a running ManageIQ instance that has a container provider. If you do don’t have such an environment but you would like to install one take a look at this link. An offering of a free test OpenShift cluster is also available at Openshift. For both, make sure your ManageIQ appliance has the ‘smartproxy’ and ‘smartstate’ roles enabled:

  1. Navigate to “Configuration -> Server:EVM”.
  2. Make sure “SmartState Analysis” and “smartproxy” roles are enabled.

Run One Scan and View Results:

  1. Navigate to “Compute” -> “Containers” -> “Container Images”.
  2. Select images to scan & press “Configuration” -> “Perform SmartState Analysis”.

That’s it! You can now follow the scan status under “Tasks” -> “All VM And Container Analysis Tasks”. Upon completion you can view the results under the Container Image screen:

Image title

OpenSCAP results for an image, we also provide the standard OpenSCAP HTML as well as a failure summary.


Full Blown Integration With ManageIQ 'Control' Subsystem for a Container Provider

  1. In ManageIQ go to Compute -> Containers -> Providers.
  2. Select providers -> Policy -> “Manage Policies”.
  3. Select the out of the box “OpenSCAP profile” & press apply changes.
  4. Go To “Configuration” -> “Schedules” -> “Add a new Schedule” and add a daily scan of all containers from a certain provider.

Image title

The default OpenSCAP profile.


That’s it! From this point on:

  • New Images discovered will automatically be scanned.
  • All provider Images will be scanned daily (with cluster load considerations in mind).
  • Images with high severity failures will be marked as non-compliant.
  • If a non-compliant image came from OpenShift, we will attempt to label it as non-secure and prevent its execution. This step requires additional configuration in OpenShift.

Using ManageIQ’s ‘Control’ system the sky is the limit: It is possible to define additional policies that would be executed once a compliance check failed or succeeded. It is possible to copy the ‘OpenSCAP Profile’ and create new profiles based on that. For example, a user can choose to define all images with ANY severity failure as non-compliant creating a very hardened system.

Reference

  • OpenScap Acronyms
  • https://www.open-scap.org/resources/acronyms/

    Site24x7 - Full stack It Infrastructure Monitoring from the cloud. Sign up for free trial.

    Topics:
    container security ,containers ,compliance ,openshift

    Published at DZone with permission of Mooli Tayer, DZone MVB. See the original article here.

    Opinions expressed by DZone contributors are their own.

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

    {{ parent.tldr }}

    {{ parent.urlSource.name }}