SlideShare une entreprise Scribd logo
1  sur  95
Télécharger pour lire hors ligne
Lyon
30th May 2018
Docker Security :
Back to Basics
● Hosts Security
●
● Docker Engine
●
● Image Build and sign
●
● Opensource Tools
Agenda
Rachid
Zarouali
R.S.I Synolia
Docker CommunityLeader
Docker Captain
Twitter / Slack : @xinity
rzarouali@gmail.com
Disclaimer I
Disclaimer I
Introduction
buckle up for safety
● security is :
○ Everyone's responsibility
○ Necessary
○ Is not hard
○ A never ending story
○
● But we are lazy when it’s come to it
!!!!
○
Who, Why, How, When
Questions : https://www.slido.com Room: #B821
Ecosystem
And many many more ….
Questions : https://www.slido.com Room: #B821
● docker run -d -v /:/srv ……
●
● docker run -d --cap-add=ALL …. (*)
●
● docker run -d --privileged ….
(*):
https://docs.docker.com/engine/reference/run/#runtime-privilege-a
nd-linux-capabilities
(bad) habits I
Questions : https://www.slido.com Room: #B821
● docker exec -ti monapache bash
○ apt install mysql-server
○
● docker exec -ti mycontainer bash
○ apt full-upgrade
●
(bad) habits II
Questions : https://www.slido.com Room: #B821
Security Topics
Docker Security Features :
○ Image building and Signing
○ Security Scanning
○ Docker Content Trust
○
Linux Security Features :
○ Kernel Capabilities
○ Seccomp
○ AppArmor
Questions : https://www.slido.com Room: #B821
Back to basics
Anatomy of a container
Anatomy of a container
User Space:
● Binaries
● Libraries
● Dependencies
Kernel Space:
● Process tree
● Filesystem root
● Network
● Limits on resource
Questions : https://www.slido.com Room: #B821
Anatomy of a container
Namespaces:
● The PID namespace stops
processes in one container from
seeing processes in another
container (or on the host)
● The User namespace allows
containers to run processes as
root inside the container but as
non-privileged users outside the
container (on the host)
Cgroups:
● Can limit the amount of CPU or
memory a container can use,
and prevent them from
consuming all system resource
Questions : https://www.slido.com Room: #B821
Anatomy of a container
Namespaces
Cgroup Cgroup root directory
IPC System V IPC, POSIX message queues
Network Network devices, stacks, ports, etc.
Mount Mount points
PID Process IDs
User User and group IDs (disabled by default)
UTS Hostname and NIS domain name
Cgroups
Memory
CPU
Blkio
Cpuacct
Cpuset
Devices
Net_prio
Freezer
Questions : https://www.slido.com Room: #B821
Back to basics
Demo
Docker Hosts
Who’s going to host your containers ??
Docker hosts
● Different implementations
○ RancherOS
○ AtomicOS
○ CoreOS
○ LinuxKit ….
Questions : https://www.slido.com Room: #B821
Docker hosts
● RancherOS
Questions : https://www.slido.com Room: #B821
Docker hosts
● RancherOS
○ Full Docker Based
○ Multiple console / engine
○ Stateless by default
○ Easy to manage
○ Integration with Rancher
○ ISO: 85mb
Questions : https://www.slido.com Room: #B821
Docker hosts
● AtomicOS
○ Striped down fedora with docker
○ K8s oriented
○ Full containerOS
○ Integration with Cockpit/Openshift
○ ISO: ~ 900mb
Questions : https://www.slido.com Room: #B821
Docker hosts
● CoreOS
○ Rkt / Docker support
○ Tricky management
○ Integration with tectonic
○ Acquired by RedHat
○ ISO: ~ 350 mb
Questions : https://www.slido.com Room: #B821
Docker hosts
● LinuxKit
○ Full Docker Based
○ K8s support
○ Highly stripped down
○ Modular build (moby project)
○ System developer oriented
○ ISO: < 30 mb
Questions : https://www.slido.com Room: #B821
Docker hosts
Demo
Docker images
Build, Ship, Run
Docker images
Image: several read-only layers build from a Dockerfile
Container: Image + read-write layer
I.e: `docker run -ti debian:stretch-slim bash`
Questions : https://www.slido.com Room: #B821
Docker images
Questions : https://www.slido.com Room: #B821
Docker images
More layers mean :
● larger image
● longer build, push and pull from a registry
Small images mean :
● faster build and deploy
● small surface of attack
Q: Are small images always secure ?
Questions : https://www.slido.com Room: #B821
Docker images
How to reduce layers number:
● Share base image as much as possible
● Limit data written to the layer (nothing unnecessary)
● Chain RUN statements
Questions : https://www.slido.com Room: #B821
Docker images
FROM ubuntu:latest
LABEL maintainer abbyfull@amazon.com
RUN apt-get update -y && apt-get install -y python-pip
python-dev build-essential
COPY . /app
WORKDIR /app
RUN pip install –r requirements.txt
EXPOSE 5000
ENTRYPOINT ["python"]
CMD ["application.py"]
Questions : https://www.slido.com Room: #B821
Docker images
FROM python:2.7-alpine
LABEL maintainer abbyfull@amazon.com
ONBUILD ADD requirements.txt /app
ONBUILD RUN pip install –r /app/requirements.txt
ONBUILD COPY . /app
WORKDIR /app
EXPOSE 5000
ENTRYPOINT ["python"]
CMD ["application.py"]
Questions : https://www.slido.com Room: #B821
Docker images
Use minimalist base images
● Smaller images reduce the attack surface
● The official Alpine base image is <5MB‘
Use official images as base images
● All official images are scanned for vulnerabilities
● Usually follow best practices
Questions : https://www.slido.com Room: #B821
Docker images
Pull images by digest ‘Image digests are a hash of the image’s config object )
● This makes them immutable
● If the contents of the image are changed/tampered with,
the digest will be different
⇒ If Docker Content Trust is enabled all images are pulled by digest
Questions : https://www.slido.com Room: #B821
Docker images
Image signing
Docker Content Trust
Based on Notary
Uses a trust on first use model (TOFU)
Used to sign and verify an image
Secured Image Lifecycle:
● Push <-> Pull
● Build <-> Run
Questions : https://www.slido.com Room: #B821
Docker Content Trust
Questions : https://www.slido.com Room: #B821
Docker Content Trust
Provides:
● Digital signature mechanism
● Collaboration (signing delegation)
● Key expiration
● Collections signatures (multiple images with the same key)
Questions : https://www.slido.com Room: #B821
Docker Content Trust
$ docker pull repo/image:unsigned
…
Error: No trust data for unsigned
⇒ Unsigned image, image pull denied
Questions : https://www.slido.com Room: #B821
Docker Content Trust
$ docker pull repo/image:fakesignature
Warning: potential malicious behavior - trust data has
insufficient signatures for remote repository
docker.io/repo/image: valid signatures did not meet
threshold
⇒ fake signature detected, image pull denied
Questions : https://www.slido.com Room: #B821
Docker Content Trust
$ docker pull repo/image:stale
Error: remote repository docker.io/repo/image out-of-date:
targets expired at Sun Mar 26 03:56:12 PDT 2017
⇒ signing key expired, image pull denied
Questions : https://www.slido.com Room: #B821
Docker Content Trust
Questions : https://www.slido.com Room: #B821
Docker Content Trust
Questions : https://www.slido.com Room: #B821
Docker images
Demo: Image Signing
Docker images
Security Scan
Security Scan
Tool/service that scans images for vulnerabilities
● Operates in the background
● Performs deep binary-level scanning of image layers
● Checks against database(s) of known vulnerabilities
● Provides detailed vulnerability report
● Uses CVE databases
Questions : https://www.slido.com Room: #B821
Security Scan
Available hosted:
● Docker cloud
● Docker hub private repo
On premise:
● Supported: DockerEE (Advanced subscription)
● Opensource*: Harbor / Portus
*: Uses CoreOS Clair : https://github.com/coreos/clair
Questions : https://www.slido.com Room: #B821
Security Scan
⇒ small image always secure ??
Questions : https://www.slido.com Room: #B821
Security Scan
Questions : https://www.slido.com Room: #B821
Docker images
Demo : Security Scan
User Management
Dockerd requires root access
● Uses kernel features like namespaces
Verify root access of dockerd:
$ ps ufaxw | grep dockerd
Questions : https://www.slido.com Room: #B821
User Management
By default dockerd listens on /var/run/docker.sock
● Non-networked , local Unix socket
● Own by dockerd group
○ $ ls -l /var/run/docker.sock
○ srw-rw---- 1 root docker 0 Mar 30 09:15 /var/run/docker.sock
Questions : https://www.slido.com Room: #B821
User Management
● Non root user should be member of docker
group
○ $ sudo usermod -aG docker xinity
○ $ id xinity
Questions : https://www.slido.com Room: #B821
User Management
By default containers runs as root /!
$ docker container run -v /:/srv -it --rm alpine sh
# whoami
root
# id
uid=0(root) gid=0(root)
# rm -rf /srv/*
Questions : https://www.slido.com Room: #B821
User Management
By default root inside == root outside of a container
● $ docker container run --user 1000:1000 
-v /:/srv -it --rm alpine sh
● / $ id
● uid=1000 gid=1000
● $ rm /srv/*
● rm: can't remove '/srv/*': Permission denied
● $ ps
Questions : https://www.slido.com Room: #B821
User Management
User namespaces:
● Been in the Linux kernel for a while
● Supported in Docker since 1.10
How it works:
● Give a container its own isolated set of UIDs and GIDs
● These isolated UIDs and GIDs inside the container are mapped to
non-privileged UIDs and GIDs on the Docker host.
Questions : https://www.slido.com Room: #B821
User Management
Questions : https://www.slido.com Room: #B821
User Management
User namespaces: example
● $ sudo systemctl stop docker
● $ sudo dockerd --userns-remap=default &
INFO[0000] User namespaces: ID ranges will be mapped to
subuid/subgid…
…..
● $ docker run -v /:/srv -it --rm alpine sh
● # id
● uid=0(root) gid=0(root) …
● / # rm /host/bin/sh
● rm: can't remove '/host/bin/sh': Permission denied
Questions : https://www.slido.com Room: #B821
User Management
$ sudo dockerd --userns-remap=default &
The --userns-remap flag uses mappings defined in:
● /etc/subuid /etc/subgid
Questions : https://www.slido.com Room: #B821
User Management
Mapping to the default user namespace uses the dockermap user and group
Mappings contain three fields:
● User or group name
● Starting subordinate UID/GID
● Number of subordinate UIDs/GIDs available
Questions : https://www.slido.com Room: #B821
User Management
When you start Docker with the --userns-remap flag the daemon runs within
the confined user namespace.
● As part of the implementation a new Docker environment is created
under /var/lib/docker
● The name of this new subdirectory the mapped UID and the mapped GID
This remapped daemon will operate inside of this 231072.231072 environment
● All of you previously pulled images etc will be inaccessible to this
● remapped daemon
Questions : https://www.slido.com Room: #B821
User Management
You can verify the namespace that the daemon is running in
with the docker info command
It is not recommended to regularly
stop and restart the daemon
in new user Namespaces
• Mainly because you cannot access
images etc. in other namespaces (including the global namespace)
Questions : https://www.slido.com Room: #B821
User Management
You can verify the namespace that the daemon is running in
with the docker info command
It is not recommended to regularly stop and restart the
daemon in new user namespaces
• Mainly because you cannot access images etc. in other
namespaces (including the global namespace)
Questions : https://www.slido.com Room: #B821
User Management
Questions : https://www.slido.com Room: #B821
User Management
Demo : UserNS
Linux Capabilities
Linux Kernel Capabilities
The Unix world has traditionally divided process into two categories:
● Privileged (root)
● Unprivileged (non-root)
Privileged processes bypass all kernel permission checks
Unprivileged process are subject to all kernel permission checks
Questions : https://www.slido.com Room: #B821
Linux Kernel Capabilities
This all or nothing approach often led to processes running as root when
they really only needed a small subset of the privileges assigned to root
processes.
Modern Linux kernels slice root privileges into smaller chunks called
Capabilities.
It is now possible to assign some root privileges to a process without assigning
them all.
Questions : https://www.slido.com Room: #B821
Linux Kernel Capabilities
A container running a web server that only needs to bind to a port below 1024
does not need to run as root! Should not run as root!
It might be enough to drop all capabilities for that container except
CAP_NET_BIND_SERVICE.
If an intruder is able to escalate to root within the web server container they will
be limited to binding to low numbered privileged ports.
They won’t be able to bypass file ownership checks, kill processes, lock memory,
create special files, modify routing tables, set promiscuous mode, setuid, load
kernel modules, chroot, renice processes, ptrace, change the clock etc...
Net result = reduced attack surface!
Questions : https://www.slido.com Room: #B821
Linux Kernel Capabilities
Docker operates a whitelist
approach to implementing
capabilities.
● If a capability isn’t on the
whitelist it is dropped.
● The list shows the current
capabilities whitelist for the
default profile.
● https://github.com/docker/dock
er/blob/master/oci/defaults_lin
ux.go#L62-L77
Questions : https://www.slido.com Room: #B821
Linux Kernel Capabilities
You can use the --cap-add and --cap-drop flags to add an remove
capabilities from a container.
To drop the CAP_NET_BIND_SERVICE capability form a container:
Questions : https://www.slido.com Room: #B821
Linux Kernel Capabilities
To drop all except the CAP_NET_BIND_SERVICE:
To add the CAP_CHOWN capability to a container:
Questions : https://www.slido.com Room: #B821
Linux Kernel Capabilities
Docker cannot currently add capabilities to non-root users
● All of the examples shown in the slides have been adding and
removing capabilities from containers running as root
Privilege escalation is difficult without file-related capabilities
● File-related capabilities are stored in a file’s extended attributes
● Extended attributes are stripped out when Docker Images are built
Questions : https://www.slido.com Room: #B821
Linux Kernel Capabilities
Demo : Capabilities
AppArmor
Mandatory Access Control
AppArmor
AppArmor is a Linux kernel security module.
You define profiles that control access to specific resources such as files and
the network.
Sane defaults:
- Preventing writing to /proc/{num}, /proc/sys, /sys
- Preventing mount
You can apply these profiles to applications and containers.
Use the docker info command to see if AppArmor is installed and available
Questions : https://www.slido.com Room: #B821
AppArmor
Docker creates and loads a default AppArmor profile for
containers called docker-default
● Sensible defaults
● Based on
https://github.com/docker/docker/blob/master/profiles/apparmo
r/template.go
A profile for the Docker daemon exists but is not installed and used by
default
Questions : https://www.slido.com Room: #B821
AppArmor
Questions : https://www.slido.com Room: #B821
AppArmor
You can override the default container profile (docker-default) with the
--security-opt flag
Questions : https://www.slido.com Room: #B821
AppArmor
Use the aa-status command to see the status of AppArmor profiles
Questions : https://www.slido.com Room: #B821
AppArmor
Demo
SecComp
Syscalls Filtering
SecComp
seccomp is a Linux kernel module that acts like a firewall for syscalls
● In the mainline Linux kernel since 2005
● Supported in Docker since Docker 1.10
Using seccomp-bpf (Berkley Packet Filters) is an extension that makes seccomp
more flexible and granular
● You can create policies that allow granular control of which syscalls are
allowed and which are not
Docker allows you to associate seccomp policies with containers
● The aim is to control (limit) a containers access to the Docker host’s kernel
Questions : https://www.slido.com Room: #B821
SecComp
seccomp needs to be enabled in the Docker host’s kernel as well as in the
Docker Engine.
To check for seccomp in the kernel
To check for seccomp in Docker:
Questions : https://www.slido.com Room: #B821
SecComp
Docker automatically applies the default seccomp policy to new containers
The aim of the default policy is to provide a sensible out-of-the-box policy
You should consider the default policy as moderately protective while providing
wide application compatibility
The default policy disables over 40 syscalls (Linux has over 300 syscalls)
https://github.com/docker/docker/blob/master/profiles/seccomp/default.json
Questions : https://www.slido.com Room: #B821
SecComp
You can use the --security-opt flag to force containers to run within a custom
seccomp policy
Docker seccomp profiles operate using a whitelist approach that specifies
allowed syscalls. Only syscalls on the whitelist are permitted
Questions : https://www.slido.com Room: #B821
SecComp
You can run containers without a seccomp policy applied
● This is call running a container unconfined
⇒ It is not recommended to run containers unconfined!
Questions : https://www.slido.com Room: #B821
Seccomp
Demo : Seccomp
Opensource Tools
Docker Bench Security
Open-source tool for running automated tests
● Inspired by the CIS Docker 1.13 benchmark
● Regularly updated
Checks Docker host
Runs against containers on same host
• Checks for AppArmor, read-only volumes, etc...
• https://dockerbench.com
Questions : https://www.slido.com Room: #B821
Docker Bench Security
Questions : https://www.slido.com Room: #B821
Docker Bench Security
Run as a container
Runs with a lot of privileges !!
As It needs to run tests
Against the Docker host
Questions : https://www.slido.com Room: #B821
On more thing !
Guess what ?
I’M HIRING !!!!
https://www.synolia.com/carrieres/offres-d-emplois/13631/
Questions : https://www.slido.com Room: #B821
Questions ??
Yes ! you do ! don’t be shy
Questions : https://www.slido.com Room: #B821

Contenu connexe

Tendances

Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Jen Andre
 
Under the Dome (of failure driven pipeline)
Under the Dome (of failure driven pipeline)Under the Dome (of failure driven pipeline)
Under the Dome (of failure driven pipeline)Maciej Lasyk
 
Containers Roadshow: How to Develop Containers for the Enterprise
Containers Roadshow: How to Develop Containers for the EnterpriseContainers Roadshow: How to Develop Containers for the Enterprise
Containers Roadshow: How to Develop Containers for the EnterpriseHonza Horák
 
BBL Premiers pas avec Docker
BBL Premiers pas avec DockerBBL Premiers pas avec Docker
BBL Premiers pas avec Dockerkanedafromparis
 
Dependency Management with Composer
Dependency Management with ComposerDependency Management with Composer
Dependency Management with ComposerJordi Boggiano
 
Rapid JCR Applications Development with Sling
Rapid JCR Applications Development with SlingRapid JCR Applications Development with Sling
Rapid JCR Applications Development with SlingFelix Meschberger
 
Everything-as-code. A polyglot adventure. #DevoxxPL
Everything-as-code. A polyglot adventure. #DevoxxPLEverything-as-code. A polyglot adventure. #DevoxxPL
Everything-as-code. A polyglot adventure. #DevoxxPLMario-Leander Reimer
 
Как мы взломали распределенные системы конфигурационного управления
Как мы взломали распределенные системы конфигурационного управленияКак мы взломали распределенные системы конфигурационного управления
Как мы взломали распределенные системы конфигурационного управленияPositive Hack Days
 
Docker orchestration voxxed days berlin 2016
Docker orchestration   voxxed days berlin 2016Docker orchestration   voxxed days berlin 2016
Docker orchestration voxxed days berlin 2016Grzegorz Duda
 
Reconstructing Gapz: Position-Independent Code Analysis Problem
Reconstructing Gapz: Position-Independent Code Analysis ProblemReconstructing Gapz: Position-Independent Code Analysis Problem
Reconstructing Gapz: Position-Independent Code Analysis ProblemAlex Matrosov
 
Practical git for developers
Practical git for developersPractical git for developers
Practical git for developersWim Godden
 
Repoinit: a mini-language for content repository initialization
Repoinit: a mini-language for content repository initializationRepoinit: a mini-language for content repository initialization
Repoinit: a mini-language for content repository initializationBertrand Delacretaz
 
Vagrant move over, here is Docker
Vagrant move over, here is DockerVagrant move over, here is Docker
Vagrant move over, here is DockerNick Belhomme
 
TakeDownCon Rocket City: WebShells by Adrian Crenshaw
TakeDownCon Rocket City: WebShells by Adrian CrenshawTakeDownCon Rocket City: WebShells by Adrian Crenshaw
TakeDownCon Rocket City: WebShells by Adrian CrenshawEC-Council
 
Advanced Evasion Techniques by Win32/Gapz
Advanced Evasion Techniques by Win32/GapzAdvanced Evasion Techniques by Win32/Gapz
Advanced Evasion Techniques by Win32/GapzAlex Matrosov
 
COSCUP 2016 - ROS + Gazebo機器人模擬器工作坊
COSCUP 2016 - ROS + Gazebo機器人模擬器工作坊COSCUP 2016 - ROS + Gazebo機器人模擬器工作坊
COSCUP 2016 - ROS + Gazebo機器人模擬器工作坊Po-Jen Lai
 
Building an Apache Sling Rendering Farm
Building an Apache Sling Rendering FarmBuilding an Apache Sling Rendering Farm
Building an Apache Sling Rendering FarmBertrand Delacretaz
 
Joxean Koret - Database Security Paradise [Rooted CON 2011]
Joxean Koret - Database Security Paradise [Rooted CON 2011]Joxean Koret - Database Security Paradise [Rooted CON 2011]
Joxean Koret - Database Security Paradise [Rooted CON 2011]RootedCON
 
How to do everything with PowerShell
How to do everything with PowerShellHow to do everything with PowerShell
How to do everything with PowerShellJuan Carlos Gonzalez
 

Tendances (20)

Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'Codetainer: a Docker-based browser code 'sandbox'
Codetainer: a Docker-based browser code 'sandbox'
 
Under the Dome (of failure driven pipeline)
Under the Dome (of failure driven pipeline)Under the Dome (of failure driven pipeline)
Under the Dome (of failure driven pipeline)
 
Containers Roadshow: How to Develop Containers for the Enterprise
Containers Roadshow: How to Develop Containers for the EnterpriseContainers Roadshow: How to Develop Containers for the Enterprise
Containers Roadshow: How to Develop Containers for the Enterprise
 
BBL Premiers pas avec Docker
BBL Premiers pas avec DockerBBL Premiers pas avec Docker
BBL Premiers pas avec Docker
 
Dependency Management with Composer
Dependency Management with ComposerDependency Management with Composer
Dependency Management with Composer
 
Rapid JCR Applications Development with Sling
Rapid JCR Applications Development with SlingRapid JCR Applications Development with Sling
Rapid JCR Applications Development with Sling
 
Everything-as-code. A polyglot adventure. #DevoxxPL
Everything-as-code. A polyglot adventure. #DevoxxPLEverything-as-code. A polyglot adventure. #DevoxxPL
Everything-as-code. A polyglot adventure. #DevoxxPL
 
Как мы взломали распределенные системы конфигурационного управления
Как мы взломали распределенные системы конфигурационного управленияКак мы взломали распределенные системы конфигурационного управления
Как мы взломали распределенные системы конфигурационного управления
 
Docker orchestration voxxed days berlin 2016
Docker orchestration   voxxed days berlin 2016Docker orchestration   voxxed days berlin 2016
Docker orchestration voxxed days berlin 2016
 
Reconstructing Gapz: Position-Independent Code Analysis Problem
Reconstructing Gapz: Position-Independent Code Analysis ProblemReconstructing Gapz: Position-Independent Code Analysis Problem
Reconstructing Gapz: Position-Independent Code Analysis Problem
 
Practical git for developers
Practical git for developersPractical git for developers
Practical git for developers
 
Repoinit: a mini-language for content repository initialization
Repoinit: a mini-language for content repository initializationRepoinit: a mini-language for content repository initialization
Repoinit: a mini-language for content repository initialization
 
Vagrant move over, here is Docker
Vagrant move over, here is DockerVagrant move over, here is Docker
Vagrant move over, here is Docker
 
TakeDownCon Rocket City: WebShells by Adrian Crenshaw
TakeDownCon Rocket City: WebShells by Adrian CrenshawTakeDownCon Rocket City: WebShells by Adrian Crenshaw
TakeDownCon Rocket City: WebShells by Adrian Crenshaw
 
Advanced Evasion Techniques by Win32/Gapz
Advanced Evasion Techniques by Win32/GapzAdvanced Evasion Techniques by Win32/Gapz
Advanced Evasion Techniques by Win32/Gapz
 
COSCUP 2016 - ROS + Gazebo機器人模擬器工作坊
COSCUP 2016 - ROS + Gazebo機器人模擬器工作坊COSCUP 2016 - ROS + Gazebo機器人模擬器工作坊
COSCUP 2016 - ROS + Gazebo機器人模擬器工作坊
 
Building an Apache Sling Rendering Farm
Building an Apache Sling Rendering FarmBuilding an Apache Sling Rendering Farm
Building an Apache Sling Rendering Farm
 
Joxean Koret - Database Security Paradise [Rooted CON 2011]
Joxean Koret - Database Security Paradise [Rooted CON 2011]Joxean Koret - Database Security Paradise [Rooted CON 2011]
Joxean Koret - Database Security Paradise [Rooted CON 2011]
 
How to do everything with PowerShell
How to do everything with PowerShellHow to do everything with PowerShell
How to do everything with PowerShell
 
Day CRX Introduction
Day CRX IntroductionDay CRX Introduction
Day CRX Introduction
 

Similaire à Securité des container

Start your container journey safely
Start your container journey safelyStart your container journey safely
Start your container journey safelyRachid Zarouali
 
Настройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'aНастройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'acorehard_by
 
Integration kubernetes with docker private registry
Integration kubernetes with docker private registryIntegration kubernetes with docker private registry
Integration kubernetes with docker private registryHungWei Chiu
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slidesDocker, Inc.
 
Docker and Your Path to a Better Staging Environment - webinar by Gil Tayar
Docker and Your Path to a Better Staging Environment - webinar by Gil TayarDocker and Your Path to a Better Staging Environment - webinar by Gil Tayar
Docker and Your Path to a Better Staging Environment - webinar by Gil TayarApplitools
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionBen Hall
 
Rooting Out Root: User namespaces in Docker
Rooting Out Root: User namespaces in DockerRooting Out Root: User namespaces in Docker
Rooting Out Root: User namespaces in DockerPhil Estes
 
Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016Ben Hall
 
Work shop - an introduction to the docker ecosystem
Work shop - an introduction to the docker ecosystemWork shop - an introduction to the docker ecosystem
Work shop - an introduction to the docker ecosystemJoão Pedro Harbs
 
How to create your own hack environment
How to create your own hack environmentHow to create your own hack environment
How to create your own hack environmentSumedt Jitpukdebodin
 
DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline  DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline Docker, Inc.
 
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
 
Developing and Deploying PHP with Docker
Developing and Deploying PHP with DockerDeveloping and Deploying PHP with Docker
Developing and Deploying PHP with DockerPatrick Mizer
 
Docker primer and tips
Docker primer and tipsDocker primer and tips
Docker primer and tipsSamuel Chow
 
Docker Introduction.pdf
Docker Introduction.pdfDocker Introduction.pdf
Docker Introduction.pdfOKLABS
 
Troubleshooting Tips from a Docker Support Engineer
Troubleshooting Tips from a Docker Support EngineerTroubleshooting Tips from a Docker Support Engineer
Troubleshooting Tips from a Docker Support EngineerJeff Anderson
 
Troubleshooting Tips from a Docker Support Engineer - Jeff Anderson, Docker
Troubleshooting Tips from a Docker Support Engineer - Jeff Anderson, DockerTroubleshooting Tips from a Docker Support Engineer - Jeff Anderson, Docker
Troubleshooting Tips from a Docker Support Engineer - Jeff Anderson, DockerDocker, Inc.
 
Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxIgnacioTamayo2
 
Docker Timisoara: Dockercon19 recap slides, 23 may 2019
Docker Timisoara: Dockercon19 recap slides, 23 may 2019Docker Timisoara: Dockercon19 recap slides, 23 may 2019
Docker Timisoara: Dockercon19 recap slides, 23 may 2019Radulescu Adina-Valentina
 

Similaire à Securité des container (20)

Start your container journey safely
Start your container journey safelyStart your container journey safely
Start your container journey safely
 
Настройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'aНастройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'a
 
Integration kubernetes with docker private registry
Integration kubernetes with docker private registryIntegration kubernetes with docker private registry
Integration kubernetes with docker private registry
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
 
Docker and Your Path to a Better Staging Environment - webinar by Gil Tayar
Docker and Your Path to a Better Staging Environment - webinar by Gil TayarDocker and Your Path to a Better Staging Environment - webinar by Gil Tayar
Docker and Your Path to a Better Staging Environment - webinar by Gil Tayar
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and Production
 
Rooting Out Root: User namespaces in Docker
Rooting Out Root: User namespaces in DockerRooting Out Root: User namespaces in Docker
Rooting Out Root: User namespaces in Docker
 
Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016
 
Work shop - an introduction to the docker ecosystem
Work shop - an introduction to the docker ecosystemWork shop - an introduction to the docker ecosystem
Work shop - an introduction to the docker ecosystem
 
How to create your own hack environment
How to create your own hack environmentHow to create your own hack environment
How to create your own hack environment
 
DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline  DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline
 
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
 
Developing and Deploying PHP with Docker
Developing and Deploying PHP with DockerDeveloping and Deploying PHP with Docker
Developing and Deploying PHP with Docker
 
Docker primer and tips
Docker primer and tipsDocker primer and tips
Docker primer and tips
 
Docker Introduction.pdf
Docker Introduction.pdfDocker Introduction.pdf
Docker Introduction.pdf
 
Troubleshooting Tips from a Docker Support Engineer
Troubleshooting Tips from a Docker Support EngineerTroubleshooting Tips from a Docker Support Engineer
Troubleshooting Tips from a Docker Support Engineer
 
Troubleshooting Tips from a Docker Support Engineer - Jeff Anderson, Docker
Troubleshooting Tips from a Docker Support Engineer - Jeff Anderson, DockerTroubleshooting Tips from a Docker Support Engineer - Jeff Anderson, Docker
Troubleshooting Tips from a Docker Support Engineer - Jeff Anderson, Docker
 
Learning Docker with Thomas
Learning Docker with ThomasLearning Docker with Thomas
Learning Docker with Thomas
 
Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptx
 
Docker Timisoara: Dockercon19 recap slides, 23 may 2019
Docker Timisoara: Dockercon19 recap slides, 23 may 2019Docker Timisoara: Dockercon19 recap slides, 23 may 2019
Docker Timisoara: Dockercon19 recap slides, 23 may 2019
 

Plus de Rachid Zarouali

Les containers docker vu par un chef cuisinier et un mécanicien
Les containers docker vu par un chef cuisinier et un mécanicienLes containers docker vu par un chef cuisinier et un mécanicien
Les containers docker vu par un chef cuisinier et un mécanicienRachid Zarouali
 
Containers explained as for cook and a mecanics
 Containers explained as for cook and a mecanics  Containers explained as for cook and a mecanics
Containers explained as for cook and a mecanics Rachid Zarouali
 
Devops rex tales of container security
Devops rex   tales of container securityDevops rex   tales of container security
Devops rex tales of container securityRachid Zarouali
 
Kit de Developpement Synolia
Kit de Developpement SynoliaKit de Developpement Synolia
Kit de Developpement SynoliaRachid Zarouali
 
Docker to the Rescue of an Ops Team
Docker to the Rescue of an Ops TeamDocker to the Rescue of an Ops Team
Docker to the Rescue of an Ops TeamRachid Zarouali
 
ContainerDays Hamburg 2017: Deploy Resilient E-Commerce Platform
ContainerDays Hamburg 2017: Deploy Resilient E-Commerce PlatformContainerDays Hamburg 2017: Deploy Resilient E-Commerce Platform
ContainerDays Hamburg 2017: Deploy Resilient E-Commerce PlatformRachid Zarouali
 
Percona: Integrate PMM within an existing monitoring platform
Percona: Integrate PMM within an existing monitoring platformPercona: Integrate PMM within an existing monitoring platform
Percona: Integrate PMM within an existing monitoring platformRachid Zarouali
 
Meetup afup 21/09/16: monitoring à SYNOLIA
Meetup afup 21/09/16: monitoring à SYNOLIAMeetup afup 21/09/16: monitoring à SYNOLIA
Meetup afup 21/09/16: monitoring à SYNOLIARachid Zarouali
 

Plus de Rachid Zarouali (8)

Les containers docker vu par un chef cuisinier et un mécanicien
Les containers docker vu par un chef cuisinier et un mécanicienLes containers docker vu par un chef cuisinier et un mécanicien
Les containers docker vu par un chef cuisinier et un mécanicien
 
Containers explained as for cook and a mecanics
 Containers explained as for cook and a mecanics  Containers explained as for cook and a mecanics
Containers explained as for cook and a mecanics
 
Devops rex tales of container security
Devops rex   tales of container securityDevops rex   tales of container security
Devops rex tales of container security
 
Kit de Developpement Synolia
Kit de Developpement SynoliaKit de Developpement Synolia
Kit de Developpement Synolia
 
Docker to the Rescue of an Ops Team
Docker to the Rescue of an Ops TeamDocker to the Rescue of an Ops Team
Docker to the Rescue of an Ops Team
 
ContainerDays Hamburg 2017: Deploy Resilient E-Commerce Platform
ContainerDays Hamburg 2017: Deploy Resilient E-Commerce PlatformContainerDays Hamburg 2017: Deploy Resilient E-Commerce Platform
ContainerDays Hamburg 2017: Deploy Resilient E-Commerce Platform
 
Percona: Integrate PMM within an existing monitoring platform
Percona: Integrate PMM within an existing monitoring platformPercona: Integrate PMM within an existing monitoring platform
Percona: Integrate PMM within an existing monitoring platform
 
Meetup afup 21/09/16: monitoring à SYNOLIA
Meetup afup 21/09/16: monitoring à SYNOLIAMeetup afup 21/09/16: monitoring à SYNOLIA
Meetup afup 21/09/16: monitoring à SYNOLIA
 

Dernier

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
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
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
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 

Dernier (20)

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)
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
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
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 

Securité des container

  • 1. Lyon 30th May 2018 Docker Security : Back to Basics
  • 2. ● Hosts Security ● ● Docker Engine ● ● Image Build and sign ● ● Opensource Tools Agenda
  • 3. Rachid Zarouali R.S.I Synolia Docker CommunityLeader Docker Captain Twitter / Slack : @xinity rzarouali@gmail.com
  • 7. ● security is : ○ Everyone's responsibility ○ Necessary ○ Is not hard ○ A never ending story ○ ● But we are lazy when it’s come to it !!!! ○ Who, Why, How, When Questions : https://www.slido.com Room: #B821
  • 8. Ecosystem And many many more …. Questions : https://www.slido.com Room: #B821
  • 9.
  • 10. ● docker run -d -v /:/srv …… ● ● docker run -d --cap-add=ALL …. (*) ● ● docker run -d --privileged …. (*): https://docs.docker.com/engine/reference/run/#runtime-privilege-a nd-linux-capabilities (bad) habits I Questions : https://www.slido.com Room: #B821
  • 11. ● docker exec -ti monapache bash ○ apt install mysql-server ○ ● docker exec -ti mycontainer bash ○ apt full-upgrade ● (bad) habits II Questions : https://www.slido.com Room: #B821
  • 12. Security Topics Docker Security Features : ○ Image building and Signing ○ Security Scanning ○ Docker Content Trust ○ Linux Security Features : ○ Kernel Capabilities ○ Seccomp ○ AppArmor Questions : https://www.slido.com Room: #B821
  • 13. Back to basics Anatomy of a container
  • 14. Anatomy of a container User Space: ● Binaries ● Libraries ● Dependencies Kernel Space: ● Process tree ● Filesystem root ● Network ● Limits on resource Questions : https://www.slido.com Room: #B821
  • 15. Anatomy of a container Namespaces: ● The PID namespace stops processes in one container from seeing processes in another container (or on the host) ● The User namespace allows containers to run processes as root inside the container but as non-privileged users outside the container (on the host) Cgroups: ● Can limit the amount of CPU or memory a container can use, and prevent them from consuming all system resource Questions : https://www.slido.com Room: #B821
  • 16. Anatomy of a container Namespaces Cgroup Cgroup root directory IPC System V IPC, POSIX message queues Network Network devices, stacks, ports, etc. Mount Mount points PID Process IDs User User and group IDs (disabled by default) UTS Hostname and NIS domain name Cgroups Memory CPU Blkio Cpuacct Cpuset Devices Net_prio Freezer Questions : https://www.slido.com Room: #B821
  • 18. Docker Hosts Who’s going to host your containers ??
  • 19. Docker hosts ● Different implementations ○ RancherOS ○ AtomicOS ○ CoreOS ○ LinuxKit …. Questions : https://www.slido.com Room: #B821
  • 20. Docker hosts ● RancherOS Questions : https://www.slido.com Room: #B821
  • 21. Docker hosts ● RancherOS ○ Full Docker Based ○ Multiple console / engine ○ Stateless by default ○ Easy to manage ○ Integration with Rancher ○ ISO: 85mb Questions : https://www.slido.com Room: #B821
  • 22. Docker hosts ● AtomicOS ○ Striped down fedora with docker ○ K8s oriented ○ Full containerOS ○ Integration with Cockpit/Openshift ○ ISO: ~ 900mb Questions : https://www.slido.com Room: #B821
  • 23. Docker hosts ● CoreOS ○ Rkt / Docker support ○ Tricky management ○ Integration with tectonic ○ Acquired by RedHat ○ ISO: ~ 350 mb Questions : https://www.slido.com Room: #B821
  • 24. Docker hosts ● LinuxKit ○ Full Docker Based ○ K8s support ○ Highly stripped down ○ Modular build (moby project) ○ System developer oriented ○ ISO: < 30 mb Questions : https://www.slido.com Room: #B821
  • 27. Docker images Image: several read-only layers build from a Dockerfile Container: Image + read-write layer I.e: `docker run -ti debian:stretch-slim bash` Questions : https://www.slido.com Room: #B821
  • 28. Docker images Questions : https://www.slido.com Room: #B821
  • 29. Docker images More layers mean : ● larger image ● longer build, push and pull from a registry Small images mean : ● faster build and deploy ● small surface of attack Q: Are small images always secure ? Questions : https://www.slido.com Room: #B821
  • 30. Docker images How to reduce layers number: ● Share base image as much as possible ● Limit data written to the layer (nothing unnecessary) ● Chain RUN statements Questions : https://www.slido.com Room: #B821
  • 31. Docker images FROM ubuntu:latest LABEL maintainer abbyfull@amazon.com RUN apt-get update -y && apt-get install -y python-pip python-dev build-essential COPY . /app WORKDIR /app RUN pip install –r requirements.txt EXPOSE 5000 ENTRYPOINT ["python"] CMD ["application.py"] Questions : https://www.slido.com Room: #B821
  • 32. Docker images FROM python:2.7-alpine LABEL maintainer abbyfull@amazon.com ONBUILD ADD requirements.txt /app ONBUILD RUN pip install –r /app/requirements.txt ONBUILD COPY . /app WORKDIR /app EXPOSE 5000 ENTRYPOINT ["python"] CMD ["application.py"] Questions : https://www.slido.com Room: #B821
  • 33. Docker images Use minimalist base images ● Smaller images reduce the attack surface ● The official Alpine base image is <5MB‘ Use official images as base images ● All official images are scanned for vulnerabilities ● Usually follow best practices Questions : https://www.slido.com Room: #B821
  • 34. Docker images Pull images by digest ‘Image digests are a hash of the image’s config object ) ● This makes them immutable ● If the contents of the image are changed/tampered with, the digest will be different ⇒ If Docker Content Trust is enabled all images are pulled by digest Questions : https://www.slido.com Room: #B821
  • 36. Docker Content Trust Based on Notary Uses a trust on first use model (TOFU) Used to sign and verify an image Secured Image Lifecycle: ● Push <-> Pull ● Build <-> Run Questions : https://www.slido.com Room: #B821
  • 37. Docker Content Trust Questions : https://www.slido.com Room: #B821
  • 38. Docker Content Trust Provides: ● Digital signature mechanism ● Collaboration (signing delegation) ● Key expiration ● Collections signatures (multiple images with the same key) Questions : https://www.slido.com Room: #B821
  • 39. Docker Content Trust $ docker pull repo/image:unsigned … Error: No trust data for unsigned ⇒ Unsigned image, image pull denied Questions : https://www.slido.com Room: #B821
  • 40. Docker Content Trust $ docker pull repo/image:fakesignature Warning: potential malicious behavior - trust data has insufficient signatures for remote repository docker.io/repo/image: valid signatures did not meet threshold ⇒ fake signature detected, image pull denied Questions : https://www.slido.com Room: #B821
  • 41. Docker Content Trust $ docker pull repo/image:stale Error: remote repository docker.io/repo/image out-of-date: targets expired at Sun Mar 26 03:56:12 PDT 2017 ⇒ signing key expired, image pull denied Questions : https://www.slido.com Room: #B821
  • 42. Docker Content Trust Questions : https://www.slido.com Room: #B821
  • 43. Docker Content Trust Questions : https://www.slido.com Room: #B821
  • 46. Security Scan Tool/service that scans images for vulnerabilities ● Operates in the background ● Performs deep binary-level scanning of image layers ● Checks against database(s) of known vulnerabilities ● Provides detailed vulnerability report ● Uses CVE databases Questions : https://www.slido.com Room: #B821
  • 47. Security Scan Available hosted: ● Docker cloud ● Docker hub private repo On premise: ● Supported: DockerEE (Advanced subscription) ● Opensource*: Harbor / Portus *: Uses CoreOS Clair : https://github.com/coreos/clair Questions : https://www.slido.com Room: #B821
  • 48. Security Scan ⇒ small image always secure ?? Questions : https://www.slido.com Room: #B821
  • 49. Security Scan Questions : https://www.slido.com Room: #B821
  • 50. Docker images Demo : Security Scan
  • 51. User Management Dockerd requires root access ● Uses kernel features like namespaces Verify root access of dockerd: $ ps ufaxw | grep dockerd Questions : https://www.slido.com Room: #B821
  • 52. User Management By default dockerd listens on /var/run/docker.sock ● Non-networked , local Unix socket ● Own by dockerd group ○ $ ls -l /var/run/docker.sock ○ srw-rw---- 1 root docker 0 Mar 30 09:15 /var/run/docker.sock Questions : https://www.slido.com Room: #B821
  • 53. User Management ● Non root user should be member of docker group ○ $ sudo usermod -aG docker xinity ○ $ id xinity Questions : https://www.slido.com Room: #B821
  • 54. User Management By default containers runs as root /! $ docker container run -v /:/srv -it --rm alpine sh # whoami root # id uid=0(root) gid=0(root) # rm -rf /srv/* Questions : https://www.slido.com Room: #B821
  • 55. User Management By default root inside == root outside of a container ● $ docker container run --user 1000:1000 -v /:/srv -it --rm alpine sh ● / $ id ● uid=1000 gid=1000 ● $ rm /srv/* ● rm: can't remove '/srv/*': Permission denied ● $ ps Questions : https://www.slido.com Room: #B821
  • 56. User Management User namespaces: ● Been in the Linux kernel for a while ● Supported in Docker since 1.10 How it works: ● Give a container its own isolated set of UIDs and GIDs ● These isolated UIDs and GIDs inside the container are mapped to non-privileged UIDs and GIDs on the Docker host. Questions : https://www.slido.com Room: #B821
  • 57. User Management Questions : https://www.slido.com Room: #B821
  • 58. User Management User namespaces: example ● $ sudo systemctl stop docker ● $ sudo dockerd --userns-remap=default & INFO[0000] User namespaces: ID ranges will be mapped to subuid/subgid… ….. ● $ docker run -v /:/srv -it --rm alpine sh ● # id ● uid=0(root) gid=0(root) … ● / # rm /host/bin/sh ● rm: can't remove '/host/bin/sh': Permission denied Questions : https://www.slido.com Room: #B821
  • 59. User Management $ sudo dockerd --userns-remap=default & The --userns-remap flag uses mappings defined in: ● /etc/subuid /etc/subgid Questions : https://www.slido.com Room: #B821
  • 60. User Management Mapping to the default user namespace uses the dockermap user and group Mappings contain three fields: ● User or group name ● Starting subordinate UID/GID ● Number of subordinate UIDs/GIDs available Questions : https://www.slido.com Room: #B821
  • 61. User Management When you start Docker with the --userns-remap flag the daemon runs within the confined user namespace. ● As part of the implementation a new Docker environment is created under /var/lib/docker ● The name of this new subdirectory the mapped UID and the mapped GID This remapped daemon will operate inside of this 231072.231072 environment ● All of you previously pulled images etc will be inaccessible to this ● remapped daemon Questions : https://www.slido.com Room: #B821
  • 62. User Management You can verify the namespace that the daemon is running in with the docker info command It is not recommended to regularly stop and restart the daemon in new user Namespaces • Mainly because you cannot access images etc. in other namespaces (including the global namespace) Questions : https://www.slido.com Room: #B821
  • 63. User Management You can verify the namespace that the daemon is running in with the docker info command It is not recommended to regularly stop and restart the daemon in new user namespaces • Mainly because you cannot access images etc. in other namespaces (including the global namespace) Questions : https://www.slido.com Room: #B821
  • 64. User Management Questions : https://www.slido.com Room: #B821
  • 67. Linux Kernel Capabilities The Unix world has traditionally divided process into two categories: ● Privileged (root) ● Unprivileged (non-root) Privileged processes bypass all kernel permission checks Unprivileged process are subject to all kernel permission checks Questions : https://www.slido.com Room: #B821
  • 68. Linux Kernel Capabilities This all or nothing approach often led to processes running as root when they really only needed a small subset of the privileges assigned to root processes. Modern Linux kernels slice root privileges into smaller chunks called Capabilities. It is now possible to assign some root privileges to a process without assigning them all. Questions : https://www.slido.com Room: #B821
  • 69. Linux Kernel Capabilities A container running a web server that only needs to bind to a port below 1024 does not need to run as root! Should not run as root! It might be enough to drop all capabilities for that container except CAP_NET_BIND_SERVICE. If an intruder is able to escalate to root within the web server container they will be limited to binding to low numbered privileged ports. They won’t be able to bypass file ownership checks, kill processes, lock memory, create special files, modify routing tables, set promiscuous mode, setuid, load kernel modules, chroot, renice processes, ptrace, change the clock etc... Net result = reduced attack surface! Questions : https://www.slido.com Room: #B821
  • 70. Linux Kernel Capabilities Docker operates a whitelist approach to implementing capabilities. ● If a capability isn’t on the whitelist it is dropped. ● The list shows the current capabilities whitelist for the default profile. ● https://github.com/docker/dock er/blob/master/oci/defaults_lin ux.go#L62-L77 Questions : https://www.slido.com Room: #B821
  • 71. Linux Kernel Capabilities You can use the --cap-add and --cap-drop flags to add an remove capabilities from a container. To drop the CAP_NET_BIND_SERVICE capability form a container: Questions : https://www.slido.com Room: #B821
  • 72. Linux Kernel Capabilities To drop all except the CAP_NET_BIND_SERVICE: To add the CAP_CHOWN capability to a container: Questions : https://www.slido.com Room: #B821
  • 73. Linux Kernel Capabilities Docker cannot currently add capabilities to non-root users ● All of the examples shown in the slides have been adding and removing capabilities from containers running as root Privilege escalation is difficult without file-related capabilities ● File-related capabilities are stored in a file’s extended attributes ● Extended attributes are stripped out when Docker Images are built Questions : https://www.slido.com Room: #B821
  • 76. AppArmor AppArmor is a Linux kernel security module. You define profiles that control access to specific resources such as files and the network. Sane defaults: - Preventing writing to /proc/{num}, /proc/sys, /sys - Preventing mount You can apply these profiles to applications and containers. Use the docker info command to see if AppArmor is installed and available Questions : https://www.slido.com Room: #B821
  • 77. AppArmor Docker creates and loads a default AppArmor profile for containers called docker-default ● Sensible defaults ● Based on https://github.com/docker/docker/blob/master/profiles/apparmo r/template.go A profile for the Docker daemon exists but is not installed and used by default Questions : https://www.slido.com Room: #B821
  • 79. AppArmor You can override the default container profile (docker-default) with the --security-opt flag Questions : https://www.slido.com Room: #B821
  • 80. AppArmor Use the aa-status command to see the status of AppArmor profiles Questions : https://www.slido.com Room: #B821
  • 83. SecComp seccomp is a Linux kernel module that acts like a firewall for syscalls ● In the mainline Linux kernel since 2005 ● Supported in Docker since Docker 1.10 Using seccomp-bpf (Berkley Packet Filters) is an extension that makes seccomp more flexible and granular ● You can create policies that allow granular control of which syscalls are allowed and which are not Docker allows you to associate seccomp policies with containers ● The aim is to control (limit) a containers access to the Docker host’s kernel Questions : https://www.slido.com Room: #B821
  • 84. SecComp seccomp needs to be enabled in the Docker host’s kernel as well as in the Docker Engine. To check for seccomp in the kernel To check for seccomp in Docker: Questions : https://www.slido.com Room: #B821
  • 85. SecComp Docker automatically applies the default seccomp policy to new containers The aim of the default policy is to provide a sensible out-of-the-box policy You should consider the default policy as moderately protective while providing wide application compatibility The default policy disables over 40 syscalls (Linux has over 300 syscalls) https://github.com/docker/docker/blob/master/profiles/seccomp/default.json Questions : https://www.slido.com Room: #B821
  • 86. SecComp You can use the --security-opt flag to force containers to run within a custom seccomp policy Docker seccomp profiles operate using a whitelist approach that specifies allowed syscalls. Only syscalls on the whitelist are permitted Questions : https://www.slido.com Room: #B821
  • 87. SecComp You can run containers without a seccomp policy applied ● This is call running a container unconfined ⇒ It is not recommended to run containers unconfined! Questions : https://www.slido.com Room: #B821
  • 90. Docker Bench Security Open-source tool for running automated tests ● Inspired by the CIS Docker 1.13 benchmark ● Regularly updated Checks Docker host Runs against containers on same host • Checks for AppArmor, read-only volumes, etc... • https://dockerbench.com Questions : https://www.slido.com Room: #B821
  • 91. Docker Bench Security Questions : https://www.slido.com Room: #B821
  • 92. Docker Bench Security Run as a container Runs with a lot of privileges !! As It needs to run tests Against the Docker host Questions : https://www.slido.com Room: #B821
  • 93. On more thing ! Guess what ?
  • 95. Questions ?? Yes ! you do ! don’t be shy Questions : https://www.slido.com Room: #B821