secure application cloudification with docker -seda... · •control docker binaries access within...

18
Secure Application Cloudification with Docker Silvio Bologna, Filippo Millonzi, Diego Terrana, Gianluca Zangara, Pietro Paolo Corso Dipartimento di Fisica e Chimica Università degli Studi di Palermo 26/05/2015 SEDA 2015 - Secure Application Cloudification with Docker, G. Zangara 1

Upload: others

Post on 11-Jun-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Secure Application Cloudification with Docker -SEDA... · •Control Docker binaries access within host O.S. –A user with privileges granted to Docker binaries can allow him run/stop

Secure Application Cloudification with Docker

Silvio Bologna, Filippo Millonzi, Diego Terrana, Gianluca Zangara, Pietro Paolo Corso

Dipartimento di Fisica e Chimica

Università degli Studi di Palermo

26/05/2015 SEDA 2015 - Secure Application Cloudification

with Docker, G. Zangara 1

Page 2: Secure Application Cloudification with Docker -SEDA... · •Control Docker binaries access within host O.S. –A user with privileges granted to Docker binaries can allow him run/stop

What are Containers

• Containers are based on a technology that allows the execution of processes in an isolated user space, sharing the same kernel.

• Created in late 90s, several Linux implementations have been used, but the advent of orchestration tools has made possible the adoption of Container technology in place of Virtual Machines.

26/05/2015 SEDA 2015 - Secure Application Cloudification

with Docker, G. Zangara 2

Page 3: Secure Application Cloudification with Docker -SEDA... · •Control Docker binaries access within host O.S. –A user with privileges granted to Docker binaries can allow him run/stop

Container VS Virtualization

Host OS

Docker Engine

Server

Bin/Libs

Guest OS

Bin/Libs

Guest OS

Host OS

Hypervisor

Server

App App

Bin/Libs Bin/Libs

App App

Containers Virtual Machines

26/05/2015 SEDA 2015 - Secure Application Cloudification

with Docker, G. Zangara 3

Page 4: Secure Application Cloudification with Docker -SEDA... · •Control Docker binaries access within host O.S. –A user with privileges granted to Docker binaries can allow him run/stop

Benefits of using Containers

• Portability of environments across machines

• Use for prototyping and in production environments

• Rapid application deployment – Containers include the minimal runtime requirements of the application

• Environment reuse

• Central Container repository

26/05/2015 SEDA 2015 - Secure Application Cloudification

with Docker, G. Zangara 4

Page 5: Secure Application Cloudification with Docker -SEDA... · •Control Docker binaries access within host O.S. –A user with privileges granted to Docker binaries can allow him run/stop

Container: Linux alternatives (1)

• Linux V-Server: uses a patched Linux kernel to emulate several Containers (also with different kernels) within Contexts. To the contexts there are associated resource quotas. V-Server also manages network limiting

• OpenVZ: patches the original Linux Server, runs Virtual Environments (VEs) with resource limiting and namespaces. Has three command line interfaces

26/05/2015 SEDA 2015 - Secure Application Cloudification

with Docker, G. Zangara 5

Page 6: Secure Application Cloudification with Docker -SEDA... · •Control Docker binaries access within host O.S. –A user with privileges granted to Docker binaries can allow him run/stop

Container: Linux alternatives (2)

• LXC: fully runs on unmodified Linux Kernel, consists of several tools. This technology manages process, network and file system isolation (namespaces), isolated directory tree (chroots) and resource quotas (CGroups)

• LXD: evolution of LXC with enhanced capabilities for running Containers in several machines, allowing live migration and virtualizing different kernel (i.e. RHEL on Ubuntu)

26/05/2015 SEDA 2015 - Secure Application Cloudification

with Docker, G. Zangara 6

Page 7: Secure Application Cloudification with Docker -SEDA... · •Control Docker binaries access within host O.S. –A user with privileges granted to Docker binaries can allow him run/stop

Docker

• Orchestration of deployment and execution of Containers

• Docker Engine

• Docker Hub

• LXD (Integration with OpenStack) or LXC

• Client tools

26/05/2015 SEDA 2015 - Secure Application Cloudification

with Docker, G. Zangara 7

Page 8: Secure Application Cloudification with Docker -SEDA... · •Control Docker binaries access within host O.S. –A user with privileges granted to Docker binaries can allow him run/stop

Host machine

Docker architecture

Docker Daemon

Cont. 1 Cont. 3 Cont. 2

Developer machine

Docker Client

Docker pull Docker run

Docker Hub

Image 1 Image 2 Image 3

26/05/2015 SEDA 2015 - Secure Application Cloudification

with Docker, G. Zangara 8

Page 9: Secure Application Cloudification with Docker -SEDA... · •Control Docker binaries access within host O.S. –A user with privileges granted to Docker binaries can allow him run/stop

Running application over the Cloud: legal concerns

• Lack of precise legislation, all included in the contract between provider and customer

• Cloud provider must make the “best effort” not to loose customer’s data

• Configuration of sofware modules are critical for ensuring security of the runtime environment

26/05/2015 SEDA 2015 - Secure Application Cloudification

with Docker, G. Zangara 9

Page 10: Secure Application Cloudification with Docker -SEDA... · •Control Docker binaries access within host O.S. –A user with privileges granted to Docker binaries can allow him run/stop

Securing Container execution (1)

• Container to host attack

Host

Container A Container B

26/05/2015 SEDA 2015 - Secure Application Cloudification

with Docker, G. Zangara 10

Page 11: Secure Application Cloudification with Docker -SEDA... · •Control Docker binaries access within host O.S. –A user with privileges granted to Docker binaries can allow him run/stop

Securing Container execution (2)

• Container to Container attack

Host

Container A Container B

26/05/2015 SEDA 2015 - Secure Application Cloudification

with Docker, G. Zangara 11

Page 12: Secure Application Cloudification with Docker -SEDA... · •Control Docker binaries access within host O.S. –A user with privileges granted to Docker binaries can allow him run/stop

Securing Container execution (3)

• Network attack: capability to perform Denial of Service, cause the physical network interface is shared

Host

Container A Container B

eth0

26/05/2015 SEDA 2015 - Secure Application Cloudification

with Docker, G. Zangara 12

Page 13: Secure Application Cloudification with Docker -SEDA... · •Control Docker binaries access within host O.S. –A user with privileges granted to Docker binaries can allow him run/stop

Cgroups, Namespaces, chroots

• Cgroup: resource management and accounting solution per process group

• Namespace: provides a view of a subset of system resources (files, ipc, processes, network, user groups)

• Chroot: change the root folder of a specific process, allowing to use other libraries and binaries than the host system

26/05/2015 SEDA 2015 - Secure Application Cloudification

with Docker, G. Zangara 13

Page 14: Secure Application Cloudification with Docker -SEDA... · •Control Docker binaries access within host O.S. –A user with privileges granted to Docker binaries can allow him run/stop

Enforcing security

• SELinux

• AppArmor

• Both systems ensure resource isolation via some kind of namespace

• Pros and cons: SELinux is more granular assigning policies, AppArmor is more manageable

26/05/2015 SEDA 2015 - Secure Application Cloudification

with Docker, G. Zangara 14

Page 15: Secure Application Cloudification with Docker -SEDA... · •Control Docker binaries access within host O.S. –A user with privileges granted to Docker binaries can allow him run/stop

SELinux

• Security-Enhanced Linux (SELinux) is a Linux component that provides a variety of security policies for Linux kernel

• Attaches labels to all files, processes and, in general, all Linux resources

Well-defined policy interfaces

Caching of access decisions for efficiency

Separate measures for protecting system integrity (domain-type) and data confidentiality (multilevel security)

Controls over use of "capabilities"

Not all applications preserve labels

It has a complex policy language, it is hard to manage rules also because there aren’t integrated tools or GUIs

26/05/2015 SEDA 2015 - Secure Application Cloudification

with Docker, G. Zangara 15

Page 16: Secure Application Cloudification with Docker -SEDA... · •Control Docker binaries access within host O.S. –A user with privileges granted to Docker binaries can allow him run/stop

AppArmor

• AppArmor (Application Armor) is a security software for Linux which is maintained and released by Novell under GPL

• Was created as an alternative to SELinux

• Pathname based system does not require labeling or relabeling filesystem

• Auditable policies

Integrated GUI/Console toolset

Protects the operating system, custom and third-party applications from both external and internal threats by enforcing appropriate application behavior

Reporting and alerting

Not fine as SELinux

26/05/2015 SEDA 2015 - Secure Application Cloudification

with Docker, G. Zangara 16

Page 17: Secure Application Cloudification with Docker -SEDA... · •Control Docker binaries access within host O.S. –A user with privileges granted to Docker binaries can allow him run/stop

SELinux/AppArmor & Docker

• To enable SELinux/AppArmor support, use –security-opt command when launching.

• docker run –security-opt label:type:label_value -i -t centos \ bash

• Specific SELinux options are: – –security-opt=”label:user:USER” (set label user) – –security-opt=”label:role:ROLE” (set label role) – –security-opt=”label:type:TYPE” (set label type) – –security-opt=”label:level:LEVEL” (set label level)

• Specific AppArmor options are instead: – –secutity-opt=”apparmor:PROFILE” (set AppArmor

profile)

26/05/2015 SEDA 2015 - Secure Application Cloudification

with Docker, G. Zangara 17

Page 18: Secure Application Cloudification with Docker -SEDA... · •Control Docker binaries access within host O.S. –A user with privileges granted to Docker binaries can allow him run/stop

Best practices

• Don’t enable SSH access in Containers – Connect via SSH to the host machine and connect

to Container via Docker client

• Don’t run privileged Containers – Rather prefer setting appropriate policies to grant

access to devices / files

• Control Docker binaries access within host O.S. – A user with privileges granted to Docker binaries

can allow him run/stop Containers

• Running smaller units of software, to control them is easier

26/05/2015 SEDA 2015 - Secure Application Cloudification

with Docker, G. Zangara 18