SlideShare a Scribd company logo
1 of 25
Hands-On Introduction to
Docker Security for
Docker Newbies
Presented by:
Yigal Elefant
DevSecOps IL
Ysquared
#WhoAmI
 Yigal Elefant
 Technology Enthusiast
 Lead SDLC implementation
 Analyst & Security researcher
 Lecturer  Guide
 Married + 1
What’s the plan?
 Initial Introduction to Docker
 1st run of Docker
 The Docker Components
 Playing some more with the Docker
 Understanding the Docker building blocks
 So, security?
 Concluding the journey
What is Docker?
Docker is the world’s leading software container platform. Developers use Docker
to eliminate “works on my machine” problems when collaborating on code with
co-workers. Operators use Docker to run and manage apps side-by-side in
isolated containers to get better compute density. Enterprises use Docker to
build agile software delivery pipelines to ship new features faster, more securely
and with confidence for both Linux and Windows Server apps.
(www.docker.com)
What is Docker?
Docker allows you to package an application with all
of its dependencies into a standardized unit for
software development.
(www.quru.com)
OK, lets start
 Connect to Docker Host
 Run command:
docker run hello-world
For this presentation I am using CentOS 7.0.1406 with Docker version 1.12.6.
Docker run hello-world
Docker Components
 Docker Registry – A server distributing Docker Images. Images can be kept
privately or publicly and can be downloaded and uploaded.
The biggest public registry known is Docker Hub.
 Docker Images – Read-only templates used to create containers. An image can
contain an operating system, an application, an operating system with
applications installed and configured.
An image can be created independently or downloaded from public registries.
 Docker Container – The active part of the Docker environment. Each container
is created from an image and it can be run, stopped, started, moved, etc.
Docker Components
 Docker Daemon – The main Docker process on the Docker Host. Listens for
commands from the Docker Client or from a REST API that it publishes.
 Docker Client – Docker runs as client-server. Docker client allows sending the
docker commands, receives the data from the Daemon and prints it.
 Docker Host – The machine running the Docker Daemon.
Docker Commands
 docker run [options] image:version [command]
Run a container from an image
 “-d”: detached mode
 “-t”: TTY
 “-i”: interactive
 “--name”: set a name for the container.
 “-P”: Expose the default ports needed for this container.
 “-p”: Expose specified ports to this container. Syntax: <host-interface>:<host-
port>:<container-port>
 “-v”: Mount the specified volume on the container. Syntax:
/host/volume:/container/volume
 “--readonly”: Mount the container's root filesystem as read only.
 “--rm”: Automatically remove the container when it exits.
Docker Commands
 docker pull image:version
pull an image from the registry
 docker exec [options] container-name [command]
execute a command on an active container
 docker attach container-name
attach to a running container
Docker Commands
 docker build
build an image from a Dockerfile
 docker push name
push an image to the Registry
 docker info
show information about the docker environment
 docker inspect name
show detailed information about containerimagetask
Docker Commands
 docker rm name
Remove a container
 docker rmi name
Remove image
Playing some more
docker run –d --name nginx1 –h nginx1 –P nginx
docker run –dit --name c1 –h c1 centos /bin/bash
docker run –it --name c2 –h c2 centos /bin/bash
docker run –d –p 33003:80 --name nginx2 –h nginx2 nginx
The Docker Building Blocks
 UnionFS (Union File System)
File systems that operate by creating layers, making them very lightweight
and fast. Docker uses union file systems to provide the building blocks for
containers
 Namespaces
A technology used to organize objects of various kinds in a separate
environment.
 Linux Containers (LXC)
Allows running processes separately from each other. Uses namespaces and
cgroups for this.
The Docker Building Blocks
 cgroups (control groups)
“Linux kernel feature to limit, account for and isolate the resource usage
(CPU, Memory, disk I/O, network, etc.) of a collection of processes.”
(Wikipedia)
Docker VS Virtualization
So, security?
 Is a container opaque?
 With running containers, from the Docker Host run the command:
ps –ef
 As we can see in the result, the Docker Host can see the processes running
within containers.
So, security?
 Docker Host OS hardening
 From the Docker Host run the command:
df –h
 This is to demonstrate that unless a partition was created for the Docker data
(/var/lib/docker), this can quickly fill up our HDD and block our access to the
Docker Host.
So, security?
 Can containers communicate with each
other?
 Lets try this with the default environment settings:
docker run -d --name nginx3 -P nginx
docker inspect nginx3 | egrep “Name|IPAddress”
docker run –it --name netest –h netest centos /bin/bash
curl 172.17.0.4:80 (The internal IP address found using the inspect command)
 As we can see, by default Docker containers can communicate even without
defining this. This is due to ICC – Inter Container Communication, that is set
by default to “true”.
This is a setting in the Docker Daemon that can be changed to “false”.
So, security?
 Sharing folders to the container
 From the Docker Host, create a container with shared folders:
docker run –it --name shared1 –h shared1 –v /:/hostOS centos /bin/bash
cat /hostOS/etc/shadow
 Although the root folder of the Docker Host is shared, we cannot access
sensitive system file such as /etc/shadow. Sensitive business data will still be
accessible.
So, security?
 Privileged containers
 From the Docker Host to connect to a non-privileged container and run:
docker exec –it [container-name] /bin/bash
ls /dev
 Now to create a privileged container and run the same command:
docker run -it --privileged --name priv1 –h priv1 centos /bin/bash
ls /dev
 As we can see, the privileged container can access a lot more hardware than
the non-privileged container
So, security?
 Privileged containers
 But, is that all?
 Lets create a privileged container from the Docker host with shared folders:
docker run -it --privileged --name privshared1 –h privshared1 –v /:/hostOS centos
/bin/bash
cat /hostOS/etc/shadow
 As we can see it is privileged to access sensitive files.
 Note that if developers use containers with the docker socket file
(docker.sock) shared in to the container so that they can run docker
commands from within the container, the same command can be run leading
to privilege escalation on the Docker Host.
Conclusions
 There are many more settings that can be discussed, we only discussed some
of the options.
 Docker is a technology that is in development, it is relatively young but
developing quickly.
 Can save companies a lot of money but can also cause a lot of damage if used
incorrectly.
 This is true to most technology.
 Humans need to manage technology correctly.
 As long as we use it right, it will serve us right 
Thank you!!
Yigal Elefant
DevSecOps IL meetup - https://www.meetup.com/DevSecOps-Israel/
Yigal@ysqrd.net

More Related Content

What's hot

dockerizing web application
dockerizing web applicationdockerizing web application
dockerizing web applicationWalid Ashraf
 
Tech talk on docker with demo
Tech talk on docker with demoTech talk on docker with demo
Tech talk on docker with demoSandeep Karnawat
 
Docker introduction
Docker introductionDocker introduction
Docker introductiondotCloud
 
Introduction to docker security
Introduction to docker securityIntroduction to docker security
Introduction to docker securityWalid Ashraf
 
Docker, Linux Containers (LXC), and security
Docker, Linux Containers (LXC), and securityDocker, Linux Containers (LXC), and security
Docker, Linux Containers (LXC), and securityJérôme Petazzoni
 
Docker Introductory workshop
Docker Introductory workshopDocker Introductory workshop
Docker Introductory workshopRuncy Oommen
 
Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...
Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...
Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...Jérôme Petazzoni
 
Docker Security Paradigm
Docker Security ParadigmDocker Security Paradigm
Docker Security ParadigmAnis LARGUEM
 
Docker Security Overview
Docker Security OverviewDocker Security Overview
Docker Security OverviewSreenivas Makam
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to dockerWalid Ashraf
 
Docker puebla bday #4 celebration
Docker puebla bday #4 celebrationDocker puebla bday #4 celebration
Docker puebla bday #4 celebrationRamon Morales
 
How Secure Is Your Container? ContainerCon Berlin 2016
How Secure Is Your Container? ContainerCon Berlin 2016How Secure Is Your Container? ContainerCon Berlin 2016
How Secure Is Your Container? ContainerCon Berlin 2016Phil Estes
 
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...Codemotion
 
Docker introduction for the beginners
Docker introduction for the beginnersDocker introduction for the beginners
Docker introduction for the beginnersJuneyoung Oh
 
Docker: the road ahead
Docker: the road aheadDocker: the road ahead
Docker: the road aheadshykes
 
LXC, Docker, security: is it safe to run applications in Linux Containers?
LXC, Docker, security: is it safe to run applications in Linux Containers?LXC, Docker, security: is it safe to run applications in Linux Containers?
LXC, Docker, security: is it safe to run applications in Linux Containers?Jérôme Petazzoni
 

What's hot (20)

dockerizing web application
dockerizing web applicationdockerizing web application
dockerizing web application
 
Tech talk on docker with demo
Tech talk on docker with demoTech talk on docker with demo
Tech talk on docker with demo
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
Introduction to docker security
Introduction to docker securityIntroduction to docker security
Introduction to docker security
 
Docker, Linux Containers (LXC), and security
Docker, Linux Containers (LXC), and securityDocker, Linux Containers (LXC), and security
Docker, Linux Containers (LXC), and security
 
Docker Introductory workshop
Docker Introductory workshopDocker Introductory workshop
Docker Introductory workshop
 
Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...
Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...
Cgroups, namespaces, and beyond: what are containers made from? (DockerCon Eu...
 
Docker Security Paradigm
Docker Security ParadigmDocker Security Paradigm
Docker Security Paradigm
 
Docker Security Overview
Docker Security OverviewDocker Security Overview
Docker Security Overview
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
Docker puebla bday #4 celebration
Docker puebla bday #4 celebrationDocker puebla bday #4 celebration
Docker puebla bday #4 celebration
 
How Secure Is Your Container? ContainerCon Berlin 2016
How Secure Is Your Container? ContainerCon Berlin 2016How Secure Is Your Container? ContainerCon Berlin 2016
How Secure Is Your Container? ContainerCon Berlin 2016
 
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
 
Docker allocating resources
Docker allocating resourcesDocker allocating resources
Docker allocating resources
 
The state of the swarm
The state of the swarmThe state of the swarm
The state of the swarm
 
Docker introduction for the beginners
Docker introduction for the beginnersDocker introduction for the beginners
Docker introduction for the beginners
 
Docker: the road ahead
Docker: the road aheadDocker: the road ahead
Docker: the road ahead
 
LXC, Docker, security: is it safe to run applications in Linux Containers?
LXC, Docker, security: is it safe to run applications in Linux Containers?LXC, Docker, security: is it safe to run applications in Linux Containers?
LXC, Docker, security: is it safe to run applications in Linux Containers?
 
Testing Docker Security Linuxlab 2017
Testing Docker Security Linuxlab 2017Testing Docker Security Linuxlab 2017
Testing Docker Security Linuxlab 2017
 
A Hands-on Introduction to Docker
A Hands-on Introduction to DockerA Hands-on Introduction to Docker
A Hands-on Introduction to Docker
 

Similar to Hands on introduction to docker security for docker newbies

Dockers & kubernetes detailed - Beginners to Geek
Dockers & kubernetes detailed - Beginners to GeekDockers & kubernetes detailed - Beginners to Geek
Dockers & kubernetes detailed - Beginners to GeekwiTTyMinds1
 
Docker and containers - Presentation Slides by Priyadarshini Anand
Docker and containers - Presentation Slides by Priyadarshini AnandDocker and containers - Presentation Slides by Priyadarshini Anand
Docker and containers - Presentation Slides by Priyadarshini AnandPRIYADARSHINI ANAND
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014Carlo Bonamico
 
Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020CloudHero
 
Accelerate your development with Docker
Accelerate your development with DockerAccelerate your development with Docker
Accelerate your development with DockerAndrey Hristov
 
Accelerate your software development with Docker
Accelerate your software development with DockerAccelerate your software development with Docker
Accelerate your software development with DockerAndrey Hristov
 
Running the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerRunning the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerGuido Schmutz
 
Docker for .NET Developers
Docker for .NET DevelopersDocker for .NET Developers
Docker for .NET DevelopersTaswar Bhatti
 
Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxIgnacioTamayo2
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 applicationRoman Rodomansky
 
Docker
DockerDocker
DockerNarato
 
Deploying .net core apps to Docker - dotnetConf Local Bengaluru
Deploying .net core apps to Docker - dotnetConf Local BengaluruDeploying .net core apps to Docker - dotnetConf Local Bengaluru
Deploying .net core apps to Docker - dotnetConf Local BengaluruSwaminathan Vetri
 
Agile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: IntroductionAgile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: IntroductionAgile Partner S.A.
 
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and JenkinsExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and JenkinsElasTest Project
 
Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Paul Chao
 

Similar to Hands on introduction to docker security for docker newbies (20)

Dockers & kubernetes detailed - Beginners to Geek
Dockers & kubernetes detailed - Beginners to GeekDockers & kubernetes detailed - Beginners to Geek
Dockers & kubernetes detailed - Beginners to Geek
 
Docker and containers - Presentation Slides by Priyadarshini Anand
Docker and containers - Presentation Slides by Priyadarshini AnandDocker and containers - Presentation Slides by Priyadarshini Anand
Docker and containers - Presentation Slides by Priyadarshini Anand
 
Docker
DockerDocker
Docker
 
Docker intro
Docker introDocker intro
Docker intro
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014
 
Docker Ecosystem on Azure
Docker Ecosystem on AzureDocker Ecosystem on Azure
Docker Ecosystem on Azure
 
Docker
DockerDocker
Docker
 
Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020
 
Accelerate your development with Docker
Accelerate your development with DockerAccelerate your development with Docker
Accelerate your development with Docker
 
Accelerate your software development with Docker
Accelerate your software development with DockerAccelerate your software development with Docker
Accelerate your software development with Docker
 
Running the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerRunning the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker Container
 
Docker for .NET Developers
Docker for .NET DevelopersDocker for .NET Developers
Docker for .NET Developers
 
Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptx
 
Docker dDessi november 2015
Docker dDessi november 2015Docker dDessi november 2015
Docker dDessi november 2015
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 application
 
Docker
DockerDocker
Docker
 
Deploying .net core apps to Docker - dotnetConf Local Bengaluru
Deploying .net core apps to Docker - dotnetConf Local BengaluruDeploying .net core apps to Docker - dotnetConf Local Bengaluru
Deploying .net core apps to Docker - dotnetConf Local Bengaluru
 
Agile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: IntroductionAgile Brown Bag - Vagrant & Docker: Introduction
Agile Brown Bag - Vagrant & Docker: Introduction
 
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and JenkinsExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
 
Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Docker workshop 0507 Taichung
Docker workshop 0507 Taichung
 

Recently uploaded

WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 

Hands on introduction to docker security for docker newbies

  • 1. Hands-On Introduction to Docker Security for Docker Newbies Presented by: Yigal Elefant DevSecOps IL Ysquared
  • 2. #WhoAmI  Yigal Elefant  Technology Enthusiast  Lead SDLC implementation  Analyst & Security researcher  Lecturer Guide  Married + 1
  • 3. What’s the plan?  Initial Introduction to Docker  1st run of Docker  The Docker Components  Playing some more with the Docker  Understanding the Docker building blocks  So, security?  Concluding the journey
  • 4. What is Docker? Docker is the world’s leading software container platform. Developers use Docker to eliminate “works on my machine” problems when collaborating on code with co-workers. Operators use Docker to run and manage apps side-by-side in isolated containers to get better compute density. Enterprises use Docker to build agile software delivery pipelines to ship new features faster, more securely and with confidence for both Linux and Windows Server apps. (www.docker.com)
  • 5. What is Docker? Docker allows you to package an application with all of its dependencies into a standardized unit for software development. (www.quru.com)
  • 6. OK, lets start  Connect to Docker Host  Run command: docker run hello-world For this presentation I am using CentOS 7.0.1406 with Docker version 1.12.6.
  • 8. Docker Components  Docker Registry – A server distributing Docker Images. Images can be kept privately or publicly and can be downloaded and uploaded. The biggest public registry known is Docker Hub.  Docker Images – Read-only templates used to create containers. An image can contain an operating system, an application, an operating system with applications installed and configured. An image can be created independently or downloaded from public registries.  Docker Container – The active part of the Docker environment. Each container is created from an image and it can be run, stopped, started, moved, etc.
  • 9. Docker Components  Docker Daemon – The main Docker process on the Docker Host. Listens for commands from the Docker Client or from a REST API that it publishes.  Docker Client – Docker runs as client-server. Docker client allows sending the docker commands, receives the data from the Daemon and prints it.  Docker Host – The machine running the Docker Daemon.
  • 10. Docker Commands  docker run [options] image:version [command] Run a container from an image  “-d”: detached mode  “-t”: TTY  “-i”: interactive  “--name”: set a name for the container.  “-P”: Expose the default ports needed for this container.  “-p”: Expose specified ports to this container. Syntax: <host-interface>:<host- port>:<container-port>  “-v”: Mount the specified volume on the container. Syntax: /host/volume:/container/volume  “--readonly”: Mount the container's root filesystem as read only.  “--rm”: Automatically remove the container when it exits.
  • 11. Docker Commands  docker pull image:version pull an image from the registry  docker exec [options] container-name [command] execute a command on an active container  docker attach container-name attach to a running container
  • 12. Docker Commands  docker build build an image from a Dockerfile  docker push name push an image to the Registry  docker info show information about the docker environment  docker inspect name show detailed information about containerimagetask
  • 13. Docker Commands  docker rm name Remove a container  docker rmi name Remove image
  • 14. Playing some more docker run –d --name nginx1 –h nginx1 –P nginx docker run –dit --name c1 –h c1 centos /bin/bash docker run –it --name c2 –h c2 centos /bin/bash docker run –d –p 33003:80 --name nginx2 –h nginx2 nginx
  • 15. The Docker Building Blocks  UnionFS (Union File System) File systems that operate by creating layers, making them very lightweight and fast. Docker uses union file systems to provide the building blocks for containers  Namespaces A technology used to organize objects of various kinds in a separate environment.  Linux Containers (LXC) Allows running processes separately from each other. Uses namespaces and cgroups for this.
  • 16. The Docker Building Blocks  cgroups (control groups) “Linux kernel feature to limit, account for and isolate the resource usage (CPU, Memory, disk I/O, network, etc.) of a collection of processes.” (Wikipedia)
  • 18. So, security?  Is a container opaque?  With running containers, from the Docker Host run the command: ps –ef  As we can see in the result, the Docker Host can see the processes running within containers.
  • 19. So, security?  Docker Host OS hardening  From the Docker Host run the command: df –h  This is to demonstrate that unless a partition was created for the Docker data (/var/lib/docker), this can quickly fill up our HDD and block our access to the Docker Host.
  • 20. So, security?  Can containers communicate with each other?  Lets try this with the default environment settings: docker run -d --name nginx3 -P nginx docker inspect nginx3 | egrep “Name|IPAddress” docker run –it --name netest –h netest centos /bin/bash curl 172.17.0.4:80 (The internal IP address found using the inspect command)  As we can see, by default Docker containers can communicate even without defining this. This is due to ICC – Inter Container Communication, that is set by default to “true”. This is a setting in the Docker Daemon that can be changed to “false”.
  • 21. So, security?  Sharing folders to the container  From the Docker Host, create a container with shared folders: docker run –it --name shared1 –h shared1 –v /:/hostOS centos /bin/bash cat /hostOS/etc/shadow  Although the root folder of the Docker Host is shared, we cannot access sensitive system file such as /etc/shadow. Sensitive business data will still be accessible.
  • 22. So, security?  Privileged containers  From the Docker Host to connect to a non-privileged container and run: docker exec –it [container-name] /bin/bash ls /dev  Now to create a privileged container and run the same command: docker run -it --privileged --name priv1 –h priv1 centos /bin/bash ls /dev  As we can see, the privileged container can access a lot more hardware than the non-privileged container
  • 23. So, security?  Privileged containers  But, is that all?  Lets create a privileged container from the Docker host with shared folders: docker run -it --privileged --name privshared1 –h privshared1 –v /:/hostOS centos /bin/bash cat /hostOS/etc/shadow  As we can see it is privileged to access sensitive files.  Note that if developers use containers with the docker socket file (docker.sock) shared in to the container so that they can run docker commands from within the container, the same command can be run leading to privilege escalation on the Docker Host.
  • 24. Conclusions  There are many more settings that can be discussed, we only discussed some of the options.  Docker is a technology that is in development, it is relatively young but developing quickly.  Can save companies a lot of money but can also cause a lot of damage if used incorrectly.  This is true to most technology.  Humans need to manage technology correctly.  As long as we use it right, it will serve us right 
  • 25. Thank you!! Yigal Elefant DevSecOps IL meetup - https://www.meetup.com/DevSecOps-Israel/ Yigal@ysqrd.net

Editor's Notes

  1. אז עכשיו שהכל ברור, נתקדם ונשחק עם זה.
  2. אז עכשיו שהכל ברור, נתקדם ונשחק עם זה.
  3. אז עכשיו שהכל ברור, נתקדם ונשחק עם זה.
  4. אז עכשיו שהכל ברור, נתקדם ונשחק עם זה.
  5. אז, מה אנחנו רואים פה? מה קרה פה בעצם?
  6. מומלץ להזהר בפקודת ה attack, אפשר להתחבר לתהליך רץ אם התחברנו... Ctrl+p, ctrl+q
  7. Unionfs – first introduced in 1993 but was not completed until several years later. Only in 2014 a version of unionfs is part of the Linux Kernel Namespaces first introduces in 2002 LXC is introduced in 2008
  8. Unionfs – first introduced in 1993 but was not completed until several years later. Only in 2014 a version of unionfs is part of the Linux Kernel Namespaces first introduces in 2002 LXC is introduced in 2008 Cgroups developed starting 2006, added to the linux kernel in 2008