microservices: a security nightmare?

100
Microservices – a security nightmare? GOTO Nights Zürich - March 3, 2016 Maximilian Schöfmann | @schoefmann Container Solutions Switzerland

Upload: container-solutions

Post on 21-Jan-2017

225 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Microservices: A Security Nightmare?

Microservices –a security nightmare?

GOTO Nights Zürich - March 3, 2016

Maximilian Schöfmann | @schoefmann

Container Solutions Switzerland

Page 2: Microservices: A Security Nightmare?
Page 3: Microservices: A Security Nightmare?
Page 4: Microservices: A Security Nightmare?
Page 5: Microservices: A Security Nightmare?
Page 6: Microservices: A Security Nightmare?
Page 7: Microservices: A Security Nightmare?
Page 8: Microservices: A Security Nightmare?

Microservices (2016) …

Page 9: Microservices: A Security Nightmare?

Microservices (2016) …

small, hence many services

Page 10: Microservices: A Security Nightmare?

Microservices (2016) …

small, hence many services

talking over the network

Page 11: Microservices: A Security Nightmare?

Microservices (2016) …

small, hence many services

talking over the networkbuilt with different technologies

Page 12: Microservices: A Security Nightmare?

Microservices (2016) …

small, hence many services

talking over the networkbuilt with different technologies

by autonomous teams with end-to-end responsibility

Page 13: Microservices: A Security Nightmare?

Microservices (2016) …

small, hence many services

talking over the networkbuilt with different technologies

by autonomous teams with end-to-end responsibilitydoing DevOps and Continuous Delivery

Page 14: Microservices: A Security Nightmare?

Microservices (2016) …

small, hence many services

talking over the networkbuilt with different technologies

by autonomous teams with end-to-end responsibilitydoing DevOps and Continuous Delivery

using containers

Page 15: Microservices: A Security Nightmare?

Microservices (2016) …

small, hence many services

talking over the network

built with different technologies

by autonomous teams with end-to-end responsibility

doing DevOps and Continuous Delivery

using containers

Page 16: Microservices: A Security Nightmare?

Microservices are the result of combining

architectural ideas from lightweight SOA

and Domain Driven Design,

organisational approaches like DevOps

and Agile Software Development, and

technology innovations like Containers

and Programmable Infrastructure

Page 17: Microservices: A Security Nightmare?

Architecture Organisation

Technology

Page 18: Microservices: A Security Nightmare?

Monolith

Page 19: Microservices: A Security Nightmare?

“many small services”

Page 20: Microservices: A Security Nightmare?

Monolith - method calls

Page 21: Microservices: A Security Nightmare?

Microservices - talking over the network

Page 22: Microservices: A Security Nightmare?

Java7(1.7.0_03)

Monolith - few technologies

Page 23: Microservices: A Security Nightmare?

Microservices - built with different technologies

nodejs0.9

Ruby2.1

Java7

Go1.4

Java8

Page 24: Microservices: A Security Nightmare?

Security Gates vs…

Page 25: Microservices: A Security Nightmare?

… autonomous teams with end-to-end responsibility

Page 26: Microservices: A Security Nightmare?

… autonomous teams with end-to-end responsibility

Page 27: Microservices: A Security Nightmare?

dedicated security experts vs…

(ISC)2®

Page 28: Microservices: A Security Nightmare?

doing DevOps

OWASP??

Page 29: Microservices: A Security Nightmare?

classic “Security Sandwich” vs…

Page 30: Microservices: A Security Nightmare?

classic “Security Sandwich” vs…

Specification

Implementation Validation

Page 31: Microservices: A Security Nightmare?

… Continuous Delivery

Page 32: Microservices: A Security Nightmare?

well isolated “real server” vs…

Page 33: Microservices: A Security Nightmare?

… using containers

Page 34: Microservices: A Security Nightmare?

Attack surface - VMs vs containers

XENHypervisor-10^5LOC

LinuxKernel-10^7LOC

Page 35: Microservices: A Security Nightmare?
Page 36: Microservices: A Security Nightmare?
Page 37: Microservices: A Security Nightmare?

Highly coupled services No clear boundaries

Page 38: Microservices: A Security Nightmare?

Loosely coupled services Clear boundaries

Page 39: Microservices: A Security Nightmare?

many small services

Page 40: Microservices: A Security Nightmare?

impact of breach can be contained locally

Page 41: Microservices: A Security Nightmare?

“Clear service boundaries limit the impact of breaches”

Page 42: Microservices: A Security Nightmare?

Keep APIs minimal

Page 43: Microservices: A Security Nightmare?

payment_data

(stateless)

cat_ pictures

(stateless)

user_db

Microservices have their own data store

Page 44: Microservices: A Security Nightmare?

payment_data

(stateless)

cat_ pictures

(stateless)

user_db

Microservices have their own data store

Page 45: Microservices: A Security Nightmare?

“Let the need-to-know principle guide your API design”

Page 46: Microservices: A Security Nightmare?

payment_data

(stateless)

cat_ pictures

(stateless)

user_db

different security levels should require different security

properties in services, e.g. encryption, auth, security testing…

Page 47: Microservices: A Security Nightmare?

“Classify services into distinct security levels”

Page 48: Microservices: A Security Nightmare?

API Gateways

APIG

atew

ay

Page 49: Microservices: A Security Nightmare?

API Gateways

APIG

atew

ay

• Access control

• Rate limiting

• HTTPS termination . . .

Page 50: Microservices: A Security Nightmare?

API Gateways

APIG

atew

ay

WAF PaymentSvc.

Page 51: Microservices: A Security Nightmare?

“Isolate services with different security levels through gateways”

Page 52: Microservices: A Security Nightmare?

Authorization & Authentication

Page 53: Microservices: A Security Nightmare?

Authorization & Authentication

Page 54: Microservices: A Security Nightmare?

“Use scalable auth techniques without single points of failure”

Page 55: Microservices: A Security Nightmare?
Page 56: Microservices: A Security Nightmare?

Secrets management

vaultproject.io square.github.io/keywhiz

Page 57: Microservices: A Security Nightmare?

“Manage secrets with special purpose services”

Page 58: Microservices: A Security Nightmare?
Page 59: Microservices: A Security Nightmare?

Freeze image for analysis

paymentservice

instance#2

docsuploadservice

instance#1

paymentservice

instance#1

catpictureservice

instance#1

memegeneratorinstance#1

bookmarkmanager

instance#1

paymentservice

instance#1

Page 60: Microservices: A Security Nightmare?

Or even the running container… (criu.org)

paymentservice

instance#2

docsuploadservice

instance#1

paymentservice

instance#1

catpictureservice

instance#1

memegeneratorinstance#1

bookmarkmanager

instance#1

paymentservice

instance#1

Page 61: Microservices: A Security Nightmare?

“Leverage container features for forensics”

Page 62: Microservices: A Security Nightmare?

Scheduling constraints

paymentservice

instance#2

docsuploadservice

instance#1

paymentservice

instance#1

catpictureservice

instance#1

memegeneratorinstance#1

bookmarkmanager

instance#1

Page 63: Microservices: A Security Nightmare?

“Run services of different security levels on different hosts”

Page 64: Microservices: A Security Nightmare?

Replace containers on deploy

paymentservice

instance#2

docsuploadservice

instance#1

paymentservice

instance#3

catpictureservice

instance#1

memegeneratorinstance#1

bookmarkmanager

instance#1

Page 65: Microservices: A Security Nightmare?

“Embrace immutable infrastructure”

Page 66: Microservices: A Security Nightmare?

“built with different technologies”

nodejs0.9

Ruby2.1

Java7

Go1.4

Java8

Page 67: Microservices: A Security Nightmare?

Monocultures…

Page 68: Microservices: A Security Nightmare?

Scanning images at rest

Clair(CoreOS)Nautilus(DockerInc.)

Page 69: Microservices: A Security Nightmare?

“Scan images already during the build process”

Page 70: Microservices: A Security Nightmare?

Container technology…

BSDJails2000

2001

VirtuozzoLinux-VServer

SolarisZones2004

LXC2008

2013

Docker

rkt2014

1982

chroot2007

cgroups

Page 71: Microservices: A Security Nightmare?

Docker security hardening…

container-solutions.com/security

•read-onlycontainers•minimalbaseimages•dropcapabilities•traditionalhardening(AppArmor,SELinux…)

...

Page 72: Microservices: A Security Nightmare?

“Minimise the attack surface of images and hosts”

Page 73: Microservices: A Security Nightmare?

Unify & secure deployment methods

Simple to add…

• TLS

• Authentication

• Authorisation

• Logging & Auditing

• Image verification

scp

rsync

git

Page 74: Microservices: A Security Nightmare?

“Have a single, hardened method to deploy”

Page 75: Microservices: A Security Nightmare?
Page 76: Microservices: A Security Nightmare?

…end-to-end responsibility

Page 77: Microservices: A Security Nightmare?

Gates and Accountability

Page 78: Microservices: A Security Nightmare?

Security Sandwich and Autonomy

Specification

Implementation Validation

Page 79: Microservices: A Security Nightmare?

Security Sandwich and Autonomy

Page 80: Microservices: A Security Nightmare?

Security Sandwich and Autonomy

Page 81: Microservices: A Security Nightmare?

Trust

IdeafromA.T.KearnyAnalysis

Accountability Expertise

Autonomy&Entrepreneurship

Collaboration&Support

Trust

Page 82: Microservices: A Security Nightmare?

Security aspects must becomepart of the Definition of Done…

Page 83: Microservices: A Security Nightmare?

Rugged Software Manifesto

ruggedsoftware.org

Page 84: Microservices: A Security Nightmare?

SecDevOps?

SecOps?

DevSec?

Page 85: Microservices: A Security Nightmare?
Page 86: Microservices: A Security Nightmare?

TheroleofITArchitectsisalreadychanging

Now,theroleoftheSecurityTeamneedstochange

Page 87: Microservices: A Security Nightmare?

“Accountability ensures security is built in, not bolted on”

Page 88: Microservices: A Security Nightmare?

Avg: 103 days to fix a vulnerability

http://darkmatters.norsecorp.com/2015/06/09/security-vulnerabilities-take-average-of-103-days-to-remediate/

Page 89: Microservices: A Security Nightmare?

CD reduces reaction time

Page 90: Microservices: A Security Nightmare?

“Leverage Continuous Delivery as a security feature”

Page 91: Microservices: A Security Nightmare?

Test pyramid

UnitTests

ServiceTests

UItests

fasterfeed

back

from“SucceedingwithAgile”(MikeCohn)

confiden

ce

Page 92: Microservices: A Security Nightmare?

Security-Test pyramid / AppSec pipeline

staticcodeanalysis

Vulnerability

scanning

E2E

securitytests

fasterfeed

back

confiden

ce

Page 93: Microservices: A Security Nightmare?

BDD style

continuumsecurity.net/bdd-intro.htmlgauntlt.org

Page 94: Microservices: A Security Nightmare?

“Have your test pyramid reflect security”

Page 95: Microservices: A Security Nightmare?

Architecture Organisation

Technology

Page 96: Microservices: A Security Nightmare?

Architecture

Clearserviceboundarieslimittheimpactofbreaches

Lettheneed-to-knowprincipleguideyourAPIdesign

Classifyservicesintodistinctsecuritylevels,whichmandatedifferentsecurityproperties

Usescalableauthtechniqueswithoutsinglepointsoffailure

Isolateserviceswithdifferentsecuritylevelswithgateways

Managesecretsinspecialisedservices

Page 97: Microservices: A Security Nightmare?

Technology

Runservicesofdifferentsecuritylevelsondifferenthosts

Leveragecontainerfeaturesforforensics

Embraceimmutableinfrastructure

Scanimagesaspartofthebuildprocess

Haveasingle,hardenedmethodtodeploy

Minimisetheattacksurfaceofimagesandhosts

Page 98: Microservices: A Security Nightmare?

Organisation

LeverageContinuousDeliveryasasecurityfeature

Haveyourtestpyramidreflectsecurity

Accountabilityensuressecurityisbuiltin,notboltedon

Page 99: Microservices: A Security Nightmare?

Nightmare?

Page 100: Microservices: A Security Nightmare?

[email protected] | @schoefmann

container-solutions.com