Recipe for good secrets management

29
Recipe for Good Secrets Management Boston Chef Meetup - August 2014

description

Discussion of secrets management for DevOps and a recipe for success.

Transcript of Recipe for good secrets management

Page 1: Recipe for good secrets management

Recipe for Good Secrets Management

Boston Chef Meetup - August 2014

Page 2: Recipe for good secrets management

Secrets Management

A strength when done right

Otherwise…

Page 3: Recipe for good secrets management

◁ CodeSpaces

◁ AWS Credential leaks in Github

◁ HIPAA breach violations

◁ Heartbleed update woes

⊃ Was tricky even for the experts

⊃ Required BOTH openssl library update AND certificate rotation

First the bad news

Page 4: Recipe for good secrets management

“I don’t care about compliance”

Really? Would your company ever like to get

6-figure checks from large enterprises?

Page 5: Recipe for good secrets management

Secrets

Traditional approach

ConfigurationManagement(CM)

Artifacts

Orchestration

New Machine

“Secrets has always been kind of a hacky bit; like GPG encrypt a piece of data and stick it in a YAML file”

- Anonymous CM Technologist

Page 6: Recipe for good secrets management

Secrets Management is pretty hard

Page 7: Recipe for good secrets management

Requirement : separation of duties

One single actor should not be able to do everything.

Use separate roles for:

a) Loading credentials

b) Retrieving and using credentials

Page 8: Recipe for good secrets management

Requirement : least privilege

Only give each actor as much power

as is necessary to get the job done.

Page 9: Recipe for good secrets management

Requirement : leak-resistance

Don’t leave secrets lying around on:

◁ unencrypted persistent disks◁ backups◁ snapshots

Page 10: Recipe for good secrets management

Requirement : audit

Record changes:

◁ policies which govern access◁ each time a secret is changed◁ each time a secret is fetch and used

Page 11: Recipe for good secrets management

Requirement : rotation

A secret (e.g. database password, cloud credential)

Should be changed regularly

Page 12: Recipe for good secrets management

Here’s a recipe for good secrets management

Page 13: Recipe for good secrets management
Page 14: Recipe for good secrets management
Page 15: Recipe for good secrets management
Page 16: Recipe for good secrets management

can admin

can admin

can update

can update

can fetch

can fetch

“break glass”account

Environment A : “stage” Environment B : “production”

Page 17: Recipe for good secrets management

can admin

can admin

“break glass”account

Have an emergency access credential

Page 18: Recipe for good secrets management

Environment A : “stage” Environment B : “production”

Separate security environments

Page 19: Recipe for good secrets management

can update

can fetch

can fetch

Environment A : “stage” Environment B : “production”

Design for “robot” actors

Page 20: Recipe for good secrets management

Minimize human access to production

can update

can fetch

Environment B : “production”

Page 21: Recipe for good secrets management

can update

Environment B : “production”

Rotate credentials with privileged robots

Page 22: Recipe for good secrets management

Environment A : “stage” Environment B : “production”

Automatically record system activity

Page 23: Recipe for good secrets management

Where do Configuration Management

and Orchestration fit in?

Page 24: Recipe for good secrets management

Environment A : “stage” Environment B : “production”

Provisioning robots into the system

Page 25: Recipe for good secrets management

Bootstrapping machine identity

Orchestration Server

Launch Scriptor

Console

NewMachine

RobotIdentity Server

● New machine calls to Orchestration Server for identity

● Orchestration passes a credential (token) to Robot Identity Server

● Robot Identity assigns robot identity● Orchestration / CM installs identity on the new

machine

Page 26: Recipe for good secrets management

A new machine is impotent

until identity is acquired

Page 27: Recipe for good secrets management

Fetching secrets

password = secrets_manager.secret([node.

chef_environment,

'mysql/server_root_password'].join('/')

mysql_database 'phpapp' do

connection (host: 'localhost', username:

'root', password: password)

action :create

end

http://gettingstartedwithchef.com/first-steps-with-chef.html

● Replace sensitive attribute data with secrets from the secrets manager

● Use the environment name to separate secrets into permissions namespaces

Page 28: Recipe for good secrets management

template '/dev/shm/mysql.conf' do …endlink '/dev/shm/mysql.conf' do to '/etc/mysql.conf'end

Keep secrets separate from dataGeneral strategy for Linux - install secrets to /dev/shm

template '/mnt/etc/mysql.conf' do …endlink '/mnt/etc/mysql.conf' do to '/etc/mysql.conf'end

General strategy for ec2 - install secrets to /mnt

Page 29: Recipe for good secrets management

Keeping secrets separate from

data helps to satisfy important

compliance and security standards

such as PCI and HIPAA