SlideShare a Scribd company logo
Ten Container Security Tricks
That Will Help You Sleep At Night
Justin Cormack
Who am I?
Engineer at Docker in Cambridge, UK. Background both dev and ops.
Work on many projects
• maintainer on moby/moby formerly docker/docker
• tech lead on LinuxKit
• containerD
• runC
• Docker for Mac
• security pieces for engine eg seccomp policies etc
2
Cambridge
Tech village in England
3
You want to sleep soundly?
Justin Cormack - The 10 Container Security Tricks That Will Help You Sleep At Night - Codemotion Milan 2017
Ten things?
There are going to be a couple more than ten things here...
So you could try to do at least ten!
Or at least one!
6
Containers do make security a little easier
• Identifiability – what did I ship?
• Reproducibility – can I ship it again?
• Consistency – can I build it again?
• Agility – can I do all this quickly?
• Usability – can I do it easily?
At Docker we have always tried to ship sensible security defaults that just
work for most cases.
7
Start with the whole team
No silos
• DevSecOps
• Teams working together to deliver quality software
• Security as an ongoing process not checkboxes
• Ongoing improvements and learning, not blame culture
• More rapid deployment of good practise across all software
9
Teamwork
• Embed security people in your teams. They need to understand what
your product is doing too.
• If your company is too small to have dedicated security people, assign
someone to be responsible for security in each project and learn!
• Make sure all the team understands the threat model from the start,
and the key risks
• Postmortems when things go wrong, not to blame, but to improve
10
four things you can do in development
Don't use privileged and capabilities
• docker run --privileged gives you total control over the machine
• adding just a few capabilities and security options does the same
• don't use setuid code in containers, disable with
--security-opt=no-new-privileges
• run as a non root user or use user namespaces if possible
• don't bind the Docker socket into a container
Very rarely you may need to do some of these things, eg for some
debugging, but these use cases are exceptional.
12
Use read only images
• docker run --read-only ...
• nothing can be modified in the container root filesystem
• understand exactly what configuration is expected
Sometimes images don't work, please file an issue.
13
Use official images where possible
• the official images are well designed
• they are updated for security issues
• they use best practises for the software being packaged
• they are well tested
• minimal
• they use modern OS versions, use alpine or stretch
If there isn't one try to work with upstream project and read the
guidelines https://github.com/docker-library/official-images
14
Use the secrets API
• Do not check secrets into git
• Do not put secrets in environment variables
• Use the docker secrets API docker secret create
• Or the Kubernetes API kubectl create secret
• Or Vault from Hashicorp
15
Dev and Ops as a team
Always be updating
• Automated build pipeline
• Constantly be updating base images with security fixes
• Update your other dependencies
• the longer you leave updates the harder they become
17
Use an image scanning service
18
Don't try to keep containers running forever
• It is not a competition!
• The more often you update the harder it is for attackers
• Plus you get the security updates sooner
• Continuous delivery means you get small code
improvements out faster
• Always be updating!
19
Sign your containers
• Once you have automated builds you can start signing
• Guarantee that processes have been followed
• Can use for automated promotion of images
• Official images already signed, check them
• new easier commands
– docker trust view
– docker trust sign
– docker trust revoke
20
Operations
Use a minimal underlying OS
“Use container-specific OSes instead of general-purpose ones to reduce
attack surfaces. When using a container-specific OS, attack surfaces
are typically much smaller than they would be with a general-purpose
OS, so there are fewer opportunities to attack and compromise a
container-specific OS.”
NIST Application Container Security Guide
http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-190.pdf
Failing that, at least make sure the OS is updated.
22
Advanced
Fuzz test
24
Test based on your code
• eg for web based code look for XSS vulnerabilities
• look at your code like an attacker
• don't just look at the "happy path"
Always use static analysis tools, eg linters. As many as possible... Many of
the things they find will not be security issues, but a few may be.
25
Work together
THANK YOU

More Related Content

PDF
Jacopo Nardiello - Monitoring Cloud-Native applications with Prometheus - Cod...
PDF
Docker for Ops - Scott Coulton, Puppet
PDF
DockerCon SF 2015: Docker Security
PDF
Building a Secure App with Docker - Ying Li and David Lawrence, Docker
PDF
Docker and kernel security
PDF
Docker Security - Secure Container Deployment on Linux
PDF
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
PDF
Docker for Devs - John Zaccone, IBM
Jacopo Nardiello - Monitoring Cloud-Native applications with Prometheus - Cod...
Docker for Ops - Scott Coulton, Puppet
DockerCon SF 2015: Docker Security
Building a Secure App with Docker - Ying Li and David Lawrence, Docker
Docker and kernel security
Docker Security - Secure Container Deployment on Linux
From Arm to Z: Building, Shipping, and Running a Multi-platform Docker Swarm ...
Docker for Devs - John Zaccone, IBM

What's hot (20)

PDF
Global Operations with Docker for the Enterprise - Nico Kabar, Docker
PDF
Android Meets Docker
DOCX
Build Your Own SaaS using Docker
PDF
OSCON: Unikernels and Docker: From revolution to evolution
PDF
You Don't Have to Start Over! A Practical Guide for Adopting Docker in the En...
PDF
Turbocharged Java with Quarkus | JakartaOne Livestream
PDF
Containers & Security
PDF
Advanced Docker Developer Workflows on MacOS X and Windows
PDF
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
PDF
Effective Data Pipelines with Docker & Jenkins - Brian Donaldson
PPTX
Docker Meetup 08 03-2016
PDF
KubeCon EU 2016: Killing containers to make weather beautiful
PPTX
How to be successful running Docker in Production
PDF
Modernizing .NET Apps
PDF
Continuous Security in DevOps
PDF
PaaSTA: Running applications at Yelp
PDF
Journey to Docker Production: Evolving Your Infrastructure and Processes - Br...
PPSX
Oded Coster - Stack Overflow behind the scenes - how it's made - Codemotion M...
PDF
Securing the Container Pipeline at Salesforce by Cem Gurkok
PDF
Sharding Containers: Make Go Apps Computer-Friendly Again by Andrey Sibiryov
Global Operations with Docker for the Enterprise - Nico Kabar, Docker
Android Meets Docker
Build Your Own SaaS using Docker
OSCON: Unikernels and Docker: From revolution to evolution
You Don't Have to Start Over! A Practical Guide for Adopting Docker in the En...
Turbocharged Java with Quarkus | JakartaOne Livestream
Containers & Security
Advanced Docker Developer Workflows on MacOS X and Windows
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
Effective Data Pipelines with Docker & Jenkins - Brian Donaldson
Docker Meetup 08 03-2016
KubeCon EU 2016: Killing containers to make weather beautiful
How to be successful running Docker in Production
Modernizing .NET Apps
Continuous Security in DevOps
PaaSTA: Running applications at Yelp
Journey to Docker Production: Evolving Your Infrastructure and Processes - Br...
Oded Coster - Stack Overflow behind the scenes - how it's made - Codemotion M...
Securing the Container Pipeline at Salesforce by Cem Gurkok
Sharding Containers: Make Go Apps Computer-Friendly Again by Andrey Sibiryov
Ad

Viewers also liked (20)

PDF
Veer's Container Security
PDF
Bad for Enterprise: Attacking BYOD enterprise mobility security solutions
PDF
Practical Approaches to Container Security
PDF
Docker London: Container Security
PDF
Composable architectures The Lego of IT - Alessandro David
PDF
Mobile UX for user engagement and monetization - Emilia Ciardi - Codemotion R...
PPTX
Francesco Arcieri - La monetizzazione delle API - Codemotion Milan 2017
PPTX
Dark patterns and mobile UX design - Emilia Ciardi - Codemotion Amsterdam 2017
PDF
Tomer Elmalem - GraphQL APIs: REST in Peace - Codemotion Milan 2017
PDF
From Doctor to Coder: A Whole New World? - Aisha Sie - Codemotion Amsterdam 2017
PDF
Downtime is not an option - day 2 operations - Jörg Schad
PDF
Webinar - Matteo Manchi: Dal web al nativo: Introduzione a React Native
PDF
Yan Cui - Serverless in production, an experience report - Codemotion Milan 2017
PDF
Diego Viganò - Milano Chatbots Meetup - Codemotion Milan 2017
PDF
Nicola Corti/Valentina Mazzoni - GDG Italia Meetup - Codemotion Milan 2017
PDF
Tomas Petricek - The Gamma: Democratizing data science - Codemotion Milan 2017
PDF
Alison B Lowndes - Fueling the Artificial Intelligence Revolution with Gaming...
PDF
Lorna Mitchell - Becoming Polyglot - Codemotion Milan 2017
PDF
Agnieszka Naplocha - Breaking the norm with creative CSS - Codemotion Milan 2017
PDF
Andrea Maietta - Il fascino della supercazzola: un breve viaggio nel mondo de...
Veer's Container Security
Bad for Enterprise: Attacking BYOD enterprise mobility security solutions
Practical Approaches to Container Security
Docker London: Container Security
Composable architectures The Lego of IT - Alessandro David
Mobile UX for user engagement and monetization - Emilia Ciardi - Codemotion R...
Francesco Arcieri - La monetizzazione delle API - Codemotion Milan 2017
Dark patterns and mobile UX design - Emilia Ciardi - Codemotion Amsterdam 2017
Tomer Elmalem - GraphQL APIs: REST in Peace - Codemotion Milan 2017
From Doctor to Coder: A Whole New World? - Aisha Sie - Codemotion Amsterdam 2017
Downtime is not an option - day 2 operations - Jörg Schad
Webinar - Matteo Manchi: Dal web al nativo: Introduzione a React Native
Yan Cui - Serverless in production, an experience report - Codemotion Milan 2017
Diego Viganò - Milano Chatbots Meetup - Codemotion Milan 2017
Nicola Corti/Valentina Mazzoni - GDG Italia Meetup - Codemotion Milan 2017
Tomas Petricek - The Gamma: Democratizing data science - Codemotion Milan 2017
Alison B Lowndes - Fueling the Artificial Intelligence Revolution with Gaming...
Lorna Mitchell - Becoming Polyglot - Codemotion Milan 2017
Agnieszka Naplocha - Breaking the norm with creative CSS - Codemotion Milan 2017
Andrea Maietta - Il fascino della supercazzola: un breve viaggio nel mondo de...
Ad

Similar to Justin Cormack - The 10 Container Security Tricks That Will Help You Sleep At Night - Codemotion Milan 2017 (20)

PDF
Why should developers care about container security?
PDF
Why Should Developers Care About Container Security?
PDF
ATO 2022 - Why should devs care about container security.pdf
PDF
Container Stranger Danger - Why should devs care about container security
PDF
Python Web Conference 2022 - Why should devs care about container security.pdf
PDF
KubeHuddle NA 2023 - Why should devs care about container security - Eric Sma...
PDF
How secure is your Docker Container pipeline?
PDF
GDG SLK - Why should devs care about container security.pdf
PPTX
"Docker best practice", Станислав Коленкин (senior devops, DataArt)
PDF
Santander DevopsandCloudDays 2021 - Hardening containers.pdf
PDF
VASCAN - Docker and Security
PDF
Hacking into your containers, and how to stop it!
PDF
BSides SF talk on Docker Images Security - Feb 13, 2017
PDF
Breaking and fixing_your_dockerized_environments_owasp_appsec_usa2016
PDF
Container Security
PDF
DockerCon SF 2015: Faster, Cheaper, Safer
PDF
Ten layers of container security for CloudCamp Nov 2017
PPTX
Containers and workload security an overview
PDF
Docker Best Practices Workshop
PDF
AWS Community Day - Vitaliy Shtym - Pragmatic Container Security
Why should developers care about container security?
Why Should Developers Care About Container Security?
ATO 2022 - Why should devs care about container security.pdf
Container Stranger Danger - Why should devs care about container security
Python Web Conference 2022 - Why should devs care about container security.pdf
KubeHuddle NA 2023 - Why should devs care about container security - Eric Sma...
How secure is your Docker Container pipeline?
GDG SLK - Why should devs care about container security.pdf
"Docker best practice", Станислав Коленкин (senior devops, DataArt)
Santander DevopsandCloudDays 2021 - Hardening containers.pdf
VASCAN - Docker and Security
Hacking into your containers, and how to stop it!
BSides SF talk on Docker Images Security - Feb 13, 2017
Breaking and fixing_your_dockerized_environments_owasp_appsec_usa2016
Container Security
DockerCon SF 2015: Faster, Cheaper, Safer
Ten layers of container security for CloudCamp Nov 2017
Containers and workload security an overview
Docker Best Practices Workshop
AWS Community Day - Vitaliy Shtym - Pragmatic Container Security

More from Codemotion (20)

PDF
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
PDF
Pompili - From hero to_zero: The FatalNoise neverending story
PPTX
Pastore - Commodore 65 - La storia
PPTX
Pennisi - Essere Richard Altwasser
PPTX
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
PPTX
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
PPTX
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
PPTX
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
PDF
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
PDF
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
PDF
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
PDF
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
PDF
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
PDF
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
PPTX
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
PPTX
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
PDF
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
PDF
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
PDF
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
PDF
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019
Fuzz-testing: A hacker's approach to making your code more secure | Pascal Ze...
Pompili - From hero to_zero: The FatalNoise neverending story
Pastore - Commodore 65 - La storia
Pennisi - Essere Richard Altwasser
Michel Schudel - Let's build a blockchain... in 40 minutes! - Codemotion Amst...
Richard Süselbeck - Building your own ride share app - Codemotion Amsterdam 2019
Eward Driehuis - What we learned from 20.000 attacks - Codemotion Amsterdam 2019
Francesco Baldassarri - Deliver Data at Scale - Codemotion Amsterdam 2019 -
Martin Förtsch, Thomas Endres - Stereoscopic Style Transfer AI - Codemotion A...
Melanie Rieback, Klaus Kursawe - Blockchain Security: Melting the "Silver Bul...
Angelo van der Sijpt - How well do you know your network stack? - Codemotion ...
Lars Wolff - Performance Testing for DevOps in the Cloud - Codemotion Amsterd...
Sascha Wolter - Conversational AI Demystified - Codemotion Amsterdam 2019
Michele Tonutti - Scaling is caring - Codemotion Amsterdam 2019
Pat Hermens - From 100 to 1,000+ deployments a day - Codemotion Amsterdam 2019
James Birnie - Using Many Worlds of Compute Power with Quantum - Codemotion A...
Don Goodman-Wilson - Chinese food, motor scooters, and open source developmen...
Pieter Omvlee - The story behind Sketch - Codemotion Amsterdam 2019
Dave Farley - Taking Back “Software Engineering” - Codemotion Amsterdam 2019
Joshua Hoffman - Should the CTO be Coding? - Codemotion Amsterdam 2019

Recently uploaded (20)

PPTX
Big Data Technologies - Introduction.pptx
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
Machine learning based COVID-19 study performance prediction
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
Big Data Technologies - Introduction.pptx
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Review of recent advances in non-invasive hemoglobin estimation
Network Security Unit 5.pdf for BCA BBA.
NewMind AI Weekly Chronicles - August'25 Week I
“AI and Expert System Decision Support & Business Intelligence Systems”
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Spectral efficient network and resource selection model in 5G networks
Diabetes mellitus diagnosis method based random forest with bat algorithm
Chapter 3 Spatial Domain Image Processing.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Understanding_Digital_Forensics_Presentation.pptx
cuic standard and advanced reporting.pdf
Machine learning based COVID-19 study performance prediction
MYSQL Presentation for SQL database connectivity
Building Integrated photovoltaic BIPV_UPV.pdf
Electronic commerce courselecture one. Pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Mobile App Security Testing_ A Comprehensive Guide.pdf

Justin Cormack - The 10 Container Security Tricks That Will Help You Sleep At Night - Codemotion Milan 2017

  • 1. Ten Container Security Tricks That Will Help You Sleep At Night Justin Cormack
  • 2. Who am I? Engineer at Docker in Cambridge, UK. Background both dev and ops. Work on many projects • maintainer on moby/moby formerly docker/docker • tech lead on LinuxKit • containerD • runC • Docker for Mac • security pieces for engine eg seccomp policies etc 2
  • 4. You want to sleep soundly?
  • 6. Ten things? There are going to be a couple more than ten things here... So you could try to do at least ten! Or at least one! 6
  • 7. Containers do make security a little easier • Identifiability – what did I ship? • Reproducibility – can I ship it again? • Consistency – can I build it again? • Agility – can I do all this quickly? • Usability – can I do it easily? At Docker we have always tried to ship sensible security defaults that just work for most cases. 7
  • 8. Start with the whole team
  • 9. No silos • DevSecOps • Teams working together to deliver quality software • Security as an ongoing process not checkboxes • Ongoing improvements and learning, not blame culture • More rapid deployment of good practise across all software 9
  • 10. Teamwork • Embed security people in your teams. They need to understand what your product is doing too. • If your company is too small to have dedicated security people, assign someone to be responsible for security in each project and learn! • Make sure all the team understands the threat model from the start, and the key risks • Postmortems when things go wrong, not to blame, but to improve 10
  • 11. four things you can do in development
  • 12. Don't use privileged and capabilities • docker run --privileged gives you total control over the machine • adding just a few capabilities and security options does the same • don't use setuid code in containers, disable with --security-opt=no-new-privileges • run as a non root user or use user namespaces if possible • don't bind the Docker socket into a container Very rarely you may need to do some of these things, eg for some debugging, but these use cases are exceptional. 12
  • 13. Use read only images • docker run --read-only ... • nothing can be modified in the container root filesystem • understand exactly what configuration is expected Sometimes images don't work, please file an issue. 13
  • 14. Use official images where possible • the official images are well designed • they are updated for security issues • they use best practises for the software being packaged • they are well tested • minimal • they use modern OS versions, use alpine or stretch If there isn't one try to work with upstream project and read the guidelines https://github.com/docker-library/official-images 14
  • 15. Use the secrets API • Do not check secrets into git • Do not put secrets in environment variables • Use the docker secrets API docker secret create • Or the Kubernetes API kubectl create secret • Or Vault from Hashicorp 15
  • 16. Dev and Ops as a team
  • 17. Always be updating • Automated build pipeline • Constantly be updating base images with security fixes • Update your other dependencies • the longer you leave updates the harder they become 17
  • 18. Use an image scanning service 18
  • 19. Don't try to keep containers running forever • It is not a competition! • The more often you update the harder it is for attackers • Plus you get the security updates sooner • Continuous delivery means you get small code improvements out faster • Always be updating! 19
  • 20. Sign your containers • Once you have automated builds you can start signing • Guarantee that processes have been followed • Can use for automated promotion of images • Official images already signed, check them • new easier commands – docker trust view – docker trust sign – docker trust revoke 20
  • 22. Use a minimal underlying OS “Use container-specific OSes instead of general-purpose ones to reduce attack surfaces. When using a container-specific OS, attack surfaces are typically much smaller than they would be with a general-purpose OS, so there are fewer opportunities to attack and compromise a container-specific OS.” NIST Application Container Security Guide http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-190.pdf Failing that, at least make sure the OS is updated. 22
  • 25. Test based on your code • eg for web based code look for XSS vulnerabilities • look at your code like an attacker • don't just look at the "happy path" Always use static analysis tools, eg linters. As many as possible... Many of the things they find will not be security issues, but a few may be. 25