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
Docker security
Janos Suto
 
PDF
OSDC 2016 - Inspecting Security of Docker formatted Container Images to find ...
NETWAYS
 
PDF
How Secure Is Your Container? ContainerCon Berlin 2016
Phil Estes
 
PDF
Docker Security - Secure Container Deployment on Linux
Michael Boelen
 
PDF
Docker London: Container Security
Phil Estes
 
PDF
Securité des container
Rachid Zarouali
 
PPTX
"Docker best practice", Станислав Коленкин (senior devops, DataArt)
DataArt
 
PDF
Start your container journey safely
Rachid Zarouali
 
PDF
Operating Docker
Jen Andre
 
PDF
Breaking and fixing_your_dockerized_environments_owasp_appsec_usa2016
Manideep Konakandla
 
PPTX
Docker Security workshop slides
Docker, Inc.
 
PPTX
Docker Security Overview
Sreenivas Makam
 
PDF
Docker for developers
andrzejsydor
 
PDF
Container Security
Jie Liau
 
PDF
Unraveling Docker Security: Lessons From a Production Cloud
Salman Baset
 
PDF
Docker Security: Are Your Containers Tightly Secured to the Ship?
Michael Boelen
 
PDF
Docker Security and Content Trust
ehazlett
 
PDF
Docker security: Rolling out Trust in your container
Ronak Kogta
 
PDF
The Container Security Checklist
LibbySchulze
 
PPTX
Docker Container Security
Suraj Khetani
 
Docker security
Janos Suto
 
OSDC 2016 - Inspecting Security of Docker formatted Container Images to find ...
NETWAYS
 
How Secure Is Your Container? ContainerCon Berlin 2016
Phil Estes
 
Docker Security - Secure Container Deployment on Linux
Michael Boelen
 
Docker London: Container Security
Phil Estes
 
Securité des container
Rachid Zarouali
 
"Docker best practice", Станислав Коленкин (senior devops, DataArt)
DataArt
 
Start your container journey safely
Rachid Zarouali
 
Operating Docker
Jen Andre
 
Breaking and fixing_your_dockerized_environments_owasp_appsec_usa2016
Manideep Konakandla
 
Docker Security workshop slides
Docker, Inc.
 
Docker Security Overview
Sreenivas Makam
 
Docker for developers
andrzejsydor
 
Container Security
Jie Liau
 
Unraveling Docker Security: Lessons From a Production Cloud
Salman Baset
 
Docker Security: Are Your Containers Tightly Secured to the Ship?
Michael Boelen
 
Docker Security and Content Trust
ehazlett
 
Docker security: Rolling out Trust in your container
Ronak Kogta
 
The Container Security Checklist
LibbySchulze
 
Docker Container Security
Suraj Khetani
 
Ad

More from Jose Manuel Ortega Candel (20)

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
 
PDF
Shodan Tips and tricks. Automatiza y maximiza las búsquedas shodan
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
 
Shodan Tips and tricks. Automatiza y maximiza las búsquedas shodan
Jose Manuel Ortega Candel
 
Ad

Recently uploaded (20)

PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
Digital Circuits, important subject in CS
contactparinay1
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 

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!