Least-privilege Microservices7u2psl.com5.z0.glb.qiniucdn.com/dockercon/Docker Security...‣Docker...

22
Least-privilege Microservices Diogo Mónica Nathan McCauley

Transcript of Least-privilege Microservices7u2psl.com5.z0.glb.qiniucdn.com/dockercon/Docker Security...‣Docker...

Page 1: Least-privilege Microservices7u2psl.com5.z0.glb.qiniucdn.com/dockercon/Docker Security...‣Docker is on the path to support least-privilege microservices, since it allows fine-grained

Least-privilege Microservices

Diogo Mónica Nathan McCauley

Page 2: Least-privilege Microservices7u2psl.com5.z0.glb.qiniucdn.com/dockercon/Docker Security...‣Docker is on the path to support least-privilege microservices, since it allows fine-grained

Agenda

• Why least-privilege

• History of least-privilege

• Least-privilege with Docker

• Ongoing and future work

• Conclusions

Page 3: Least-privilege Microservices7u2psl.com5.z0.glb.qiniucdn.com/dockercon/Docker Security...‣Docker is on the path to support least-privilege microservices, since it allows fine-grained

“Every process must be able to access only the information and resources that are necessary for its legitimate purpose”

Page 4: Least-privilege Microservices7u2psl.com5.z0.glb.qiniucdn.com/dockercon/Docker Security...‣Docker is on the path to support least-privilege microservices, since it allows fine-grained

Front-endServer

Database

Auth Service

Page 5: Least-privilege Microservices7u2psl.com5.z0.glb.qiniucdn.com/dockercon/Docker Security...‣Docker is on the path to support least-privilege microservices, since it allows fine-grained

1990

Internet

All-in-one

Page 6: Least-privilege Microservices7u2psl.com5.z0.glb.qiniucdn.com/dockercon/Docker Security...‣Docker is on the path to support least-privilege microservices, since it allows fine-grained

2000

Internet

DatabasesServicesFront-end

Page 7: Least-privilege Microservices7u2psl.com5.z0.glb.qiniucdn.com/dockercon/Docker Security...‣Docker is on the path to support least-privilege microservices, since it allows fine-grained

2010

Internet

Page 8: Least-privilege Microservices7u2psl.com5.z0.glb.qiniucdn.com/dockercon/Docker Security...‣Docker is on the path to support least-privilege microservices, since it allows fine-grained
Page 9: Least-privilege Microservices7u2psl.com5.z0.glb.qiniucdn.com/dockercon/Docker Security...‣Docker is on the path to support least-privilege microservices, since it allows fine-grained

Server

Host OS

Docker Engine

App A

App B

App C

App D

App E

App F

libraries

Container

One Process

Page 10: Least-privilege Microservices7u2psl.com5.z0.glb.qiniucdn.com/dockercon/Docker Security...‣Docker is on the path to support least-privilege microservices, since it allows fine-grained

Today

Internet

Page 11: Least-privilege Microservices7u2psl.com5.z0.glb.qiniucdn.com/dockercon/Docker Security...‣Docker is on the path to support least-privilege microservices, since it allows fine-grained

‣A FE server has a very different security profile than a database or a worker host

‣ Imagine that each container only has access exactly to the resources and APIs it needs. No more, no less.

Front-end Server Back-end Server

‣Access to a lot of downstream services ‣Most exposed

‣ I/O intensive ‣Limited network access

Worker Host

‣CPU Intensive ‣Wide range of workloads

Profiles

Page 12: Least-privilege Microservices7u2psl.com5.z0.glb.qiniucdn.com/dockercon/Docker Security...‣Docker is on the path to support least-privilege microservices, since it allows fine-grained

‣A container is a process. Let’s find out what syscalls it needs.

Process Monitoring

Page 13: Least-privilege Microservices7u2psl.com5.z0.glb.qiniucdn.com/dockercon/Docker Security...‣Docker is on the path to support least-privilege microservices, since it allows fine-grained

‣Namespaces provide an isolated view of the system (Network, PID, etc)

‣Cgroups limit and isolate the resource usage of a collection of processes

‣Linux Security Modules give us a MAC (AppArmor, SELinux)

Fine-grained controls

Page 14: Least-privilege Microservices7u2psl.com5.z0.glb.qiniucdn.com/dockercon/Docker Security...‣Docker is on the path to support least-privilege microservices, since it allows fine-grained

Fine-grained controls‣Capabilities divides the privileges of root into distinct units (bind, chown, etc)

‣Per-container ulimit (since 1.6)

‣User-namespaces: root inside is not root outside (remapped root for 1.8)

‣Seccomp: Individual syscall filtering (working on my laptop)

Page 15: Least-privilege Microservices7u2psl.com5.z0.glb.qiniucdn.com/dockercon/Docker Security...‣Docker is on the path to support least-privilege microservices, since it allows fine-grained

Safer by default

‣Less than half the Linux capabilities by default

‣Copy-on-write ensures immutability

‣No device access by default

‣Default AppArmor and SELinux profiles for an increasing number of containers

Page 16: Least-privilege Microservices7u2psl.com5.z0.glb.qiniucdn.com/dockercon/Docker Security...‣Docker is on the path to support least-privilege microservices, since it allows fine-grained

Safer by default

‣Smaller footprint

‣Remove all unneeded packages

‣Remove all unneeded users

‣Remove all suid binaries

Debian

Page 17: Least-privilege Microservices7u2psl.com5.z0.glb.qiniucdn.com/dockercon/Docker Security...‣Docker is on the path to support least-privilege microservices, since it allows fine-grained

Security Profiles

Debian

‣Producers of containers should be responsible for creating adequate profiles

‣Profile gets shipped with the container

‣Aggregates all of the different isolation mechanisms into one single profile

Page 18: Least-privilege Microservices7u2psl.com5.z0.glb.qiniucdn.com/dockercon/Docker Security...‣Docker is on the path to support least-privilege microservices, since it allows fine-grained

Securing the Ecosystem

Debian

User-namespaces Seccomp Provenance

Selinux Kerberos

Page 19: Least-privilege Microservices7u2psl.com5.z0.glb.qiniucdn.com/dockercon/Docker Security...‣Docker is on the path to support least-privilege microservices, since it allows fine-grained

Intro to Container Security

Debian

http://bit.ly/1M4O9XE

Page 20: Least-privilege Microservices7u2psl.com5.z0.glb.qiniucdn.com/dockercon/Docker Security...‣Docker is on the path to support least-privilege microservices, since it allows fine-grained

Docker Bench

Debian

https://dockerbench.com/

‣Fully automated

‣Shipped as a container that tests containers

Page 21: Least-privilege Microservices7u2psl.com5.z0.glb.qiniucdn.com/dockercon/Docker Security...‣Docker is on the path to support least-privilege microservices, since it allows fine-grained

Conclusion

‣Docker is on the path to support least-privilege microservices, since it allows fine-grained control over what access each container should have.

‣We will need easier tooling to define per-container security profiles

‣You can help!

#docker-security on Freenode