Top Banner
Jonathan Pulsifer Securing Shopify's PaaS on GKE
25

Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all

May 20, 2018

Download

Documents

ĐỗDung
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all

Jonathan Pulsifer

Securing Shopify's PaaS on GKE

Page 2: Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all

• Infrastructure Security Engineer @ Shopify

• Certified Kubernetes Administrator

• twitter.com/JonPulsifer

• github.com/JonPulsifer

$ whoami

• Team Lead at CFNOC

• Network Defense Instructor at CFSCE

• SANS Mentor / Co-instructor (GCIA, GSEC)

Previously

Page 3: Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all

Services at Shopify

Page 4: Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all

Service Tiers

Tier 1

Tier 2

Tier 3

Tier 4

More mature in SDLC

Greater business importance

Higher SLO

Earlier in SDLC

Regional redundancy, incident response drilling

Pager rotation, automated critical alerting

CI, Pingdom, backups, logging

Fewer requirements to encourage rapid

prototyping

Page 5: Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all

Security Tiers

Tier 1

Tier 2

Tier 3

Tier 4

More mature in SDLC

Greater business importance

Higher SLO

Earlier in SDLC

ALL THE THINGS!

Chaos engineering, MAC (seccomp, AppArmor)

Network policies, security contexts, dropped privileges

Strict RBAC on cloud resources and k8s,

Kritis attestations

Page 6: Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all

Kubernetes Namespaces by Tier

35 50Tier 1 Tier 2

70 175Tier 3 Tier 4

* not all services run on GKE

Page 7: Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all

Cloud Platform

Page 8: Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all

500 15Google Cloud Platform

Projects Folders

700 17Google Groups GKE Clusters

Page 9: Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all
Page 10: Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all

Cloud Platform Architecture

Page 11: Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all

Cloud Platform Architecture

Page 12: Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all

Services Automation

• Automatic patching!

• Generation and auditing of

Kubernetes manifests

• Configures CI

Services DB

• Creation and annotation of

Kubernetes namespaces

• https://github.com/Shopify/ejson key

pair creation

• GCP service account creation

Groundcontrol

Page 13: Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all

Cloud Platform Architecture

Page 14: Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all

6,000 average builds per weekday

330,000 images in GCR

Builder Stats

Page 15: Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all

• Buildpack, Dockerfile, or custom build

pipelines

• Kubernetes template validation

• Container Audits:

• does this image run as root?

• does this image contain any

vulnerable packages?

• container attestations

PIPA

Page 16: Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all

• https://github.com/Grafeas/Grafeas

• Central source of truth for software component metadata

• my.regist.ry/image@sha256:hash as key for containers

• Container notes produced at build

• See GCP's or Shopify's Engineering blog for more

Grafeas

• Use metadata stored in Grafeas to create policies

• Real-time enforcement of policies on Kubernetes

Kritis

Page 17: Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all

Cloud Platform Architecture

Page 18: Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all

• github.com/Shopify/kubernetes-deploy

• github.com/Shopify/shipit-engine

• Features:

• clear, actionable pass/fail result for

each deploy

• pre-deploy certain types of resources

• decryption of EJSON to k8s secrets

• protected namespaces

kubernetes-deploy

Page 19: Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all

Cloud Platform Architecture

Page 20: Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all

• "Friendly Kubernetes controllers keeping the cloud fluffy"

• ~10 buddies per cluster

• Security automation!

• accountabilibuddy, bucketbuddy, netpolbuddy, rbacbuddy

Cloudbuddies

Page 21: Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all

• github.com/Shopify/kubeaudit

• Audit Kubernetes security controls

• Audits:

• automountServiceAccountToken

• container images

• network policies

• security contexts

• privileged containers

• container capabilities too!

kubeaudit

Page 22: Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all

• Nosy Bastard

• Scheduled scanning (Nessus, NMap, ZMap)

• Discovery of cloud resources (AWS, Heroku, GCP)

• Maps Kubernetes service accounts to RBAC roles

• Forseti Security

• Comprehensive GCP inventorying

• Enforcement of IAM policies

• sshjanitor

• Discovery and deletion of stale project wide ssh keys (> 1h)

Continuous Security Monitoring

Page 23: Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all

What's Missing?

Page 24: Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all

• API server logs -- available in GKE >1.7.3 with Cloud Audit Logging

• Network Policies -- available in GKE >1.7.6 with Tigera's Calico

• PodSecurityPolicies + other admission control?

• IAM and RBAC synchronization

• GLBC configuration options for Identity Aware Proxy

• Container Identity (provisioning of identity by pod/container)

Missing :(

Page 25: Securing Shopify's PaaS on GKE - Sched Shopify's PaaS...cloud resources and k8s, Kritis attestations. Kubernetes Namespaces by Tier 35 50 Tier 1 Tier 2 70 175 Tier 3 Tier 4 * not all

Thanks!