17
Container Security So Many Options, Use Them All! Sally O’Malley @somalley108 Urvashi Mohnani @umohnani8

Container Security - OpenShift

  • Upload
    others

  • View
    29

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Container Security - OpenShift

Container SecuritySo Many Options, Use Them All!

Sally O’Malley @somalley108Urvashi Mohnani @umohnani8

Page 2: Container Security - OpenShift

Red Hat2

● Container Image (packaging)

● Container Runtime (launching)

● OCI: Any image can run on any runtime

Open Container Initiative!

Page 3: Container Security - OpenShift

Red Hat

Normal Linux processes with...

● Constrained Resources - cgroups

● Isolation - namespaces

● Extra Security - SELinux, Seccomp, Capabilities

What are Containers?

3

Page 4: Container Security - OpenShift

Red Hat

What are Container Images?

4

● Base layer: rootfs + json file description

● Additional layers: packages + updated json file

● Tarball of above

Page 5: Container Security - OpenShift

Red Hat

What do Container Engines do?

5

● Reassembles rootfs from the layers in the image

onto local disk (COW)

● Creates a container runtime config

● Launches a container runtime (runc)

Page 6: Container Security - OpenShift

Red Hat

● Build

● Run & Develop locally

● Store/Share

● Run in a Production Cluster

When working with containers...

6

Page 7: Container Security - OpenShift

Red Hat

Design programs to do a single thing, but to do it well, and to work well with other programs.

~ http://www.linfo.org/unix_philosophy.html

Unix Philosophy

7

Ken Thompson and Dennis Ritchie

Douglas McIlroy Unix Founders

Page 8: Container Security - OpenShift

Red Hat

● Build - buildah

● Run & Develop locally - podman

● Store/Share - skopeo

● Run in a Production Cluster - CRI-O

When working with containers...

8

Page 9: Container Security - OpenShift

Red Hat9

● Shrink attack surface with minimal images

● Run builds isolated in a container

● Run without root

Build Securely

Page 10: Container Security - OpenShift

Red Hat10

Give Me Demos!(offering of cheetos and Mtn. Dew to Demo Gods)

Page 11: Container Security - OpenShift

Red Hat11

● Run without root

● Isolate with user namespaces

● Audit who runs what

● #nobigfatdaemons

Run & Develop Securely

Page 12: Container Security - OpenShift

Red Hat

skopeo

12

● Inspect Remote Images

● Move images between environments

● Run without root

Share Securely

Page 13: Container Security - OpenShift

Red Hat13

● Read-only container filesystem

● Enable fewer capabilities

● User namespaces (coming soon in Kubernetes)

● FIPS mode support

Run Securely in a Production Cluster

Page 14: Container Security - OpenShift

Red Hat14

Seriously, use all these Security Features in your Linux Containers.

Every time you don’t do so, you make Dan Walsh Weep.

Dan is a nice guy and he certainly doesn’t deserve that.

Page 15: Container Security - OpenShift

Red Hat15

CVE-2019-5736With a compromised image or environment, processes can “escape” and execute programs on the host, by overwriting runc.

Oh No!!This affects all container engines (CRI-O, Docker, Containerd, Buildah, Podman) that use runc container runtime.

Page 16: Container Security - OpenShift

Red Hat16

● Don’t run random images off the internet

● Run containers as non-root (default in OpenShift)Or, when possible, run containers with user namespaces

● Do run SELinux in enforcing mode setenforce 1runc file label: container_runtime_exec_tcontainer processes SELinux type: container_tcontainer_t types can only write to files labeled container_file_t.container_file_t != container_runtime_exec_t

Good News!! You can easily avoid this, and other future vulnerabilities with the following:

Page 17: Container Security - OpenShift

Red Hat

Questions?

17

Resources

CRI-O: cri-o.io

Buildah: buildah.io

Podman: podman.io

Skopeo: https://github.com/containers/skopeo

Coloring Book: https://github.com/mairin/coloringbook-container-commandos/blob/master/Web.pdf

Demo Script: https://github.com/containers/Demos/tree/master/security