SlideShare uma empresa Scribd logo
1 de 26
Baixar para ler offline
LXC,
Docker,
Security
Outline
●

●

●

Fear, Uncertainty, and Doubt
(and the Awful Truth about LXC and security)
Some real-world scenarios
(and how to make them safer)
The road to bullet-proof containers
Fear,
Uncertainty,
and Doubt
Fear, Uncertainty, and Doubt
“LXC is not yet secure. If I want real security I will
use KVM.”
—Dan BerrangĂ©, famous LXC hacker, in 2011.
Still quoted today (and still true in some cases).
But Linux has changed a tiny little bit since 2011.
Fear, Uncertainty, and Doubt
“From security point of view lxc is terrible and may
not be consider as security solution.”
—someone on Reddit (original spelling and grammar)
Common opinion among security experts and
paranoid people.
To be fair, they have to play safe & can't take risks.
Fear, Uncertainty, and Doubt
“Basically containers are not functional as security
containers at present, in that if you have root on a
container you have root on the whole box.”
—Gentoo Wiki
That's just plain false, and we'll see why.
The Awful Truth
The Awful Truth
Short version:
●

☠ Kernel exploits (e.g. vmsplice exploit)

●

☠ Default LXC settings

●

☠ Containers needing to do funky stuff
☠ kernel exploits
●

●

You can always do syscalls in a container
If a syscall is buggy (vmsplice
) and lets you execute
arbitrary code, game is over (since it's the same kernel
for host and for container)

However, containers will always (by design) share the same kernel
as the host. Therefore, any vulnerabilities in the kernel interface,
unless the container is forbidden the use of that interface (i.e. using
seccomp2) can be exploited by the container to harm the host.
—Ubuntu documentation
☠ default LXC settings
●

If you run containers with all capabilities and permissions,
you might as well give full sudoer access to the guest user
and complain that “Linux is not secure!”

By default, LXC containers are started under a Apparmor policy to restrict
some actions. However, while stronger security is a goal for future
releases, in 12.04 LTS the goal of the Apparmor policy is not to stop
malicious actions but rather to stop accidental harm of the host by the
guest.
—Ubuntu documentation
☠ containers needing extra privileges
●

Network interfaces (tun/tap...) for VPN or other

●

Multicast, broadcast, packet sniffing

●

Accessing raw devices (disks, GPU...)

●

Mounting stuff (even with FUSE)

More privileges = greater surface of attack!
Some
Real-World
Scenarios
(and how to make them safer)
LXC as a payload delivery
mechanism (=packaging)
●

Without containers, you would run on the host

●


 so don't worry about anything at all!

Easy
LXC for development/testing
●

●
●

You run trusted code written by your team
(i.e. if someone introduces malicious code,
you are in bigger trouble anyway)
You want to protect against mistakes, not abuse
LXC will be just fine, especially if you isolate
containers on different machines anyway
(testing won't hurt production)
LXC for webapps, databases
●

That stuff shouldn't require root access
–
–

●

Run processes as non-privileged user
Get rid of SUID binaries (or mount with nosuid)

You're still vulnerable to buggy syscalls!
–

Keep your kernel up-to-date

–

Or deploy additional layers of security
Reducing syscall attack surface
●

With seccomp, you can:
–
–

Limit syscall arguments (not exposed to LXC yet)

–
●

Limit available syscalls (LXC and Docker: ☑)
Switch to a very limited subset (ZeroVM, NaCl)

Open questions:
–

How much can you drop, and still be useful?

–

How much should you drop, to be secure?
Hardening the L in LXC
●

GRSEC helps a lot (not only for LXC workloads)
–

non-executable stack

–

Address Space Layout Randomization

–

protects kernel structures with functions pointers
(sets them to be read-only)

–

and many more: check refcount overflows, erase
pages (slab, stack...) when the kernel frees them, 

But I still need/want root!
●

Use capabilities
–

Bind ports <1024

–

Run tcpdump or other sniffing tools

–

Bypass permission checks (run a fileserver)

–

Lock memory and run quasi-realtime stuff

–

Configure network interfaces, routing tables, netfilter...

–

Renice arbitrary processes

–

etc.
However...
●

CAP_SYS_ADMIN is a big can of woms
–

Filesystems (mount, umount, quotactl)

–

Cleanup leftover IPC ressources

–

Enter and setup namespaces (setns, clone flags)

–

Many ioctl operations

–

Details like sethostname
I need to access GPU/raw disk...
●

Use the devices cgroup controller
–

run X server

–

play OpenGL accelerated games
●

–

mine bitcoins litecoins dogecoins
●

●

FUN!
PROFIT!

With Docker, most people just use ''-privileged''
I'm still not convinced.
The Road
to
Bullet-proof
Containers
One container per machine
●

Use containers for easy and fast deployment

●

Use Dockerfiles (or equivalent)

●

No overhead at all
–
–

●

Disable memory controller
Assign macvlan or dedicated network interface

Retain same workflow in dev and prod!
One VM per container
●

Run the payload within a VM within a container

●

Requires physical machines (or nested VMs)
Plan A (today): magic tricks
–
–

Setup transparent network bridge

–
●

Use 9pfs to hand off the container rootfs to the VM
Give access to e.g. /dev/kvm

Plan B (tomorrow): Docker integration
Reminder!
●

●

●

●

Security is not a one-shot “let's install this patch, firewall,
antivirus, audit mechanism and we're done!”
Security requires constant updates
(Up-to-date system w/o firewall >> crippled kernel and fw)
But not all those updates are necessary
(Example: years ago, the Xen/pvgrub exploits)
Security comes with a cost
(Manpower, but also performance overhead)
→ Know what you really need, and use only that!
Thank you! Questions?

http://docker.io/
http://docker.com/
https://github.com/dotcloud/docker
@docker
@jpetazzo

Mais conteĂșdo relacionado

Mais de JĂ©rĂŽme Petazzoni

From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...JĂ©rĂŽme Petazzoni
 
How to contribute to large open source projects like Docker (LinuxCon 2015)
How to contribute to large open source projects like Docker (LinuxCon 2015)How to contribute to large open source projects like Docker (LinuxCon 2015)
How to contribute to large open source projects like Docker (LinuxCon 2015)JĂ©rĂŽme Petazzoni
 
Containers, Docker, and Security: State Of The Union (LinuxCon and ContainerC...
Containers, Docker, and Security: State Of The Union (LinuxCon and ContainerC...Containers, Docker, and Security: State Of The Union (LinuxCon and ContainerC...
Containers, Docker, and Security: State Of The Union (LinuxCon and ContainerC...JĂ©rĂŽme Petazzoni
 
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxCon
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxConAnatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxCon
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxConJĂ©rĂŽme Petazzoni
 
Microservices. Microservices everywhere! (At OSCON 2015)
Microservices. Microservices everywhere! (At OSCON 2015)Microservices. Microservices everywhere! (At OSCON 2015)
Microservices. Microservices everywhere! (At OSCON 2015)JĂ©rĂŽme Petazzoni
 
Deploy microservices in containers with Docker and friends - KCDC2015
Deploy microservices in containers with Docker and friends - KCDC2015Deploy microservices in containers with Docker and friends - KCDC2015
Deploy microservices in containers with Docker and friends - KCDC2015JĂ©rĂŽme Petazzoni
 
Containers: from development to production at DevNation 2015
Containers: from development to production at DevNation 2015Containers: from development to production at DevNation 2015
Containers: from development to production at DevNation 2015JĂ©rĂŽme Petazzoni
 
Immutable infrastructure with Docker and containers (GlueCon 2015)
Immutable infrastructure with Docker and containers (GlueCon 2015)Immutable infrastructure with Docker and containers (GlueCon 2015)
Immutable infrastructure with Docker and containers (GlueCon 2015)JĂ©rĂŽme Petazzoni
 
The Docker ecosystem and the future of application deployment
The Docker ecosystem and the future of application deploymentThe Docker ecosystem and the future of application deployment
The Docker ecosystem and the future of application deploymentJĂ©rĂŽme Petazzoni
 
Docker: automation for the rest of us
Docker: automation for the rest of usDocker: automation for the rest of us
Docker: automation for the rest of usJĂ©rĂŽme Petazzoni
 
Docker Non Technical Presentation
Docker Non Technical PresentationDocker Non Technical Presentation
Docker Non Technical PresentationJĂ©rĂŽme Petazzoni
 
Introduction to Docker, December 2014 "Tour de France" Bordeaux Special Edition
Introduction to Docker, December 2014 "Tour de France" Bordeaux Special EditionIntroduction to Docker, December 2014 "Tour de France" Bordeaux Special Edition
Introduction to Docker, December 2014 "Tour de France" Bordeaux Special EditionJĂ©rĂŽme Petazzoni
 
Introduction to Docker, December 2014 "Tour de France" Edition
Introduction to Docker, December 2014 "Tour de France" EditionIntroduction to Docker, December 2014 "Tour de France" Edition
Introduction to Docker, December 2014 "Tour de France" EditionJĂ©rĂŽme Petazzoni
 
Containers, Docker, and Microservices: the Terrific Trio
Containers, Docker, and Microservices: the Terrific TrioContainers, Docker, and Microservices: the Terrific Trio
Containers, Docker, and Microservices: the Terrific TrioJĂ©rĂŽme Petazzoni
 
Containerization is more than the new Virtualization: enabling separation of ...
Containerization is more than the new Virtualization: enabling separation of ...Containerization is more than the new Virtualization: enabling separation of ...
Containerization is more than the new Virtualization: enabling separation of ...JĂ©rĂŽme Petazzoni
 
Pipework: Software-Defined Network for Containers and Docker
Pipework: Software-Defined Network for Containers and DockerPipework: Software-Defined Network for Containers and Docker
Pipework: Software-Defined Network for Containers and DockerJĂ©rĂŽme Petazzoni
 
Docker Tips And Tricks at the Docker Beijing Meetup
Docker Tips And Tricks at the Docker Beijing MeetupDocker Tips And Tricks at the Docker Beijing Meetup
Docker Tips And Tricks at the Docker Beijing MeetupJĂ©rĂŽme Petazzoni
 
Introduction to Docker at Glidewell Laboratories in Orange County
Introduction to Docker at Glidewell Laboratories in Orange CountyIntroduction to Docker at Glidewell Laboratories in Orange County
Introduction to Docker at Glidewell Laboratories in Orange CountyJĂ©rĂŽme Petazzoni
 
Docker en Production (Docker Paris)
Docker en Production (Docker Paris)Docker en Production (Docker Paris)
Docker en Production (Docker Paris)JĂ©rĂŽme Petazzoni
 
Introduction to Docker at the Azure Meet-up in New York
Introduction to Docker at the Azure Meet-up in New YorkIntroduction to Docker at the Azure Meet-up in New York
Introduction to Docker at the Azure Meet-up in New YorkJĂ©rĂŽme Petazzoni
 

Mais de JĂ©rĂŽme Petazzoni (20)

From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...
 
How to contribute to large open source projects like Docker (LinuxCon 2015)
How to contribute to large open source projects like Docker (LinuxCon 2015)How to contribute to large open source projects like Docker (LinuxCon 2015)
How to contribute to large open source projects like Docker (LinuxCon 2015)
 
Containers, Docker, and Security: State Of The Union (LinuxCon and ContainerC...
Containers, Docker, and Security: State Of The Union (LinuxCon and ContainerC...Containers, Docker, and Security: State Of The Union (LinuxCon and ContainerC...
Containers, Docker, and Security: State Of The Union (LinuxCon and ContainerC...
 
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxCon
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxConAnatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxCon
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxCon
 
Microservices. Microservices everywhere! (At OSCON 2015)
Microservices. Microservices everywhere! (At OSCON 2015)Microservices. Microservices everywhere! (At OSCON 2015)
Microservices. Microservices everywhere! (At OSCON 2015)
 
Deploy microservices in containers with Docker and friends - KCDC2015
Deploy microservices in containers with Docker and friends - KCDC2015Deploy microservices in containers with Docker and friends - KCDC2015
Deploy microservices in containers with Docker and friends - KCDC2015
 
Containers: from development to production at DevNation 2015
Containers: from development to production at DevNation 2015Containers: from development to production at DevNation 2015
Containers: from development to production at DevNation 2015
 
Immutable infrastructure with Docker and containers (GlueCon 2015)
Immutable infrastructure with Docker and containers (GlueCon 2015)Immutable infrastructure with Docker and containers (GlueCon 2015)
Immutable infrastructure with Docker and containers (GlueCon 2015)
 
The Docker ecosystem and the future of application deployment
The Docker ecosystem and the future of application deploymentThe Docker ecosystem and the future of application deployment
The Docker ecosystem and the future of application deployment
 
Docker: automation for the rest of us
Docker: automation for the rest of usDocker: automation for the rest of us
Docker: automation for the rest of us
 
Docker Non Technical Presentation
Docker Non Technical PresentationDocker Non Technical Presentation
Docker Non Technical Presentation
 
Introduction to Docker, December 2014 "Tour de France" Bordeaux Special Edition
Introduction to Docker, December 2014 "Tour de France" Bordeaux Special EditionIntroduction to Docker, December 2014 "Tour de France" Bordeaux Special Edition
Introduction to Docker, December 2014 "Tour de France" Bordeaux Special Edition
 
Introduction to Docker, December 2014 "Tour de France" Edition
Introduction to Docker, December 2014 "Tour de France" EditionIntroduction to Docker, December 2014 "Tour de France" Edition
Introduction to Docker, December 2014 "Tour de France" Edition
 
Containers, Docker, and Microservices: the Terrific Trio
Containers, Docker, and Microservices: the Terrific TrioContainers, Docker, and Microservices: the Terrific Trio
Containers, Docker, and Microservices: the Terrific Trio
 
Containerization is more than the new Virtualization: enabling separation of ...
Containerization is more than the new Virtualization: enabling separation of ...Containerization is more than the new Virtualization: enabling separation of ...
Containerization is more than the new Virtualization: enabling separation of ...
 
Pipework: Software-Defined Network for Containers and Docker
Pipework: Software-Defined Network for Containers and DockerPipework: Software-Defined Network for Containers and Docker
Pipework: Software-Defined Network for Containers and Docker
 
Docker Tips And Tricks at the Docker Beijing Meetup
Docker Tips And Tricks at the Docker Beijing MeetupDocker Tips And Tricks at the Docker Beijing Meetup
Docker Tips And Tricks at the Docker Beijing Meetup
 
Introduction to Docker at Glidewell Laboratories in Orange County
Introduction to Docker at Glidewell Laboratories in Orange CountyIntroduction to Docker at Glidewell Laboratories in Orange County
Introduction to Docker at Glidewell Laboratories in Orange County
 
Docker en Production (Docker Paris)
Docker en Production (Docker Paris)Docker en Production (Docker Paris)
Docker en Production (Docker Paris)
 
Introduction to Docker at the Azure Meet-up in New York
Introduction to Docker at the Azure Meet-up in New YorkIntroduction to Docker at the Azure Meet-up in New York
Introduction to Docker at the Azure Meet-up in New York
 

Último

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 

Último (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

Linux Containers (LXC), Docker, and Security

  • 2. Outline ● ● ● Fear, Uncertainty, and Doubt (and the Awful Truth about LXC and security) Some real-world scenarios (and how to make them safer) The road to bullet-proof containers
  • 4. Fear, Uncertainty, and Doubt “LXC is not yet secure. If I want real security I will use KVM.” —Dan BerrangĂ©, famous LXC hacker, in 2011. Still quoted today (and still true in some cases). But Linux has changed a tiny little bit since 2011.
  • 5. Fear, Uncertainty, and Doubt “From security point of view lxc is terrible and may not be consider as security solution.” —someone on Reddit (original spelling and grammar) Common opinion among security experts and paranoid people. To be fair, they have to play safe & can't take risks.
  • 6. Fear, Uncertainty, and Doubt “Basically containers are not functional as security containers at present, in that if you have root on a container you have root on the whole box.” —Gentoo Wiki That's just plain false, and we'll see why.
  • 8. The Awful Truth Short version: ● ☠ Kernel exploits (e.g. vmsplice exploit) ● ☠ Default LXC settings ● ☠ Containers needing to do funky stuff
  • 9. ☠ kernel exploits ● ● You can always do syscalls in a container If a syscall is buggy (vmsplice
) and lets you execute arbitrary code, game is over (since it's the same kernel for host and for container) However, containers will always (by design) share the same kernel as the host. Therefore, any vulnerabilities in the kernel interface, unless the container is forbidden the use of that interface (i.e. using seccomp2) can be exploited by the container to harm the host. —Ubuntu documentation
  • 10. ☠ default LXC settings ● If you run containers with all capabilities and permissions, you might as well give full sudoer access to the guest user and complain that “Linux is not secure!” By default, LXC containers are started under a Apparmor policy to restrict some actions. However, while stronger security is a goal for future releases, in 12.04 LTS the goal of the Apparmor policy is not to stop malicious actions but rather to stop accidental harm of the host by the guest. —Ubuntu documentation
  • 11. ☠ containers needing extra privileges ● Network interfaces (tun/tap...) for VPN or other ● Multicast, broadcast, packet sniffing ● Accessing raw devices (disks, GPU...) ● Mounting stuff (even with FUSE) More privileges = greater surface of attack!
  • 13. LXC as a payload delivery mechanism (=packaging) ● Without containers, you would run on the host ● 
 so don't worry about anything at all! Easy
  • 14. LXC for development/testing ● ● ● You run trusted code written by your team (i.e. if someone introduces malicious code, you are in bigger trouble anyway) You want to protect against mistakes, not abuse LXC will be just fine, especially if you isolate containers on different machines anyway (testing won't hurt production)
  • 15. LXC for webapps, databases ● That stuff shouldn't require root access – – ● Run processes as non-privileged user Get rid of SUID binaries (or mount with nosuid) You're still vulnerable to buggy syscalls! – Keep your kernel up-to-date – Or deploy additional layers of security
  • 16. Reducing syscall attack surface ● With seccomp, you can: – – Limit syscall arguments (not exposed to LXC yet) – ● Limit available syscalls (LXC and Docker: ☑) Switch to a very limited subset (ZeroVM, NaCl) Open questions: – How much can you drop, and still be useful? – How much should you drop, to be secure?
  • 17. Hardening the L in LXC ● GRSEC helps a lot (not only for LXC workloads) – non-executable stack – Address Space Layout Randomization – protects kernel structures with functions pointers (sets them to be read-only) – and many more: check refcount overflows, erase pages (slab, stack...) when the kernel frees them, 

  • 18. But I still need/want root! ● Use capabilities – Bind ports <1024 – Run tcpdump or other sniffing tools – Bypass permission checks (run a fileserver) – Lock memory and run quasi-realtime stuff – Configure network interfaces, routing tables, netfilter... – Renice arbitrary processes – etc.
  • 19. However... ● CAP_SYS_ADMIN is a big can of woms – Filesystems (mount, umount, quotactl) – Cleanup leftover IPC ressources – Enter and setup namespaces (setns, clone flags) – Many ioctl operations – Details like sethostname
  • 20. I need to access GPU/raw disk... ● Use the devices cgroup controller – run X server – play OpenGL accelerated games ● – mine bitcoins litecoins dogecoins ● ● FUN! PROFIT! With Docker, most people just use ''-privileged''
  • 21. I'm still not convinced.
  • 23. One container per machine ● Use containers for easy and fast deployment ● Use Dockerfiles (or equivalent) ● No overhead at all – – ● Disable memory controller Assign macvlan or dedicated network interface Retain same workflow in dev and prod!
  • 24. One VM per container ● Run the payload within a VM within a container ● Requires physical machines (or nested VMs) Plan A (today): magic tricks – – Setup transparent network bridge – ● Use 9pfs to hand off the container rootfs to the VM Give access to e.g. /dev/kvm Plan B (tomorrow): Docker integration
  • 25. Reminder! ● ● ● ● Security is not a one-shot “let's install this patch, firewall, antivirus, audit mechanism and we're done!” Security requires constant updates (Up-to-date system w/o firewall >> crippled kernel and fw) But not all those updates are necessary (Example: years ago, the Xen/pvgrub exploits) Security comes with a cost (Manpower, but also performance overhead) → Know what you really need, and use only that!