Slide 1

Slide 1 text

Gareth Rushgrove What’s inside that container? (redux)

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

@garethr

Slide 4

Slide 4 text

This talk What is this all about?

Slide 5

Slide 5 text

- Some research - Some tools - Some live demos

Slide 6

Slide 6 text

- Some research into container usage - Some tools for container analysis - Some live demos of said tools

Slide 7

Slide 7 text

Setting the scene Some background

Slide 8

Slide 8 text

Configuration management camp talk

Slide 9

Slide 9 text

The New Stack coverage

Slide 10

Slide 10 text

Caveat, this data is from February

Slide 11

Slide 11 text

Let’s grab downloads from Hub $ curl -s https://registry.hub.docker.com/v2/... ...repositories/library/ubuntu/ | jq .pull_count

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

What about other popular official images? Node (32,523,647), Java (16,635,049), etc. Currently based on Debian too

Slide 14

Slide 14 text

A quick non-scientific poll

Slide 15

Slide 15 text

Data from GitHub and Google bigquery

Slide 16

Slide 16 text

The majority of people using Docker are using images containing an entire operating system filesystem

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

Scratch, or other approaches like Nix, appear to occupy a small niche

Slide 19

Slide 19 text

Alpine usage is growing more rapidly than others, but starting from a much smaller install base

Slide 20

Slide 20 text

Why does this matter?

Slide 21

Slide 21 text

Images vary in size

Slide 22

Slide 22 text

Count files on images $ find -maxdepth 1 -type d | while read -r dir; do printf "%s:\t" "$dir"; find "$dir" -type f | wc -l; done

Slide 23

Slide 23 text

Count packages in images $ dpkg -l | grep ^ii | wc -l $ dnf list installed $ rpm -qa | wc -l $ apk info | wc -l

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

Can you tell me all the versions of OpenSSL you have in production right now?

Slide 26

Slide 26 text

You mentioned tools Anything that can help with these problems?

Slide 27

Slide 27 text

Option 1: Rebuild everything

Slide 28

Slide 28 text

Option 2: Something messier

Slide 29

Slide 29 text

Skopeo from Red Hat

Slide 30

Slide 30 text

Query registry data without downloading the image $ skopeo inspect docker://docker.io/fedora

Slide 31

Slide 31 text

$ skopeo inspect docker://docker.io/fedora { "Name": "docker.io/library/fedora", "Tag": "latest", "Digest": "sha256:cfd8f0466748f522406f7ae5908d002af1b1a1", "RepoTags": [ "20", "21", "22", "23", "heisenbug", "latest", "rawhide" ],

Slide 32

Slide 32 text

But what about running containers? Or the contents of the image?

Slide 33

Slide 33 text

Lumogon

Slide 34

Slide 34 text

Open source and on GitHub

Slide 35

Slide 35 text

Get package and version information (and more) from Docker containers with: $ lumogon scan

Slide 36

Slide 36 text

$ lumogon scan {"$schema":"http://puppet.com/lumogon/core/draft-01/schema#1 ","generated":"2017-08-07 11:35:16.6517922 +0000 UTC","owner":"default","group":["default"],"client_version": {"BuildVersion":"development","BuildTime":"2017-05-11 08:24:20 UTC","BuildSHA":"a7f2943697f83ba74514a0169890ecf8ad1cfacb"}, "reportid":"c6a8731e-9681-4758-9151-9c2699769418","container s":{"8c8024760f3e4692e93c6f4f76dc56eaab879e56ace06f876afeccc 5c615ac28":{"$schema":"http://puppet.com/lumogon/containerre port/draft-01/schema#1","generated":"2017-08-07 11:35:16.1308581 +0000 UTC","container_report_id":"2e65f6e7-371d-4bae-9336-85b14b0b 19c0","container_id":"8c8024760f3e4692e93c6f4f76dc56eaab879e 56ace06f876afeccc5c615ac28","container_name":"/p

Slide 37

Slide 37 text

- Packages (rpm, apk, dpkg) - Host info (eg. linux distro) - Labels and other metadata - Extensible with new capabilities

Slide 38

Slide 38 text

How we have all the data, what can we do with it?

Slide 39

Slide 39 text

List all the debian containers $ lumogon scan | jq -r '.containers[] | select(.capabilities.host.payload.platformfamily == "debian") | .container_name'

Slide 40

Slide 40 text

$ lumogon scan | jq -r '.containers[] | .container_name + " " + .capabilities.dpkg.payload.bash + " " + .capabilities.rpm.payload.bash' /fixtures_debian-jessie_1 4.3-11+deb8u1 /fixtures_centos7_1 4.2.46-21.el7_3-x86_64 /fixtures_fedora_1 4.3.43-4.fc25-x86_64 /fixtures_debian-wheezy_1 4.2+dfsg-0.1+deb7u4 /fixtures_ubuntu-xenial_1 4.3-14ubuntu1.1 List versions of bash in all my containers

Slide 41

Slide 41 text

A hack for finding packages with CVEs

Slide 42

Slide 42 text

Query our list of package for known CVEs $ lumogon scan | findcve lumogon

Slide 43

Slide 43 text

$ lumogon scan | findcve lumogon ==> Scanning /peaceful_goldberg apt has vulnerabilities Currently installed 1.0.9.8.4 Latest version 1.0.9.8.4 CVE-2011-3374 is unimportant bash has vulnerabilities Currently installed 4.3-11+deb8u1 Latest version 4.3-11+deb8u1 CVE-2016-9401 is low** TEMP-0841856-B18BAF is unimportant coreutils has vulnerabilities Currently installed 8.23-4 Latest version 8.23-4 CVE-2016-2781 is low** dpkg has vulnerabilities

Slide 44

Slide 44 text

Manifesto from Aqua Security

Slide 45

Slide 45 text

Store and query metadata about Docker images, stored alongside the image on Hub

Slide 46

Slide 46 text

Save Lumogon data with manifesto $ ./scan-image.sh > /tmp/lumogon.json $ manifesto put lumogon /tmp/lumogon.json

Slide 47

Slide 47 text

See what manifesto data is available for our image $ manifesto list puppet/puppet-agent Metadata types stored for image 'puppet/puppet-agent:latest': lumogon

Slide 48

Slide 48 text

$ manifesto get puppet/puppet-agent lumogon | head -n 10 { "$schema": "http://puppet.com/lumogon/core/draft-01/schema#1", "generated": "2017-07-26 16:25:19.858671545 +0000 UTC", "owner": "default", "group": [ "default" ], "client_version": { "BuildVersion": "20170612091728-", "BuildTime": "2017-06-12 08:17:28 UTC",

Slide 49

Slide 49 text

Blog post with more examples

Slide 50

Slide 50 text

Live demo klaxon

Slide 51

Slide 51 text

Summary If all you remember is...

Slide 52

Slide 52 text

Container adoption needs to be a gentle slope, not a base jump with a parachute marked experimental

Slide 53

Slide 53 text

The real world is messier than the cloud native ideal

Slide 54

Slide 54 text

We need to consider the situation where we are running unknown artefacts

Slide 55

Slide 55 text

Small, composable tools point us to higher-level, more comprehensive, solutions

Slide 56

Slide 56 text

I heartily recommend finding out what’s inside your containers

Slide 57

Slide 57 text

Any questions? And thanks for listening