a security state of mind: container security · container security openscap host os server...

51
A Security State of Mind: Container Security Chris Van Tuin Chief Technologist, West [email protected]

Upload: others

Post on 10-Jul-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

A Security State of Mind: Container Security

Chris Van Tuin Chief Technologist, West [email protected]

Page 2: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

2

AGENDA

Why Linux Containers?

What are Linux Containers?

Container Security

OpenSCAPHOST OS

SERVER

CONTAINER

LIBS

APP

Page 3: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the
Page 4: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

THE NEED FOR SPEED THE ACCELERATION OF APPLICATION DELIVERY FOR THE BUSINESS

Page 5: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

5

THE PROBLEM: FRICTION

Page 6: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

6

APPLICATION DELIVERY VIA CONTAINERS

Page 7: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

LINUX CONTAINERS

Page 8: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

8

WHAT ARE LINUX CONTAINERS?

• Package Once Deploy Anywhere

• Containers provide lightweight isolation of process, network, filesystem spaces

• Docker builds on Linux containers, adds an API, image format, runtime, and a delivery and sharing model

HOST OS

SERVER

CONTAINER

LIBS

APP

Page 9: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

9

Page 10: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

10

BUILD, SHIP, RUN

Page 11: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

Containers

11

Traditional OS

HARDWARE

HOST OS

HARDWARE

HOST OS

CONTAINER

LIBS

APP A

LIBS A LIBS B LIBS LIBS

APP A APP B

CONTAINER

LIBS

APP B

TRADITIONAL OS VS CONTAINERS

Page 12: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

12

RHEL Kernel

Hardware (Intel, AMD) or Virtual Machine

Containers ContainersContainers

Unit File

Docker Image

DOCKER CLI

SYSTEMD

Cgroups Namespaces SELinux

Drivers

UNDERLYING TECHNOLOGY

Page 13: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

13

IMAGE-BASED CONTAINERS WITH DOCKER TECHNOLOGY

• Docker container images have layers

• All image layers are read only

• When a container is run the topmost layer is read-write

Page 14: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

CONTAINER SECURITY

Page 15: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

http://www.informationisbeautiful.net/visualizations/worlds-biggest-data-breaches-hacks/

Page 16: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

16

Page 17: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

“Patch? The servers are behind the firewall.”

- Anonymous (far too many to name), 2005 - …

Page 18: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

18

“CONTAINERS DO NOT CONTAIN” - Dan Walsh, Red Hat

Page 19: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

19

RESOURCES NOT NAMESPACED

•Kernel keyring •Kernel itself and modules •Devices •System time •UIDs*

•*RHEL 7.2 Tech Preview •*Kernel boot option, user_namespace.enable=1

Page 20: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

20

CONTAINER SECURITY RISKS

• Kernel exploits

• Denial of Service attacks

• Container breakouts

• Poisoned images

• Compromised secrets

Page 21: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

CONTAINER IMAGES

Page 22: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

64% of official images in Docker Hub contain high priority security vulnerabilities

examples: ShellShock (bash)

Heartbleed (OpenSSL) Poodle (OpenSSL)

Source: Over 30% of Official Images in Docker Hub Contain High Priority Security Vulnerabilities, Jayanth Gummaraju, Tarun Desikan, and Yoshio Turner, BanyanOps, May 2015 (http://www.banyanops.com/pdf/BanyanOps-AnalyzingDockerHub-WhitePaper.pdf)

WHAT’S INSIDE THE CONTAINER MATTERS

Page 23: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

23

Page 24: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

VULNERABILITIES PER PACKAGE TOP 20 (2014)

Page 25: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

Compliance and Vulnerability Audits with OpenSCAP

Page 26: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

National Institute of Standards and Technology

automating vulnerability management, security management, and compliance checking

Page 27: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

Common Vulnerability and Exposures (CVE)

Page 28: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

Common Configuration Enumeration (CCE)

CCE-27002-5 Set Password Minimum Length in login.defs To specify password length requirements for new accounts, edit the file /etc/login.defs and add or correct the following lines: PASS_MIN_LEN

The DoD requirement is 14. The FISMA requirement is 12. If a program consults /etc/login.defs and also another PAM module (such as pam_cracklib) during a password change operation, then the most restrictive must be satisfied. See PAM section for more information about enforcing password quality requirements.

CCE Database

Page 29: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

OpenSCAP

ReportsScan

SCAP Security Guide

for RHEL

CCE-27002-5 Set Password Minimum Length

Content

Scan physical servers, virtual machines, docker images and containersfor Compliance (CCEs) and known Vulnerabilities (CVEs)

Page 30: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

OpenSCAP Tools

Page 31: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

USE CASE #1: Scan for Compliance

Are password quality

requirements set?

Are obsolete services enabled,

e.g. telnet?

Is openssh properly configured?

Is /tmp on a separate partition?

Page 32: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

SCANoscap xccdf eval --profile rht-ccp \--report /var/www/html/report.html \--results /var/www/html/results.html \--cpe /usr/share/xml/scap/ssg/content/ssg-rhel7-cpe-dictionary.xml \/usr/share/xml/scap/ssg/content/ssg-rhel7-xccdf.xml

Page 33: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

REPORT

Page 34: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

REPORT

Page 35: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

REPORT

Page 36: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

REMEDIATION

Page 37: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

What RPMs need updating?

What is the criticality of the vulnerability?

What is the vulnerability?

What CVEs have and have not been

addressed?

USE CASE #2: Scan for Known Vulnerabilities

Page 38: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

SCAN

# obtain RHSA file from Red Hat for RHEL wget http://www.redhat.com/security/data/oval/com.redhat.rhsa-all.xml

# run Vulnerability scan oscap oval eval --results /var/www/html/rhsa-results-oval.xml \ --report /var/www/html/oval-report.html com.redhat.rhsa-all.xml

# view the Report firefox /var/www/html/oval-report.html

Page 39: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

REPORT

Page 40: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

REPORT

Page 41: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

Is the docker image compliant?

Is the docker image patched?

Is the docker container

compliant?

Is the docker container patched?

USE CASE #3: Containers

Page 42: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

INSTALL# install oscap-docker yum install openscap-utils

# install docker subscription-manager repos --enable=rhel-7-server-extras-rpms subscription-manager repos --enable=rhel-7-server-optional-rpms yum install openscap-scanner docker systemctl stop firewalld.service systemctl disable firewalld.service systemctl start docker.service systemctl enable docker.service

# get RHEL6.2 docker image docker pull docker.io/richxsl/rhel6.2

Page 43: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

# Compliance Scan oscap-docker image docker.io/richxsl/rhel6.2 xccdf eval --profile xccdf_org.ssgproject.content_profile_rht-ccp \

/usr/share/xml/scap/ssg/content/ssg-rhel6-ds.xml # Vulnerability Scan on RHEL 6.2 image oscap-docker image-cve docker.io/richxsl/rhel6.2 --results /var/www/html/image-oval.xml --report /var/www/html/image-rhel62.html

SCAN DOCKER IMAGES (“offline”)

# start a container named myrhel62 docker run --name myrhel62 -it docker.io/richxsl/rhel6.2 /bin/bash # Compliance Scan oscap-docker container myrhel62 xccdf eval --profile xccdf_org.ssgproject.content_profile_rht-ccp \

/usr/share/xml/scap/ssg/content/ssg-rhel6-ds.xml # Vulnerability Scan oscap-docker container-cve docker.io/richxsl/rhel6.2 --results /var/www/html/container-oval.xml --report /var/www/html/container-rhel62.html

DOCKER CONTAINERS (“online”)

Page 44: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the
Page 45: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the
Page 46: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

https://fedorahosted.org/oscap-anaconda-addon

Page 47: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

VS

Without With

64% 99%

Page 48: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the
Page 49: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

49

CONTAINER BEST PRACTICES

• Only run container images from trusted parties

• Container apps should drop privileges

• Host operating system matters

• Apply kernel security fixes

• Do not disable selinux

• Examine container images for security flaws

Page 50: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

RESOURCES

Best Practices RHEL Security Guide

Hardening SELinux

Audit Log syslog / systemd-journald

Identity Management RHEL IdM

Security Blog securityblog.redhat.com

Three Pigs Coloring Book https://t.co/4KH6iSZZ2H

Page 51: A Security State of Mind: Container Security · container security openscap host os server container libs app. the need for speed the acceleration of application delivery for the

THANK YOU!

Chris Van Tuin [email protected]