SlideShare a Scribd company logo
Testing Docker Images Security -All day dev ops 2017
jmortega.github.io
about.me/jmortegac
Software Engineer &
Security Researcher
Introduction to docker security
Security best practices
Tools for auditing docker images
Three Takeaways
● “Docker containers wrap up a piece of
software in a complete filesystem
that contains everything it needs to
run: code,runtime, system tools,
system libraries –anything you can
install on a server. This guarantees
that it will always run the
same,regardless of the environment it
is running in.”
Testing Docker Images Security -All day dev ops 2017
● Docker provides an additional layer of isolation,
making your infrastructure safer by default.
● Makes the application lifecycle fast and easier,
reducing risks in your applications
● Docker uses several mechanisms for security:
○ Linux kernel namespaces
○ Linux Control Groups (cgroups)
○ The Docker daemon
○ Linux capabilities (libcap)
○ Linux security mechanisms like AppArmor or
SELinux
● Namespaces:provides an isolated view of the
system where processes cannot see other
processes in other containers
● Each container also gets its own network stack.
● A container doesn’t get privileged access to the
sockets or interfaces of another container.
● Cgroups: kernel feature that limits and isolates
the resource usage(CPU,memory,network) of a
collection of processes.
● Linux Capabilities: divides the privileges of root
into distinct units and smaller groups of privileges.
● The docker daemon (/usr/bin/docker) is responsible for
managing the control groups, orchestrating the
namespaces, and so on so that docker images can be run
and secured.
● Because of the need to manage kernel functions, Docker
runs with root privileges.
● Limit the users who have control of the Docker Daemon
● Restrict access to the daemon only to the ones really
needing it (users, processes)
● Don’t expose the daemon to the outside your network
● If you do so, make sure you have put this behind a secure
proxy, like NGINX
Testing Docker Images Security -All day dev ops 2017
Testing Docker Images Security -All day dev ops 2017
Testing Docker Images Security -All day dev ops 2017
Testing Docker Images Security -All day dev ops 2017
https://github.com/CenturyLinkLabs/dockerfile-from-image
Testing Docker Images Security -All day dev ops 2017
● Images are extracted in a chrooted sub process, being the
first-step in a wider effort toward privilege separation.
● From Docker 1.10, all images are stored and accessed by
the cryptographic checksums of their contents, limiting
the possibility of an attacker causing a collision with an
existing image Docker Content Trust.
Testing Docker Images Security -All day dev ops 2017
● Protects against untrusted images
● Can enable signing checks on every managed host
● Signature verification transparent to users
● Guarantee integrity of your images when pulled
● Provides trust from publisher to consumer
● export DOCKER_CONTENT_TRUST=1
● ~/.docker/trust/trusted-certificates/
● Do not write secrets(users and passwords).
● Remove unnecessary setuid, setgid permissions
(Privilege escalation)
● Download packages securely using GPG and certificates
● Try to restrict an image or container to one service
● To disable setuid rights, add the following to the
Dockerfile of your image
● Set a specific user.
● Don’t run your applications as root in containers.
● Don’t run containers with --privileged flag
● The --privileged flag gives all capabilities to the
container.
● docker run --privileged …
● docker run --cap-drop=ALL --cap-add=
CAP_NET_ADMIN ...
● Manual management within the container:
docker run --cap-add ALL
● Restricted capabilities with root:
docker run --cap-drop ALL --cap-add $CAP
● No capabilities:
docker run --user
Testing Docker Images Security -All day dev ops 2017
Testing Docker Images Security -All day dev ops 2017
● We can verify the integrity of the image
● Checksum validation when pulling image from
docker hub
● Pulling by digest to enforce consistent
● Pulling by Docker content trust
● $ export DOCKER_CONTENT_TRUST=1
$ docker pull debian:latest
Pull (1 of 1): debian:latest@sha256:a25306f38…
● Check packages installed in the container
Docker security is about
limiting and controlling the
attack surface on the kernel.
Run filesystems as read-only
so that attackers can not
overwrite data or save
malicious scripts to the
image.
Testing Docker Images Security -All day dev ops 2017
Testing Docker Images Security -All day dev ops 2017
Testing Docker Images Security -All day dev ops 2017
Auditing Docker Images
● You can scan your images for known vulnerabilities
● There are tools for that, like Docker Security Scanning,
Docker Bench Security and CoreOS Clair
● Find known vulnerable binaries
● Checks based on best practices for hosts and containers
● Find Common Vulnerabilities and Exposures (CVEs)
https://docs.docker.com/docker-cloud/builds/image-scan/
● Checks against CVE database for image layers
● Binary scanning of all components in the image
● Performs binary scan to pick up on statically linked
binaries
● Analyses libraries statically compiled in the image
● Generates a reports that shows if there are CVE in the
libraries inside the image
Testing Docker Images Security -All day dev ops 2017
Testing Docker Images Security -All day dev ops 2017
https://www.docker.com/docker-cve-database
Testing Docker Images Security -All day dev ops 2017
Testing Docker Images Security -All day dev ops 2017
● Vulnerability Static Analysis for Containers
● https://github.com/coreos/clair
● You've found an image by searching the internet and want
to determine if it's safe enough for you to use in
production.
● You're regularly deploying into a containerized production
environment and want operations to alert or block
deployments on insecure software.
Testing Docker Images Security -All day dev ops 2017
Testing Docker Images Security -All day dev ops 2017
● Checks based on best practices for hosts and containers
● https://github.com/docker/docker-bench-security
● Open-source tool for running automated tests
● Inspired by the CIS Docker 1.11 benchmark
● Runs against containers currently running on same host
● Checks for AppArmor, read-only volumes, etc...
Testing Docker Images Security -All day dev ops 2017
● The host configuration
● The Docker daemon configuration
● The Docker daemon configuration files
● Container images and build files
● Container runtime
● Docker security operations
● The Docker daemon configuration
● [WARN] 2.1- Restrict network traffic between containers
● [WARN] 4.1 - Create a user for the container
● [WARN] * Running as root:
● [WARN] 5.4 - Restrict Linux Kernel Capabilities within
containers
● [WARN] * Capabilities added: CapAdd=[audit_control]
● [WARN] 5.13 - Mount container's root filesystem as readonly
● [WARN] * Container running with root FS mounted R/W:
Testing Docker Images Security -All day dev ops 2017
● Lynis
● Dagda
● Anchore
● https://github.com/CISOfy/lynis-docker
● Lynis is a Linux, Mac and Unix security auditing and
system hardening tool that includes a module to audit
Dockerfiles.
● lynis audit dockerfile <file>
Testing Docker Images Security -All day dev ops 2017
● https://github.com/eliasgranderubio/dagda
● Static analysis of known vulnerabilities on
Docker containers
● Allows monitoring Docker containers for
detecting anomalous activities
Python 3
MongoDB
PyMongo
Requests
Python-dateutil
Joblib
Docker-py
Flask
Flask-cors
PyYAML
● python3 dagda.py check --docker_image <image_name>
● python3 dagda.py history <image_name> --id <Id_Scan>
Testing Docker Images Security -All day dev ops 2017
Testing Docker Images Security -All day dev ops 2017
Testing Docker Images Security -All day dev ops 2017
Testing Docker Images Security -All day dev ops 2017
Testing Docker Images Security -All day dev ops 2017
Testing Docker Images Security -All day dev ops 2017
Testing Docker Images Security -All day dev ops 2017
Testing Docker Images Security -All day dev ops 2017
Testing Docker Images Security -All day dev ops 2017
Testing Docker Images Security -All day dev ops 2017
Testing Docker Images Security -All day dev ops 2017
Signing ● Secure & sign your source
Dependences ● Pin & verify your dependencies
Content Trust
● Sign your artifacts with Docker
Content Trust
Privileges ● Least Privilege configurations
● https://docs.docker.com/engine/security
● http://www.oreilly.com/webops-perf/free/files/dock
er-security.pdf
● http://container-solutions.com/content/uploads/201
5/06/15.06.15_DockerCheatSheet_A2.pdf
● https://www.openshift.com/promotions/docker-sec
urity.html
● Docker Content Trust
https://docs.docker.com/engine/security/trust/cont
ent_trust
● Docker Security Scanning
https://docs.docker.com/docker-cloud/builds/image-scan
https://blog.docker.com/2016/04/docker-security
http://softwaretester.info/docker-audit
Testing Docker Images Security -All day dev ops 2017
Testing Docker Images Security -All day dev ops 2017
jmortega.github.io
@jmortegacThanks!
Testing Docker Images Security -All day dev ops 2017
Testing Docker Images Security -All day dev ops 2017
bit.ly/addo-slack
Find me on slack, right now!

More Related Content

What's hot (20)

PDF
Evolution of Linux Containerization
WSO2
 
PDF
Linux Distribution Automated Testing
Aleksander Baranowski
 
PPTX
Docker Security and Orchestration for DevSecOps wins
Sharath Kumar
 
PDF
Secure and Simple Sandboxing in SELinux
James Morris
 
PPTX
Hands on introduction to docker security for docker newbies
Yigal Elefant
 
PDF
JOSA TechTalk: Introduction to docker
Jordan Open Source Association
 
PDF
PIC your malware
CODE WHITE GmbH
 
PDF
Introduction to Containers - From Docker to Kubernetes and everything in between
All Things Open
 
PDF
MR201404 building secure linux application with privilege separation
FFRI, Inc.
 
PDF
Introdution to Docker (theory and hands on) dbCafé - dbTrento
Cristian Consonni
 
PDF
Docker introduction
Layne Peng
 
PDF
JOSA TechTalk: Taking Docker to Production
Jordan Open Source Association
 
PDF
Docker Introduction
Sparkbit
 
PDF
Docker & ci
Patxi Gortázar
 
PDF
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ElasTest Project
 
ODP
CLI Wizardry - A Friendly Intro To sed/awk/grep
All Things Open
 
PDF
Common Docker Problems and Solutions
Joel Chen
 
PDF
Attacking and Auditing Containers - Nishith Khadadiya
NSConclave
 
PDF
Orchestrating Docker containers at scale
Maciej Lasyk
 
PPTX
Docker Presentation
Adhoura Academy
 
Evolution of Linux Containerization
WSO2
 
Linux Distribution Automated Testing
Aleksander Baranowski
 
Docker Security and Orchestration for DevSecOps wins
Sharath Kumar
 
Secure and Simple Sandboxing in SELinux
James Morris
 
Hands on introduction to docker security for docker newbies
Yigal Elefant
 
JOSA TechTalk: Introduction to docker
Jordan Open Source Association
 
PIC your malware
CODE WHITE GmbH
 
Introduction to Containers - From Docker to Kubernetes and everything in between
All Things Open
 
MR201404 building secure linux application with privilege separation
FFRI, Inc.
 
Introdution to Docker (theory and hands on) dbCafé - dbTrento
Cristian Consonni
 
Docker introduction
Layne Peng
 
JOSA TechTalk: Taking Docker to Production
Jordan Open Source Association
 
Docker Introduction
Sparkbit
 
Docker & ci
Patxi Gortázar
 
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ElasTest Project
 
CLI Wizardry - A Friendly Intro To sed/awk/grep
All Things Open
 
Common Docker Problems and Solutions
Joel Chen
 
Attacking and Auditing Containers - Nishith Khadadiya
NSConclave
 
Orchestrating Docker containers at scale
Maciej Lasyk
 
Docker Presentation
Adhoura Academy
 

Similar to Testing Docker Images Security -All day dev ops 2017 (20)

PDF
Best Practices for Developing & Deploying Java Applications with Docker
Eric Smalling
 
PPTX
"Docker best practice", Станислав Коленкин (senior devops, DataArt)
DataArt
 
PDF
Docker Up and Running for Web Developers
Amr Fawzy
 
PDF
Docker up and Running For Web Developers
BADR
 
PDF
DCSF 19 Building Your Development Pipeline
Docker, Inc.
 
PDF
Dockers & kubernetes detailed - Beginners to Geek
wiTTyMinds1
 
PDF
Introduction to Docker and Monitoring with InfluxData
InfluxData
 
PDF
Docker security: Rolling out Trust in your container
Ronak Kogta
 
PPTX
Powercoders · Docker · Fall 2021.pptx
IgnacioTamayo2
 
PDF
Introduction of Docker and Docker Compose
Dr. Ketan Parmar
 
PPTX
Introduction to Docker
Pubudu Jayawardana
 
PDF
Docker Fundamentals
Anshul Patel
 
PPTX
SW Docker Security
Stephane Woillez
 
PPTX
Docker
Charlie Cai
 
PDF
Docker container security
Thoughtworks
 
PDF
[@NaukriEngineering] Docker 101
Naukri.com
 
PDF
Docker Security and Content Trust
ehazlett
 
PDF
Introduction to docker and docker compose
Lalatendu Mohanty
 
PDF
Docker for developers
andrzejsydor
 
PPTX
Oracle database on Docker Container
Jesus Guzman
 
Best Practices for Developing & Deploying Java Applications with Docker
Eric Smalling
 
"Docker best practice", Станислав Коленкин (senior devops, DataArt)
DataArt
 
Docker Up and Running for Web Developers
Amr Fawzy
 
Docker up and Running For Web Developers
BADR
 
DCSF 19 Building Your Development Pipeline
Docker, Inc.
 
Dockers & kubernetes detailed - Beginners to Geek
wiTTyMinds1
 
Introduction to Docker and Monitoring with InfluxData
InfluxData
 
Docker security: Rolling out Trust in your container
Ronak Kogta
 
Powercoders · Docker · Fall 2021.pptx
IgnacioTamayo2
 
Introduction of Docker and Docker Compose
Dr. Ketan Parmar
 
Introduction to Docker
Pubudu Jayawardana
 
Docker Fundamentals
Anshul Patel
 
SW Docker Security
Stephane Woillez
 
Docker
Charlie Cai
 
Docker container security
Thoughtworks
 
[@NaukriEngineering] Docker 101
Naukri.com
 
Docker Security and Content Trust
ehazlett
 
Introduction to docker and docker compose
Lalatendu Mohanty
 
Docker for developers
andrzejsydor
 
Oracle database on Docker Container
Jesus Guzman
 
Ad

More from Jose Manuel Ortega Candel (20)

PDF
Seguridad y auditorías en Modelos grandes del lenguaje (LLM)
Jose Manuel Ortega Candel
 
PDF
Seguridad y auditorías en Modelos grandes del lenguaje (LLM).pdf
Jose Manuel Ortega Candel
 
PDF
Beyond the hype: The reality of AI security.pdf
Jose Manuel Ortega Candel
 
PDF
Seguridad de APIs en Drupal_ herramientas, mejores prácticas y estrategias pa...
Jose Manuel Ortega Candel
 
PDF
Security and auditing tools in Large Language Models (LLM).pdf
Jose Manuel Ortega Candel
 
PDF
Herramientas de benchmarks para evaluar el rendimiento en máquinas y aplicaci...
Jose Manuel Ortega Candel
 
PDF
Asegurando tus APIs Explorando el OWASP Top 10 de Seguridad en APIs.pdf
Jose Manuel Ortega Candel
 
PDF
PyGoat Analizando la seguridad en aplicaciones Django.pdf
Jose Manuel Ortega Candel
 
PDF
Ciberseguridad en Blockchain y Smart Contracts: Explorando los Desafíos y Sol...
Jose Manuel Ortega Candel
 
PDF
Evolution of security strategies in K8s environments- All day devops
Jose Manuel Ortega Candel
 
PDF
Evolution of security strategies in K8s environments.pdf
Jose Manuel Ortega Candel
 
PDF
Implementing Observability for Kubernetes.pdf
Jose Manuel Ortega Candel
 
PDF
Computación distribuida usando Python
Jose Manuel Ortega Candel
 
PDF
Seguridad en arquitecturas serverless y entornos cloud
Jose Manuel Ortega Candel
 
PDF
Construyendo arquitecturas zero trust sobre entornos cloud
Jose Manuel Ortega Candel
 
PDF
Tips and tricks for data science projects with Python
Jose Manuel Ortega Candel
 
PDF
Sharing secret keys in Docker containers and K8s
Jose Manuel Ortega Candel
 
PDF
Implementing cert-manager in K8s
Jose Manuel Ortega Candel
 
PDF
Python para equipos de ciberseguridad(pycones)
Jose Manuel Ortega Candel
 
PDF
Python para equipos de ciberseguridad
Jose Manuel Ortega Candel
 
Seguridad y auditorías en Modelos grandes del lenguaje (LLM)
Jose Manuel Ortega Candel
 
Seguridad y auditorías en Modelos grandes del lenguaje (LLM).pdf
Jose Manuel Ortega Candel
 
Beyond the hype: The reality of AI security.pdf
Jose Manuel Ortega Candel
 
Seguridad de APIs en Drupal_ herramientas, mejores prácticas y estrategias pa...
Jose Manuel Ortega Candel
 
Security and auditing tools in Large Language Models (LLM).pdf
Jose Manuel Ortega Candel
 
Herramientas de benchmarks para evaluar el rendimiento en máquinas y aplicaci...
Jose Manuel Ortega Candel
 
Asegurando tus APIs Explorando el OWASP Top 10 de Seguridad en APIs.pdf
Jose Manuel Ortega Candel
 
PyGoat Analizando la seguridad en aplicaciones Django.pdf
Jose Manuel Ortega Candel
 
Ciberseguridad en Blockchain y Smart Contracts: Explorando los Desafíos y Sol...
Jose Manuel Ortega Candel
 
Evolution of security strategies in K8s environments- All day devops
Jose Manuel Ortega Candel
 
Evolution of security strategies in K8s environments.pdf
Jose Manuel Ortega Candel
 
Implementing Observability for Kubernetes.pdf
Jose Manuel Ortega Candel
 
Computación distribuida usando Python
Jose Manuel Ortega Candel
 
Seguridad en arquitecturas serverless y entornos cloud
Jose Manuel Ortega Candel
 
Construyendo arquitecturas zero trust sobre entornos cloud
Jose Manuel Ortega Candel
 
Tips and tricks for data science projects with Python
Jose Manuel Ortega Candel
 
Sharing secret keys in Docker containers and K8s
Jose Manuel Ortega Candel
 
Implementing cert-manager in K8s
Jose Manuel Ortega Candel
 
Python para equipos de ciberseguridad(pycones)
Jose Manuel Ortega Candel
 
Python para equipos de ciberseguridad
Jose Manuel Ortega Candel
 
Ad

Recently uploaded (20)

PPTX
Building and Operating a Private Cloud with CloudStack and LINBIT CloudStack ...
ShapeBlue
 
PDF
OpenInfra ID 2025 - Are Containers Dying? Rethinking Isolation with MicroVMs.pdf
Muhammad Yuga Nugraha
 
PPT
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
PDF
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
Hironori Washizaki
 
PPTX
Lifting and Rigging Safety AQG-2025-2.pptx
farrukhkhan658034
 
PDF
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
CloudStack GPU Integration - Rohit Yadav
ShapeBlue
 
PDF
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
PDF
Novus-Safe Pro: Brochure-What is Novus Safe Pro?.pdf
Novus Hi-Tech
 
PDF
Sustainable and comertially viable mining process.pdf
Avijit Kumar Roy
 
PDF
Women in Automation Presents: Reinventing Yourself — Bold Career Pivots That ...
DianaGray10
 
PPTX
Building a Production-Ready Barts Health Secure Data Environment Tooling, Acc...
Barts Health
 
PPTX
Top Managed Service Providers in Los Angeles
Captain IT
 
PDF
HydITEx corporation Booklet 2025 English
Георгий Феодориди
 
PDF
Arcee AI - building and working with small language models (06/25)
Julien SIMON
 
PDF
Are there government-backed agri-software initiatives in Limerick.pdf
giselawagner2
 
PDF
Apache CloudStack 201: Let's Design & Build an IaaS Cloud
ShapeBlue
 
PDF
2025-07-15 EMEA Volledig Inzicht Dutch Webinar
ThousandEyes
 
PDF
Meetup Kickoff & Welcome - Rohit Yadav, CSIUG Chairman
ShapeBlue
 
Building and Operating a Private Cloud with CloudStack and LINBIT CloudStack ...
ShapeBlue
 
OpenInfra ID 2025 - Are Containers Dying? Rethinking Isolation with MicroVMs.pdf
Muhammad Yuga Nugraha
 
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
Hironori Washizaki
 
Lifting and Rigging Safety AQG-2025-2.pptx
farrukhkhan658034
 
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
CloudStack GPU Integration - Rohit Yadav
ShapeBlue
 
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
Novus-Safe Pro: Brochure-What is Novus Safe Pro?.pdf
Novus Hi-Tech
 
Sustainable and comertially viable mining process.pdf
Avijit Kumar Roy
 
Women in Automation Presents: Reinventing Yourself — Bold Career Pivots That ...
DianaGray10
 
Building a Production-Ready Barts Health Secure Data Environment Tooling, Acc...
Barts Health
 
Top Managed Service Providers in Los Angeles
Captain IT
 
HydITEx corporation Booklet 2025 English
Георгий Феодориди
 
Arcee AI - building and working with small language models (06/25)
Julien SIMON
 
Are there government-backed agri-software initiatives in Limerick.pdf
giselawagner2
 
Apache CloudStack 201: Let's Design & Build an IaaS Cloud
ShapeBlue
 
2025-07-15 EMEA Volledig Inzicht Dutch Webinar
ThousandEyes
 
Meetup Kickoff & Welcome - Rohit Yadav, CSIUG Chairman
ShapeBlue
 

Testing Docker Images Security -All day dev ops 2017

  • 3. Introduction to docker security Security best practices Tools for auditing docker images Three Takeaways
  • 4. ● “Docker containers wrap up a piece of software in a complete filesystem that contains everything it needs to run: code,runtime, system tools, system libraries –anything you can install on a server. This guarantees that it will always run the same,regardless of the environment it is running in.”
  • 6. ● Docker provides an additional layer of isolation, making your infrastructure safer by default. ● Makes the application lifecycle fast and easier, reducing risks in your applications
  • 7. ● Docker uses several mechanisms for security: ○ Linux kernel namespaces ○ Linux Control Groups (cgroups) ○ The Docker daemon ○ Linux capabilities (libcap) ○ Linux security mechanisms like AppArmor or SELinux
  • 8. ● Namespaces:provides an isolated view of the system where processes cannot see other processes in other containers ● Each container also gets its own network stack. ● A container doesn’t get privileged access to the sockets or interfaces of another container.
  • 9. ● Cgroups: kernel feature that limits and isolates the resource usage(CPU,memory,network) of a collection of processes. ● Linux Capabilities: divides the privileges of root into distinct units and smaller groups of privileges.
  • 10. ● The docker daemon (/usr/bin/docker) is responsible for managing the control groups, orchestrating the namespaces, and so on so that docker images can be run and secured. ● Because of the need to manage kernel functions, Docker runs with root privileges. ● Limit the users who have control of the Docker Daemon
  • 11. ● Restrict access to the daemon only to the ones really needing it (users, processes) ● Don’t expose the daemon to the outside your network ● If you do so, make sure you have put this behind a secure proxy, like NGINX
  • 18. ● Images are extracted in a chrooted sub process, being the first-step in a wider effort toward privilege separation. ● From Docker 1.10, all images are stored and accessed by the cryptographic checksums of their contents, limiting the possibility of an attacker causing a collision with an existing image Docker Content Trust.
  • 20. ● Protects against untrusted images ● Can enable signing checks on every managed host ● Signature verification transparent to users ● Guarantee integrity of your images when pulled ● Provides trust from publisher to consumer ● export DOCKER_CONTENT_TRUST=1 ● ~/.docker/trust/trusted-certificates/
  • 21. ● Do not write secrets(users and passwords). ● Remove unnecessary setuid, setgid permissions (Privilege escalation) ● Download packages securely using GPG and certificates ● Try to restrict an image or container to one service
  • 22. ● To disable setuid rights, add the following to the Dockerfile of your image
  • 23. ● Set a specific user. ● Don’t run your applications as root in containers.
  • 24. ● Don’t run containers with --privileged flag ● The --privileged flag gives all capabilities to the container. ● docker run --privileged … ● docker run --cap-drop=ALL --cap-add= CAP_NET_ADMIN ...
  • 25. ● Manual management within the container: docker run --cap-add ALL ● Restricted capabilities with root: docker run --cap-drop ALL --cap-add $CAP ● No capabilities: docker run --user
  • 28. ● We can verify the integrity of the image ● Checksum validation when pulling image from docker hub ● Pulling by digest to enforce consistent
  • 29. ● Pulling by Docker content trust ● $ export DOCKER_CONTENT_TRUST=1 $ docker pull debian:latest Pull (1 of 1): debian:latest@sha256:a25306f38…
  • 30. ● Check packages installed in the container
  • 31. Docker security is about limiting and controlling the attack surface on the kernel.
  • 32. Run filesystems as read-only so that attackers can not overwrite data or save malicious scripts to the image.
  • 37. ● You can scan your images for known vulnerabilities ● There are tools for that, like Docker Security Scanning, Docker Bench Security and CoreOS Clair ● Find known vulnerable binaries
  • 38. ● Checks based on best practices for hosts and containers ● Find Common Vulnerabilities and Exposures (CVEs) https://docs.docker.com/docker-cloud/builds/image-scan/
  • 39. ● Checks against CVE database for image layers ● Binary scanning of all components in the image ● Performs binary scan to pick up on statically linked binaries ● Analyses libraries statically compiled in the image ● Generates a reports that shows if there are CVE in the libraries inside the image
  • 45. ● Vulnerability Static Analysis for Containers ● https://github.com/coreos/clair
  • 46. ● You've found an image by searching the internet and want to determine if it's safe enough for you to use in production. ● You're regularly deploying into a containerized production environment and want operations to alert or block deployments on insecure software.
  • 49. ● Checks based on best practices for hosts and containers ● https://github.com/docker/docker-bench-security ● Open-source tool for running automated tests ● Inspired by the CIS Docker 1.11 benchmark ● Runs against containers currently running on same host ● Checks for AppArmor, read-only volumes, etc...
  • 51. ● The host configuration ● The Docker daemon configuration ● The Docker daemon configuration files ● Container images and build files ● Container runtime ● Docker security operations
  • 52. ● The Docker daemon configuration ● [WARN] 2.1- Restrict network traffic between containers ● [WARN] 4.1 - Create a user for the container ● [WARN] * Running as root: ● [WARN] 5.4 - Restrict Linux Kernel Capabilities within containers ● [WARN] * Capabilities added: CapAdd=[audit_control] ● [WARN] 5.13 - Mount container's root filesystem as readonly ● [WARN] * Container running with root FS mounted R/W:
  • 55. ● https://github.com/CISOfy/lynis-docker ● Lynis is a Linux, Mac and Unix security auditing and system hardening tool that includes a module to audit Dockerfiles. ● lynis audit dockerfile <file>
  • 57. ● https://github.com/eliasgranderubio/dagda ● Static analysis of known vulnerabilities on Docker containers ● Allows monitoring Docker containers for detecting anomalous activities
  • 59. ● python3 dagda.py check --docker_image <image_name> ● python3 dagda.py history <image_name> --id <Id_Scan>
  • 71. Signing ● Secure & sign your source Dependences ● Pin & verify your dependencies Content Trust ● Sign your artifacts with Docker Content Trust Privileges ● Least Privilege configurations
  • 72. ● https://docs.docker.com/engine/security ● http://www.oreilly.com/webops-perf/free/files/dock er-security.pdf ● http://container-solutions.com/content/uploads/201 5/06/15.06.15_DockerCheatSheet_A2.pdf ● https://www.openshift.com/promotions/docker-sec urity.html
  • 73. ● Docker Content Trust https://docs.docker.com/engine/security/trust/cont ent_trust ● Docker Security Scanning https://docs.docker.com/docker-cloud/builds/image-scan https://blog.docker.com/2016/04/docker-security http://softwaretester.info/docker-audit
  • 79. bit.ly/addo-slack Find me on slack, right now!