Slide 1

Slide 1 text

GET /microservices/secured Grygoriy Gonchar (@ggonchar)
 Software Security Architect 
 @Kreditech

Slide 2

Slide 2 text

Microservices

Slide 3

Slide 3 text

Componentization via services

Slide 4

Slide 4 text

Decentralised data management

Slide 5

Slide 5 text

As a result isolated security risks

Slide 6

Slide 6 text

Not every service is equally important

Slide 7

Slide 7 text

Separating sensitive data in Microservices can further reduce risk

Slide 8

Slide 8 text

Isolated Microservices reduce overall security risks

Slide 9

Slide 9 text

But service distribution introduce new security risks

Slide 10

Slide 10 text

Missing access control

Slide 11

Slide 11 text

Defining Trust Boundaries

Slide 12

Slide 12 text

Internal Trust Boundaries

Slide 13

Slide 13 text

TLS Client Certificates

Slide 14

Slide 14 text

TLS CCA - certificate as client identity

Slide 15

Slide 15 text

Validating client certificate by LB / Proxy

Slide 16

Slide 16 text

Validating client certificate by Service with SSL path-through

Slide 17

Slide 17 text

Validating client certificates server {
 ssl_verify_client on;
 ssl_client_certificate /etc/nginx/certs/ca.crt;
 if ($ssl_client_s_cn !~ '/CN=shopping-cart-srv/') { 
 return 403;
 }
 } http://nginx.org/en/docs/http/ngx_http_ssl_module.html

Slide 18

Slide 18 text

Why TLS client certificates 1. You pay once for automated short-lived TLS certificates - you get both strong transport security and authentication 2. Mutual authentication can be implemented 3. Application code can even don’t know about it

Slide 19

Slide 19 text

Tools for friendly automation already there Let’s Encrypt Netflix Lemur HashiCorp Vault

Slide 20

Slide 20 text

Verifying User Identity

Slide 21

Slide 21 text

Multiple services verifying user identity

Slide 22

Slide 22 text

Services verify identity of users and other services

Slide 23

Slide 23 text

API Gateway - single service verifying user identity

Slide 24

Slide 24 text

Services verify only identity of other services

Slide 25

Slide 25 text

Why API Gateway 1. Greatly simplifies security design 2. Simplifies session management 3. Can do more than security

Slide 26

Slide 26 text

Why API Gateway NOT 1. Gateway might have lack of domain knowledge for authorization decisions 2. Changes and ownership topics might become complicated 3. Affects availability

Slide 27

Slide 27 text

Vulnerable Dependencies

Slide 28

Slide 28 text

Microservices promote usage of different technologies

Slide 29

Slide 29 text

https://pivotal.io/security example of excellent vulnerability reporting

Slide 30

Slide 30 text

https://srcclr.com/ scans dependencies automatically

Slide 31

Slide 31 text

https://github.com/coreos/clair scans Docker containers

Slide 32

Slide 32 text

Secrets Storage

Slide 33

Slide 33 text

More services - more secrets (passwords, certificates etc.)

Slide 34

Slide 34 text

https://12factor.net/

Slide 35

Slide 35 text

No secrets in code “A litmus test for whether an app has all config correctly factored out of the code is whether the codebase could be made open source at any moment, without compromising any credentials.” https://12factor.net/config

Slide 36

Slide 36 text

No secrets in code https://github.com/awslabs/git-secrets $ git-secrets --scan -r my-project/
 conf//application.yml:8: AWS_ACCESS_KEY_ID: 'FR4EFR3Y76R2HE4H’
 conf//application.yml:9: AWS_SECRET_KEY: 'wcwdc9wd8w8qqDDqq0\re4RRfs'
 [ERROR] Matched one or more prohibited patterns

Slide 37

Slide 37 text

Secret Management Software KeyWhiz: https://github.com/square/keywhiz
 Vault: https://github.com/hashicorp/vault
 Knox: https://github.com/pinterest/knox
 Confidant: https://github.com/lyft/confidant
 Secretary: https://github.com/meltwater/secretary
 Sops: https://github.com/mozilla/sops
 Summon: https://github.com/conjurinc/summon
 Biscuit: https://github.com/dcoker/biscuit https://github.com/sweis/crypto-might-not-suck

Slide 38

Slide 38 text

Why Secret Management Software Store secrets encrypted Audit all access Rotate automatically Fine-grained access control

Slide 39

Slide 39 text

Why Secret Management Software Store secrets encrypted Audit all access Rotate automatically Fine-grained access control - !permit role: *my-application privilege: [ read ] resource: *database-password
 
 - !permit role: *deployment-agent privilege: [ write ] resource: *database-password https://developer.conjur.net/reference/policy-markup.html

Slide 40

Slide 40 text

https://conjurinc.github.io/summon/ secrets as env vars

Slide 41

Slide 41 text

Conclusions

Slide 42

Slide 42 text

Microservices Architecture 1. Isolated Microservices reduce security risks 2. Secure Microservices adoption require automation to mitigate new risks

Slide 43

Slide 43 text

Automate your security http://martinfowler.com/bliki/MicroservicePrerequisites.html

Slide 44

Slide 44 text

Questions?