+ All Categories
Home > Technology > Docker Security - Secure Container Deployment on Linux

Docker Security - Secure Container Deployment on Linux

Date post: 06-Aug-2015
Category:
Upload: michael-boelen
View: 538 times
Download: 1 times
Share this document with a friend
Popular Tags:
48
Docker Security Secure container deployment on Linux openSUSE conference, The Hague, 3 May 2015 Michael Boelen [email protected]
Transcript
Page 1: Docker Security - Secure Container Deployment on Linux

Docker SecuritySecure container deployment on Linux

openSUSE conference, The Hague, 3 May 2015

Michael [email protected]

Page 2: Docker Security - Secure Container Deployment on Linux

Michael Boelen

● Founder of CISOfy

● Security + Open Source○ Rootkit Hunter (malware scan)

○ Lynis (security scan)

● Analysis → Simplify

2

Page 3: Docker Security - Secure Container Deployment on Linux

Docker and Me

● Understanding

● Development

● Using it

3

Page 4: Docker Security - Secure Container Deployment on Linux

Results of Research

● Limited resources● Outdated articles● Conflicting information● Security not important?

Proposal: Let's fix (some of) these issues4

Page 5: Docker Security - Secure Container Deployment on Linux

ProposalSecurity proposals

● Tooling to simplify Linux security → Lynis

● Articles about Docker security → Blog posts

● Provide input to (GitHub) projects → You

● Presentations → In progress

5

Page 6: Docker Security - Secure Container Deployment on Linux

What

● Stabilize the vessel

● Secure containers

6

Page 7: Docker Security - Secure Container Deployment on Linux

How

➔ Benefits

➔ Risks

➔ Defenses

➔ Best Practices

7

Photo credits: imagebase.net

Page 8: Docker Security - Secure Container Deployment on Linux

Why?

Data!

8

Page 9: Docker Security - Secure Container Deployment on Linux

Why Security?

Data!

● Docker + Software = Data Sharing

● Keep it confidential

9

Page 10: Docker Security - Secure Container Deployment on Linux

Warning

From this point on,there might be lies...

10

Page 11: Docker Security - Secure Container Deployment on Linux

Docker Benefits

11

Page 12: Docker Security - Secure Container Deployment on Linux

Primary Benefits

● Flexibility

● Scalability

● Better testing

12

Page 13: Docker Security - Secure Container Deployment on Linux

Segregation

● The art of splitting up things

● The "Holy Grail" of security

● Smaller units = more control

13

Page 14: Docker Security - Secure Container Deployment on Linux

Granular Control

● Limit users, access and data

● Easier to understand

● Easier to defend

14

Page 15: Docker Security - Secure Container Deployment on Linux

Information Disclosure

● Decreased chance of data leakage

● Less resources accessible

15

Page 16: Docker Security - Secure Container Deployment on Linux

Risks

16

Page 17: Docker Security - Secure Container Deployment on Linux

Risk: Software Issues

Software security● Bugs● Security vulnerabilities● Regular updates needed● Backdoors? Auditing?

17

Page 18: Docker Security - Secure Container Deployment on Linux

Risk: Knowledge gap

Quickly evolving● IT auditor● Your colleagues● You...?

18

Page 19: Docker Security - Secure Container Deployment on Linux

Risk: "Does not contain"

No full isolation (yet)● Treat containers as a host● Know strengths and weaknesses

19

Page 20: Docker Security - Secure Container Deployment on Linux

Defenses

20

Page 21: Docker Security - Secure Container Deployment on Linux

Docker Website

Start at the download● HTTPS● Digital signatures● Images verified after downloading

21

Page 22: Docker Security - Secure Container Deployment on Linux

Docker Containers

● Namespaces and cgroups

● Seccomp

● Capabilities

● Frameworks

22

Page 23: Docker Security - Secure Container Deployment on Linux

Namespaces

Isolates parts of the OS● PID namespaces● Network namespaces● User namespaces → Not really!

23

Page 24: Docker Security - Secure Container Deployment on Linux

Namespaces

More spaces● IPC namespaces (process communication)● UTS namespaces (hostname/NIS)● Mount namespaces

24

Page 25: Docker Security - Secure Container Deployment on Linux

Seccomp

● Secure computing mode● Filters syscalls with BPF● Isolation, not virtualization● Used in software like:

○ Chrome, OpenSSH, vsftpd○ LXD and Mbox

25

Page 26: Docker Security - Secure Container Deployment on Linux

Seccomp

Default list of blocked calls● kexec_load● open_by_handle_at● init_module● finit_module● delete_module

26

Page 27: Docker Security - Secure Container Deployment on Linux

Control Groups (cgroups)

● Restrict resources

● Prioritize

● Accounting

● Control

27

Page 28: Docker Security - Secure Container Deployment on Linux

Capabilities

● Root user → split into roles

● Default list of allowed capabilities

● --cap-add / --cap-drop

● Combine (e.g. add all, drop a few)

28

Page 29: Docker Security - Secure Container Deployment on Linux

Capabilities

Examples● CAP_NET_ADMIN - Configure networking● CAP_SETPCAP - Process capabilities● CAP_SYS_MODULE - Insert and remove

kernel modules

29

Page 30: Docker Security - Secure Container Deployment on Linux

Frameworks

AppArmor / SELinux● MAC frameworks● Help with containment● Learning them now, will pay off later

30

Page 31: Docker Security - Secure Container Deployment on Linux

Audit Subsystem

● Developed by Red Hat● Files / system calls● Monitors the (system | file) integrity

31

Page 32: Docker Security - Secure Container Deployment on Linux

AuditingAudit (example)# Time related calls-a always,exit -S adjtimex -S settimeofday -S stime -k time-change-a always,exit -S clock_settime -k time-change# Hostname and domain-a always,exit -S sethostname -S setdomainname -k system-locale

# Password files-w /etc/group -p wa -k identity-w /etc/passwd -p wa -k identity-w /etc/shadow -p wa -k identity-w /etc/sudoers -p wa -k identity

32

Page 33: Docker Security - Secure Container Deployment on Linux

Best Practices

33

Page 34: Docker Security - Secure Container Deployment on Linux

Docker Host Hardening 1/2

● Security = Defense in Depth

● Use AppArmor / SELinux / GRSEC

● Limit○ users / services / network

34

Page 35: Docker Security - Secure Container Deployment on Linux

Docker Host Hardening 2/2

● Update your kernel on a regular basis

● Stay up-to-date with Docker

● Limit Docker permissions

35

Page 36: Docker Security - Secure Container Deployment on Linux

Containers

Harden your Containers● Use AppArmor / SELinux● Drop capabilities (man capabilities)● Filter syscalls (seccomp)● Network filtering (iptables)

36

Page 37: Docker Security - Secure Container Deployment on Linux

Read-Only Containers

Least amount of privileges● Docker 1.5● --read-only● Restrict writing to volumes

37

Page 38: Docker Security - Secure Container Deployment on Linux

Logging

Don't let containers be a black box● Docker 1.6● --log-driver

○ none○ syslog○ json-file

38

Page 39: Docker Security - Secure Container Deployment on Linux

Limit Resources

Ulimit● Default too high● Set new container default

○ Docker 1.6○ --default-ulimit

● On run: --ulimit

39

Page 40: Docker Security - Secure Container Deployment on Linux

Docker Management

"Invisibilize"● Encrypt connections● Configure and use TLS, set variables:

○ DOCKER_HOST○ DOCKER_TLS_VERIFY

40

Page 41: Docker Security - Secure Container Deployment on Linux

Docker Management

SSH in containers● Don't use this..● Use “docker exec -it mycontainer bash”

41

Page 42: Docker Security - Secure Container Deployment on Linux

Read-Only

● Mounts● Data● Configuration● Use --read-only

42

Page 43: Docker Security - Secure Container Deployment on Linux

Using Mappings

● Map users to non-privileged○ /etc/subuid○ /etc/subgid

43

Page 44: Docker Security - Secure Container Deployment on Linux

Trust

Or Don't...● Verify downloads● Be careful with images from others● Measure, monitor, audit

44

Page 45: Docker Security - Secure Container Deployment on Linux

Auditing

Tools● Lynis● OpenSCAP

45

Page 46: Docker Security - Secure Container Deployment on Linux

Docker News

Things go quick with Docker● Stay informed● Follow the Docker blog● Keep an eye on Docker (/LXC/LXD) news

46

Page 47: Docker Security - Secure Container Deployment on Linux

Questions?

47

Page 48: Docker Security - Secure Container Deployment on Linux

More Docker Security

● Blog: linux-audit.com

● Twitter: @mboelen

48


Recommended