Top Banner
Secrets at Scale Automated Bootstrapping of Secrets and Identity in the Cloud Ian Haken @ianhaken January 30, 2017
18

Automated Bootstrapping of Secrets and Identity in … Bootstrapping of Secrets and Identity in the Cloud Ian Haken @ianhaken January 30, 2017 AES HSM The Problem With Secrets JKS

May 20, 2018

Download

Documents

trinhkien
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: Automated Bootstrapping of Secrets and Identity in … Bootstrapping of Secrets and Identity in the Cloud Ian Haken @ianhaken January 30, 2017 AES HSM The Problem With Secrets JKS

Secrets at ScaleAutomated Bootstrapping of Secrets andIdentity in the Cloud

Ian Haken@ianhakenJanuary 30, 2017

Page 2: Automated Bootstrapping of Secrets and Identity in … Bootstrapping of Secrets and Identity in the Cloud Ian Haken @ianhaken January 30, 2017 AES HSM The Problem With Secrets JKS

AES HSM

The Problem With Secrets

JKS

“Where do I put my secret?”

Page 3: Automated Bootstrapping of Secrets and Identity in … Bootstrapping of Secrets and Identity in the Cloud Ian Haken @ianhaken January 30, 2017 AES HSM The Problem With Secrets JKS

Secrets at Scale

● RDS passwords● HMAC keys● Encryption keys for credit card data, personally

identifiable information, etc.● Third-party API credentials

● TLS/HTTPS Certificate Private Keys

● Basically, anything your application needs to startup or be functional.

Page 4: Automated Bootstrapping of Secrets and Identity in … Bootstrapping of Secrets and Identity in the Cloud Ian Haken @ianhaken January 30, 2017 AES HSM The Problem With Secrets JKS

Services at Netflix are

Secrets at Scale

● Autoscaling● Ephemeral● Self-healing

Page 5: Automated Bootstrapping of Secrets and Identity in … Bootstrapping of Secrets and Identity in the Cloud Ian Haken @ianhaken January 30, 2017 AES HSM The Problem With Secrets JKS

Naive Solutions

● Manually copy a secret/config file after the instance is booted?○ No way to scale!

● Just encrypt the secrets?○ How do instances get the decryption key?

● Host the secret somewhere at a hidden URL?○ Now that hidden URL is a secret that needs to be protected…

Most solutions just change what secret you’re protecting. And if you’re protect one secret with another secret…

It’s turtles all the way down...

Page 6: Automated Bootstrapping of Secrets and Identity in … Bootstrapping of Secrets and Identity in the Cloud Ian Haken @ianhaken January 30, 2017 AES HSM The Problem With Secrets JKS

Turtles All the Way Down:Storing Secrets in the Cloud and the Data Center

● Encrypted secrets in source○ Blackbox, GitCrypt, Transcrypt

Daniel Somerfield | ThoughtWorks, AppSec USA 2015

● Secrets managed by orchestration tools○ Chef Vault, Ansible Vault

● Secrets fetched from a Secret Service○ Hashicorp Vault, Square Keywhiz

“Before performing any operation with Vault, the connecting client must be authenticated.… it is important to understand that authentication works by verifying your identity and then generating a token to associate with that identity.”

Page 7: Automated Bootstrapping of Secrets and Identity in … Bootstrapping of Secrets and Identity in the Cloud Ian Haken @ianhaken January 30, 2017 AES HSM The Problem With Secrets JKS

The Identity Problem

● Traditional remote authentication schemes:○ Username and password○ Client Token / Secret○ HMAC with an authentication token○ TLS Certificate and Private Key

● All these schemes involve proving possession of a secret…○ ...making this turtle n+1.

PCI Encryption

Key

HSM Password

Keystore Password

SS Token

●●●

Page 8: Automated Bootstrapping of Secrets and Identity in … Bootstrapping of Secrets and Identity in the Cloud Ian Haken @ianhaken January 30, 2017 AES HSM The Problem With Secrets JKS

Solving the secret storage problem means we need to solve thebootstrap identity problem.

Page 9: Automated Bootstrapping of Secrets and Identity in … Bootstrapping of Secrets and Identity in the Cloud Ian Haken @ianhaken January 30, 2017 AES HSM The Problem With Secrets JKS

Why Not IP For Identity?

VLAN hopping, ARP poisoning and Man-In-The-Middle Attacks in Virtualized EnvironmentsRonny L. Bull, Jeanna N. Matthews, Kaitlin A. Trumbullhttps://media.defcon.org/DEF%20CON%2024/DEF%20CON%2024%20presentations/DEFCON-24-Bull-Matthews-Trumbull-VLAN-Hopping-ARP-MITM-in-Virtualized-WP-UPDATED.pdf

192.168.0.101

NAT10.0.1.12

192.168.0.102

Page 10: Automated Bootstrapping of Secrets and Identity in … Bootstrapping of Secrets and Identity in the Cloud Ian Haken @ianhaken January 30, 2017 AES HSM The Problem With Secrets JKS

Remote Attestation

● In the cloud, our provider knows what application images are running where. This means the cloud provider can facilitate remote attestation.○ In AWS, instances can request a

metadata document signed by AWS.

○ This document is unique to each EC2 instance that calls it and can we used to prove what code (AMI) is running.

Page 11: Automated Bootstrapping of Secrets and Identity in … Bootstrapping of Secrets and Identity in the Cloud Ian Haken @ianhaken January 30, 2017 AES HSM The Problem With Secrets JKS

Who Are You?

http://169.254.169.254/latest/ dynamic/instance-identity

{ "document" : { "privateIp" : "10.16.112.84", "region" : "us-east-1", "instanceId" : "i-1234567890", "accountId" : "123456789012", "imageId" : "ami-5fb8c835", "kernelId" : "aki-919dcaf8", }, "signature" : "lyoYVBoUYrY9n..."}

{ "securityGroups" : { ... }, "iamRole" : "test::creditCardSrv" "user-data" : { "appName" : "creditCardService", ... }}

Page 12: Automated Bootstrapping of Secrets and Identity in … Bootstrapping of Secrets and Identity in the Cloud Ian Haken @ianhaken January 30, 2017 AES HSM The Problem With Secrets JKS

The cloud provider supplies asigned document which provides a cryptographic assertion ofinstance identity.

Additional metadata APIs let use map this to an internal application name and other features.

Page 13: Automated Bootstrapping of Secrets and Identity in … Bootstrapping of Secrets and Identity in the Cloud Ian Haken @ianhaken January 30, 2017 AES HSM The Problem With Secrets JKS

The Developer Experience

$CWD/decrypted/mysecret.txt

/app_working_dir/decrypted/mysecret.txt

Page 14: Automated Bootstrapping of Secrets and Identity in … Bootstrapping of Secrets and Identity in the Cloud Ian Haken @ianhaken January 30, 2017 AES HSM The Problem With Secrets JKS

Universal Identity

Certificate: Data: Issuer: CN = Secret Service CA Subject: CN = creditCardService ...

Certificate: Data: Issuer: CN = Secret Service CA Subject: CN = userBillingService ...

Page 15: Automated Bootstrapping of Secrets and Identity in … Bootstrapping of Secrets and Identity in the Cloud Ian Haken @ianhaken January 30, 2017 AES HSM The Problem With Secrets JKS

The Last Turtle

● With these tools, we’ve accomplished our goals:○ Applications can get their secrets automatically○ Only applications ever see their secrets

● Except… how does the secret server come up?

●●●

PCI Encryption

Key

HSM Password

Keystore Password

Page 16: Automated Bootstrapping of Secrets and Identity in … Bootstrapping of Secrets and Identity in the Cloud Ian Haken @ianhaken January 30, 2017 AES HSM The Problem With Secrets JKS

The Last TurtlePCI

Encryption Key

HSM Password

Keystore Password

Page 17: Automated Bootstrapping of Secrets and Identity in … Bootstrapping of Secrets and Identity in the Cloud Ian Haken @ianhaken January 30, 2017 AES HSM The Problem With Secrets JKS

Summary

● Solving the secret storage problem meant that we had to solve the problem of bootstrapping identity as applications start up.○ But as a bonus, this identity is re-usable throughout the ecosystem.

● The Secret Service itself is also a Secret Service client and uses it to bootstrap its own master key.○ This makes the end-to-end solution auto-scalable and self-healing!

● We now have a clear, simple answer to the question “Where do I put my secret?”○ Put it in the secret service...○ ...and it will automatically show up on your application’s disk.

Page 18: Automated Bootstrapping of Secrets and Identity in … Bootstrapping of Secrets and Identity in the Cloud Ian Haken @ianhaken January 30, 2017 AES HSM The Problem With Secrets JKS

Questions?

Twitter: @[email protected]