Secret Management with Hashicorp's Vault Daniel Bornkessel Secret - - PowerPoint PPT Presentation

secret management with hashicorp s vault
SMART_READER_LITE
LIVE PREVIEW

Secret Management with Hashicorp's Vault Daniel Bornkessel Secret - - PowerPoint PPT Presentation

Secret Management with Hashicorp's Vault Daniel Bornkessel Secret Management with Hashicorp's Vault X Secret Management with Hashicorp's Vault Daniel Bornkessel Secret Management with Hashicorp's Vault Focus of this talk what is


slide-1
SLIDE 1

Secret Management with Hashicorp's Vault

Daniel Bornkessel

slide-2
SLIDE 2

X

Secret Management with Hashicorp's Vault

slide-3
SLIDE 3
slide-4
SLIDE 4

Secret Management with Hashicorp's Vault

Daniel Bornkessel

slide-5
SLIDE 5

Focus of this talk

3

  • what is secret management
  • why do you need it
  • what is Vault and how can it help you with secret management
  • some Vault internals

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-6
SLIDE 6

Goal of this talk

4

  • think about best practices with secrets that your company could

improve on

  • go and play with Vault

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-7
SLIDE 7

Why focus on Vault

5

  • unmatched (afaik) feature set
  • not vendor or framework specific
  • open source (mostly … some closed sourced enterprise features)

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-8
SLIDE 8

Other solutions*

6

  • KeyWiz from Square: not as many features, no dynamic secrets,

HSM in open source version

  • Cloud Foundry CredHub: tailored and specific to Cloud Foundry
  • AWS Secrets Manager: AWS specific, promising, dynamic’esque

secrets for certain AWS services, automatic rotation (for supported services + extendable via Lambda functions)

  • self made: a lot of complexity and work

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

* I have not personally used those solutions

slide-9
SLIDE 9

7

Secret Managemant

Secret Management with Hashicorp's Vault

slide-10
SLIDE 10

Secrets

X

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

  • sensitive data != secrets
  • tokens
  • passwords
  • certificates
  • API keys
  • etc.

… but: secrets == sensitive data

slide-11
SLIDE 11

Secret Management

8

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

  • part of your security concept
  • one focus: on internal threads like
  • rogue employees
  • unauthorized access to secrets
  • long living secrets
  • audit log: who requested credentials for which system at what

point of time

  • high automation for changing / revoking / rolling secrets
  • high entropy passwords
slide-12
SLIDE 12

Quelle / Max Mustermann

todo: extreme example

9

Secret Management with Hashicorp's Vault

slide-13
SLIDE 13

10

Secret Management with Hashicorp's Vault

slide-14
SLIDE 14

Secret Management: current situation

11

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

  • best practices are widely known
  • is usually seen as (very) important
  • implementation is hard
  • solutions are rare
  • apps and frameworks not ready for modern secret management
  • high automation still an exception (as opposed to external thread

mitigation measures)

  • often neglected in favour of business critical features
slide-15
SLIDE 15

Question

12

Who here has production credentials on their laptop at this very moment (e.g. AWS credentials file, DB credentials, passwordless ssh private keys to access machines or git repos, API-keys, etc.)? Who thinks this is a good idea?

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-16
SLIDE 16

13

Why am I talking about secret management

Secret Management with Hashicorp's Vault

slide-17
SLIDE 17

About me

14

Daniel Bornkessel / @kesselborn

  • Senior Consultant at INNOQ (part time)
  • Focus on DevOps & Continuous Delivery

INNOQ

  • Consulting, reviews and development
  • https:/

/www.innoq.com/de/culture/working-at-innoq/

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-18
SLIDE 18

Typical project

15

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

  • Monolith -> Micro Services / Self Contained Systems
  • Language: set (mostly Java)
  • Framework: set (often Spring Boot)
  • Data center: set (mostly AWS or on premise)
  • Container Management: set (mostly Kubernetes)
  • CI: set (whatever they used before … mostly Jenkins)
  • Logging / Monitoring: set (ELK & ?)
  • Secret Management: sure … eh … wat?

prometheus)

  • r even better: use Concourse CI)

please for god’s sake: use Gitlab CI)

slide-19
SLIDE 19

Typical project: Secret Management

16

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

  • we pass secrets in via env vars
  • we read the values from Kubernetes secrets
  • we have role based access control all figured out
  • changing and updating passwords is a manual process for now
  • yeah: audit log is something we are looking into
  • no, we can not confidently say who has the password for DB xy
  • no, we do not change all passwords if an employee leaves the

company

  • revoking credentials is not something we currently support
slide-20
SLIDE 20

Introducing Vault

X

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-21
SLIDE 21

17

Vault — executive summary

Secret Management with Hashicorp's Vault

slide-22
SLIDE 22

Vault — executive summary

X

“A Tool for Managing Secrets”

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-23
SLIDE 23

Vault — executive summary

X

  • not comparable to password managers like 1Password, LastPass,

etc.

  • Vault is designed for the system side of things — password

managers “just” encrypt your static secrets and provide a nice way use them

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-24
SLIDE 24

Vault — executive summary

18

  • secures, stores and tightly controls
  • tokens
  • passwords
  • certificates
  • API keys
  • and other secrets

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-25
SLIDE 25

Vault — executive summary

19

  • handles
  • leasing
  • key revocation
  • key rolling
  • auditing
  • provides an API for all operations
  • is not meant as a service or token provider which gets embedded

in your request / response cycle

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-26
SLIDE 26

20

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

Tokens LDAP AWS Kubernetes Google Cloud auth-n + auth-z AppRole GitHub MFA Okta RADIUS TLS Certificates AWS Consul Cubbyhole Databases Identity secrets Nomad PKI (Certificates) RabbitMQ SSH TOTP Transit

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

slide-27
SLIDE 27

21

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault auth backends

  • Tokens
  • LDAP
  • AWS
  • Kubernetes
  • Google Cloud
  • Username & Password
  • AppRole
  • GitHub
  • MFA
  • Okta
  • RADIUS
  • TLS Certificates
  • AWS
  • Consul
  • Cubbyhole
  • Databases
  • Identity
  • Static secrets (Key /Value)
  • Nomad
  • PKI (Certificates)
  • RabbitMQ
  • SSH
  • TOTP
  • Transit

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

slide-28
SLIDE 28

22

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault secret backends

  • Tokens
  • LDAP
  • AWS
  • Kubernetes
  • Google Cloud
  • Username & Password
  • AppRole
  • GitHub
  • MFA
  • Okta
  • RADIUS
  • TLS Certificates
  • AWS
  • Consul
  • Cubbyhole
  • Databases
  • Identity
  • Static secrets (Key /Value)
  • Nomad
  • PKI (Certificates)
  • RabbitMQ
  • SSH
  • TOTP
  • Transit

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

slide-29
SLIDE 29

23

Vault — secret backends

Secret Management with Hashicorp's Vault

slide-30
SLIDE 30

Vault secret backends — static secrets

X

Secret Management with Hashicorp's Vault

slide-31
SLIDE 31

X

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

Vault secret backends — static secrets

1 vault write secret/app1/api-key

1234- foo- bar

app1

vault read secret/app1/api-key 2

1234- foo- bar

3

slide-32
SLIDE 32

Vault secret backends — dynamic secrets

24

Secret Management with Hashicorp's Vault

slide-33
SLIDE 33

25

  • on-the-fly created credentials (hence dynamic) for each instance
  • f an app / user who wants a secret
  • usually short to medium long ttl
  • fully audited

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault secret backends — dynamic secrets

What they are

slide-34
SLIDE 34

26

  • 1. provide Vault credentials for a user that has rights to create users
  • r tokens in a remote system (e.g. db)
  • 2. configure Vault with settings on how to create credentials
  • 3. configure Vault with settings on how to invalidate credentials in

the remote system

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault secret backends — dynamic secrets

How they work (in a Nutshell)

slide-35
SLIDE 35

Vault secret backends — Databases

27

Secret Management with Hashicorp's Vault

slide-36
SLIDE 36

X

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault secret backends — Databases

  • Idea: get access to databases
  • Vault gets configured with credentials for a database user that

has necessary permissions on the database

  • Vault gets a policy that maps users and roles to users with

configured permissions in the database

  • when user requests credentials, Vault creates a new database

user on the fly

  • when configured (usually the case), all created users have a ttl

assigned — when the ttl is reached, Vault deletes the user from the database

slide-37
SLIDE 37

28

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

db admin config

Vault secret backends — Databases

slide-38
SLIDE 38

29

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

db admin config

Vault secret backends — Databases

vault secrets enable -path=db database vault write db/config/clients \ plugin_name=mysql-database-plugin \ connection_url="admin:pw@tcp(db.example.com)/" \ allowed_roles=“clients-ro,clients-rw” vault write database/roles/clients-ro \ db_name=clients \ creation_statements=“\ CREATE USER '{{name}}'@'%' IDENTIFIED BY \ '{{password}}'; \ GRANT SELECT ON clients.* TO '{{name}}'@'%';" \ default_ttl="1h" \ max_ttl="240h"

slide-39
SLIDE 39

30

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

db admin config

Vault secret backends — Databases

vault secrets enable -path=db database vault write db/config/clients \ plugin_name=mysql-database-plugin \ connection_url="admin:pw@tcp(db.example.com)/" \ allowed_roles=“clients-ro, clients-rw” vault write database/roles/clients-ro \ db_name=clients \ creation_statements=“\ CREATE USER '{{name}}'@'%' IDENTIFIED BY \ '{{password}}'; \ GRANT SELECT ON clients.* TO '{{name}}'@'%';" \ default_ttl="1h" \ max_ttl=“240h"

slide-40
SLIDE 40

31

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

create user …

2

OK

3

Vault secret backends — Databases

db admin config

5

delete user …

ttl

App

read db/creds/clients-ro

1

db login / db password

4

}

configured role

slide-41
SLIDE 41

32

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault secret backends — Databases

Available Plugins:

  • Cassandra
  • HanaDB
  • MongoDB
  • MSSQL
  • MySQL/MariaDB
  • PostgreSQL
  • Oracle
slide-42
SLIDE 42

Vault secret backends — Google Cloud

X

Secret Management with Hashicorp's Vault

slide-43
SLIDE 43

X

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

Vault secret backends — Google Cloud

define rolesets to generate

  • auth2 access tokens (preferred)
  • r Service Accounts

credentials.json …or service account

slide-44
SLIDE 44

X

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

App read gcp/token/dev

1 4 oauth2 token/

service account key

3

  • auth2 token /

service account key

ttl

Vault secret backends — Google Cloud

create token / service account

2

GCP Api

}

configured roleset

credentials.json …or service account

slide-45
SLIDE 45

Vault secret backends — AWS

33

Secret Management with Hashicorp's Vault

slide-46
SLIDE 46

Vault secret backends — AWS

X

  • Idea: get access to AWS resources
  • Vault gets configured with an AWS user that has necessary

permissions

  • Vault gets a policy that maps users or roles to AWS roles
  • when user requests credentials, Vault creates STS tokens, assume

role tokens or dynamic IAM users

  • when configured (usually the case), all created secrets have a ttl

assigned

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-47
SLIDE 47

34

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

aws_access_key aws_secret_key

Vault secret backends — AWS

slide-48
SLIDE 48

35

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

App read aws/creds/dev

1

aws_access_key aws_secret_key

4 TTL’ed Token /

credentials

3

TTL’ed Token / credentials

ttl

Vault secret backends — AWS

create STS / IAM user

2

AWS Api

}

configured role

slide-49
SLIDE 49

Vault secret backends — PKI

36

Secret Management with Hashicorp's Vault

slide-50
SLIDE 50

Vault secret backends — PKI

X

  • Idea: issue client certificates on the fly
  • Vault gets configured a CA Certificate and a private key
  • Vault gets a configuration about how certificates for this CA

should be issues (ttl, subject, etc.)

  • when user requests credentials, Vault issues a certificate on the

fly

  • when configured (usually the case), all created certificates have a

ttl assigned

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-51
SLIDE 51

37

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

add ca.cert & ca.key

Vault secret backends — PKI

slide-52
SLIDE 52

38

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

App write pki/issue/dev

1

add ca.cert & ca.key

3 TTL’ed client

certificate

Vault secret backends — PKI

2

create client certificate

}

configured role

slide-53
SLIDE 53

Vault secret backends — SSH

39

Secret Management with Hashicorp's Vault

slide-54
SLIDE 54

One-Time SSH Passwords

  • Idea: get ssh access to machines
  • every host in the system has a small Vault-helper process running
  • user fetches a one time password from Vault
  • when authenticating via ssh, the Vault-helper checks, whether the
  • ne time password is valid and deletes it

Vault dynamic secret backends — ssh

X

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-55
SLIDE 55

Host 1.1.2.2

40

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

Vault secret backends — SSH

1 vault write ssh/creds/dev ip=1.1.2.2 2 username / otp 3 ssh username@1.1.2.2 4 validate

  • tp

5 grant access

slide-56
SLIDE 56

Signed SSH Certificates

  • Idea: get ssh access to machines
  • user configures Vault-ssh with a CA, a private and a public key
  • the public key gets distributed to all system hosts
  • the user asks Vault to sign one of his public ssh keys with the

provided CA and gets a new, signed public key as a response

  • the user can use this new, signed key to login to machines

Vault dynamic secret backends — ssh

41

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-57
SLIDE 57

Vault dynamic secret backends — Transit

42

Secret Management with Hashicorp's Vault

slide-58
SLIDE 58

Vault dynamic secret backends — Transit

X

  • Idea: de- and encrypt data without handling private keys
  • User creates a new transit path in Vault
  • Users can encrypt data by writing the data to this transit path

(e.g. transit/encrypt/my-keys/foo)

  • Users with sufficient permissions can decrypt data by writing to

the respective transit path (e.g. transit/decrypt/my-keys/foo)

  • the private key never leaves Vault
  • the data is not stored on Vault (hence the name transit)

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-59
SLIDE 59

43

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

2

Vault secret backends — Transit

1 vault write transit/encrypt/app/app1

foo

¯:çÆ #²^? áV¬Î

3 4

App

vault write transit/decrypt/app/app1

foo

¯:çÆ #²^? áV¬Î

slide-60
SLIDE 60

44

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault secret backends

  • Tokens
  • LDAP
  • AWS
  • Kubernetes
  • Google Cloud
  • Username & Password
  • AppRole
  • GitHub
  • MFA
  • Okta
  • RADIUS
  • TLS Certificates
  • AWS
  • Consul
  • Cubbyhole
  • Databases
  • Identity
  • Static secrets (Key /Value)
  • Nomad
  • PKI (Certificates)
  • RabbitMQ
  • SSH
  • TOTP
  • Transit

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

slide-61
SLIDE 61

45

Vault — auth backends

Secret Management with Hashicorp's Vault

slide-62
SLIDE 62

46

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault auth backends

  • Tokens
  • LDAP
  • AWS
  • Kubernetes
  • Google Cloud
  • Username & Password
  • AppRole
  • GitHub
  • MFA
  • Okta
  • RADIUS
  • TLS Certificates
  • AWS
  • Consul
  • Cubbyhole
  • Databases
  • Identity
  • Static secrets (Key /Value)
  • Nomad
  • PKI (Certificates)
  • RabbitMQ
  • SSH
  • TOTP
  • Transit

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

slide-63
SLIDE 63

Vault auth backends — tokens

47

Secret Management with Hashicorp's Vault

slide-64
SLIDE 64

token auth

48

  • created by Vault
  • only way to authorize (auth-z) against Vault
  • returned when authenticated (auth-n) successfully
  • comparable to a session-id on a website
  • has permissions / policies assigned to it

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-65
SLIDE 65

token auth

49

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

$ vault token create -ttl=5m -policy=admin Key Value

  • -- -----

token d9640590-63c8-b3a6-50ac-1403c8180948 token_accessor 5a362982-f34c-3706-143a-26ada278b6cf token_duration 5m token_renewable true token_policies [admin default]

slide-66
SLIDE 66

Vault auth backends — userpass

X

Secret Management with Hashicorp's Vault

slide-67
SLIDE 67

userpass auth

X

  • statically created by users and stored in Vault

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

$ vault auth enable userpass $ vault write auth/userpass/users/kesselborn \ password=foo policies=admin $ vault login -method=userpass username=kesselborn Key Value

  • -- -----

token d9640590-63c8-b3a6-50ac-1403c8180948 . . . token_duration 5m token_policies [admin default]

slide-68
SLIDE 68

X

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

Vault auth backends — userpass

1 vault write /auth/userpass/users/foo

pass word 123

  • setup username / password
slide-69
SLIDE 69

Vault auth backends — userpass

X

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

token

policies

  • authenticate with a username & password

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

1

foo / password123

2

slide-70
SLIDE 70

Vault auth backends — TLS certificates

X

Secret Management with Hashicorp's Vault

slide-71
SLIDE 71

X

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

Vault auth backends — TLS certificates

1 vault write auth/cert/certs/web \ … certificate=@web-cert.pem

  • setup TLS certificate authentication
slide-72
SLIDE 72

Vault auth backends — TLS certificates

X

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

token

policies

  • authenticate with a TLS client certificate

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

1 client certificate 2

slide-73
SLIDE 73

Vault auth backends — external identity providers

50

Secret Management with Hashicorp's Vault

slide-74
SLIDE 74

Vault auth backends — LDAP / Radius / Okta auth

51

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

LDAP

username/ password

1

username/ password

2

user: kesselborn groups: admin, employee

3

token

4

policies

  • $SERVICE is used as an identity provider (using LDAP here)

token

5

policies

slide-75
SLIDE 75

LDAP auth

X

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

$ vault write auth/ldap/config \ url="ldaps://ldap.example.com" \ userattr="uid" \ userdn="ou=People,dc=innoq,dc=com" \ binddn="cn=vaultuser,dc=example,dc=com" \ bindpass="3cK{hrh7hi/Hj" \ groupdn="ou=Group,dc=example,dc=com" \ starttls=true $ vault write auth/ldap/groups/employee policies=employee $ vault write auth/ldap/users/kesselborn policies=admin

slide-76
SLIDE 76

Github auth

52

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

Github

token user: kesselborn teams: kesselfaktur, innnoq token

4 1 2 3

policies

  • Github is used as an identity provider

token

slide-77
SLIDE 77

Vault auth backends — Kubernetes auth

53

Secret Management with Hashicorp's Vault

slide-78
SLIDE 78

token

5

policies

Vault auth backends — Kubernetes auth

54

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key /var └─ run └─ secrets └─ kubernetes.io └─ serviceaccount └─ token

K8s API

2 auth against

k8s API K8s container

1

K8s token token

4

policies

3

service_account_name: app1 service_account_namespace: default

slide-79
SLIDE 79

Vault auth backends — Kubernetes auth

55

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

K8s API

2 auth against

k8s API K8s container

3

success / failure

Pod

app init

1

K8s token token

4

policies

token

policies

5

slide-80
SLIDE 80

Vault auth backends — Kubernetes auth

X

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

$ vault auth enable kubernetes $ vault write auth/kubernetes/config \ kubernetes_host=“https://api.k8s.example.com" \ kubernetes_ca_cert=“@ca.crt" $ vault write auth/kubernetes/role/demo \ bound_service_account_names=vault-auth \ bound_service_account_namespaces=default \ policies=default \ ttl=1h

slide-81
SLIDE 81

Vault auth backends — GCE auth

X

Secret Management with Hashicorp's Vault

>>

slide-82
SLIDE 82

Vault auth backends — GCE auth

Secret Management with Hashicorp's Vault

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

OAuth2 API GCE Instance meta data server

1 2

JWT

signed

3

JWT

signed

verify JWT signature using kid value against Google public certificates

4

curl -H "Metadata-Flavor: Google" \ 'http://metadata/computeMetadata/v1/instance/service-accounts/default/identity?audience=[AUDIENCE]&format=[FORMAT]'

policies

token

6

policies

5 token

JWT: { "project_id": “…”, "project_number": …, "zone": “…”, "instance_id": …, "instance_name": “…” "instance_creation_timestamp": … }

slide-83
SLIDE 83

Vault auth backends — AWS auth

56

Secret Management with Hashicorp's Vault

>>

slide-84
SLIDE 84

Vault auth backends — AWS auth

X

  • Vault checks passed in data was encrypted with a AWS private

key

  • can be limited to instances which have a specific instance role

applied

  • can be limited (and usually is) to allow one authentication per ec2

instance only

  • after authentication, roles and policies are mapped as usual

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-85
SLIDE 85

Vault auth backends — AWS auth

Secret Management with Hashicorp's Vault

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

EC2 API EC2 Instance EC2 MetaData Services

1 2

AWS Instance Identity Document

PKCS#7

3

AWS Instance Identity Document

PKCS#7

4

verify PKCS#7 signature against AWS public keys

verify instance

5

(optionally) set instance on blacklist to avoid double authentication

8

curl -s http://169.254.169.254/latest/dynamic/instance-identity/pkcs7

6 instance_id: i-a832f734

ami_id: ami-f083709d …

policies

7 token

policies

token

9

slide-86
SLIDE 86

Vault auth backends — AWS auth

X

$ vault write auth/aws/role/dev-role \ auth_type=ec2 \ bound_ami_id=ami-fce3c696 \ policies=prod,dev max_ttl=500h $ vault write auth/aws/role/dev-role-iam \ auth_type=iam \ bound_ iam_instance_profile_arn =… \ policies=prod,dev max_ttl=500h

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-87
SLIDE 87

Vault auth backends — AWS auth

58

  • alternatively: IAM auth method
  • client signs a GetCallerIdentity query using the AWS Signature

v4 algorithm and submits 4 pieces of information to the Vault server to recreate a valid signed request

  • https:/

/www.vaultproject.io/docs/auth/aws.html#iam-auth- method

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-88
SLIDE 88

Vault auth backends — AppRole

59

Secret Management with Hashicorp's Vault

>>

slide-89
SLIDE 89

Vault auth backends — AppRole

X

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

  • a generic approach to authenticate machines or applications
  • an AppRole can be created for a particular machine, a

particular user on that machine, or a service spread across machines

  • for authenticating, two values are needed
  • RoleID: static, can live with an app or on a machine)
  • SecretID: gets created on the fly before authenticating
slide-90
SLIDE 90

Vault auth backends — AppRole

X

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

RoleID + SecretID

4

  • mainly used for machines or apps to authenticate against Vault

App RoleID Some process

(puppet, chef, etc.)

1

request SecretID

3 SecretID

policies

token

5 2 SecretID

slide-91
SLIDE 91

Vault auth backends — AppRole

X

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

1 2 3 4

policies

  • mainly used for machines or apps to authenticate against Vault

App RoleID Some process

(K8s side car, chef, etc.)

token

request SecretID wrapped SecretID

5

wrapped SecretID

unwrap SecretID SecretID

6 7

RoleID + SecretId

slide-92
SLIDE 92

X

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault auth backends

  • Tokens
  • LDAP
  • AWS
  • Kubernetes
  • Google Cloud
  • Username & Password
  • AppRole
  • GitHub
  • MFA
  • Okta
  • RADIUS
  • TLS Certificates
  • AWS
  • Consul
  • Cubbyhole
  • Databases
  • Identity
  • Static secrets (Key /Value)
  • Nomad
  • PKI (Certificates)
  • RabbitMQ
  • SSH
  • TOTP
  • Transit

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

slide-93
SLIDE 93

Use whatever the auth you want

60

Secret Management with Hashicorp's Vault

slide-94
SLIDE 94

61

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

  • Tokens
  • LDAP
  • AWS
  • Kubernetes
  • Google Cloud
  • Username & Password
  • AppRole
  • GitHub
  • MFA
  • Okta
  • RADIUS
  • TLS Certificates
  • AWS
  • Consul
  • Cubbyhole
  • Databases
  • Identity
  • Static secrets (Key /Value)
  • Nomad
  • PKI -> Kubernetes access
  • RabbitMQ
  • SSH
  • TOTP
  • Transit

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

slide-95
SLIDE 95

62

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

  • Tokens
  • LDAP
  • AWS
  • Kubernetes
  • Google Cloud
  • Username & Password
  • AppRole
  • GitHub
  • MFA
  • Okta
  • RADIUS
  • TLS Certificates
  • AWS
  • Consul
  • Cubbyhole
  • Databases
  • Identity
  • Static secrets (Key /Value)
  • Nomad
  • PKI (Certificates)
  • RabbitMQ
  • SSH
  • TOTP
  • Transit

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

slide-96
SLIDE 96

63

Vault — policies

Secret Management with Hashicorp's Vault

slide-97
SLIDE 97

64

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

  • Tokens
  • LDAP
  • AWS
  • Kubernetes
  • Google Cloud
  • Username & Password
  • AppRole
  • GitHub
  • MFA
  • Okta
  • RADIUS
  • TLS Certificates
  • AWS
  • Consul
  • Cubbyhole
  • Databases
  • Identity
  • Static secrets (Key /Value)
  • Nomad
  • PKI (Certificates)
  • RabbitMQ
  • SSH
  • TOTP
  • Transit

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

Vault — secret representation

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

slide-98
SLIDE 98

65

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients-ro │ └── clients-rw ├── pki │ └── issue │ └── broker ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── developers │ └── admins └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

Vault — secret representation

slide-99
SLIDE 99

66

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients-ro │ └── clients-rw ├── pki │ └── issue │ └── broker ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── developers │ └── admins └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

Vault — policies

  • applied to “files” or

“directories”

  • support filesystem

wildcards

  • control what a user can

access

  • get assigned after

authentication

  • policies of a token can’t

be changed

slide-100
SLIDE 100

67

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients-ro │ └── clients-ro ├── pki │ └── issue │ └── broker ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── developers │ └── admins └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

Vault — policies

  • create
  • read
  • update
  • delete
  • list
  • deny
  • sudo

r c u d l d s

slide-101
SLIDE 101

68

Secret Management with Hashicorp's Vault

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients-ro │ └── clients-rw ├── pki │ └── issue │ └── broker ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── developers │ └── admins └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

Vault — policies

path “secret/team/app1/*“ { capabilities = [“read”, “list”] }

r l w

path “pki/issue/broker” { capabilities = [“write”] }

r

path “database/creds/clients-ro“ { capabilities = [“read”] } $ cat app1-policy.hcl

slide-102
SLIDE 102

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ ├── config │ | ├── clients │ └── role │ ├── clients-ro ├── pki │ ├── config │ | ├── broker │ └── role │ └── borker ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── developers │ └── admins └── transit ├── decrypt X

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

Vault — policies

$ cat app1-erna-policy.hcl

c l u r d

path “secret/team/app1/*“ { capabilities = [“read”, “list”, “create”, “update”, “delete”] }

c u d

path “pki/config/*” { capabilities = [“create”, “update”, “delete”] }

c u d

path “pki/role/*” { capabilities = [“create”, “update”, “delete”] }

c u d

path “database/config/clients“ { capabilities = [“create”, “update”, “delete”] } path “database/role/clients-ro“ { capabilities = [“create”, “update”, “delete”] }

c u d

path “ssh/creds/developers“ { capabilities = [“read”] }

r

slide-103
SLIDE 103

69

Vault — Audit log

Secret Management with Hashicorp's Vault

slide-104
SLIDE 104

Vault internals — Audit log

70

  • off by default
  • supported backend
  • file
  • syslog
  • socket
  • if audit log can not be written, Vault does not reply to requests

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-105
SLIDE 105

Vault internals — Audit log

71

  • every operation creates a log entry with
  • what was done
  • when was it executed
  • by who was it requested
  • request payload
  • response payload
  • sensitive data is hashed with a salt using HMAC-SHA256

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-106
SLIDE 106

Vault internals — Audit log

72

  • {"time":"2018-10-10T10:59:53.557231528Z","type":"response","auth":

{"client_token":"hmac- sha256:41f2474f04f6277eb43cc8eae700dbc8534c5369d9185991eed4c4f70b1a5840","accessor": "hmac- sha256:27e400da69c94fce2378f5738cbf950531d7a9513215274abfbbdaa4927e00ba","display_na me":"ldap-daniel.bornkessel@innoq.com","policies":["default"],"token_policies": ["default"],"metadata": {"username":"daniel.bornkessel@innoq.com"},"entity_id":"8950f5f7-fad8-3ecb-4e62- e5841815df60"},"request":{"id":"9f2b6dfa-5c18- af6a-1f66-2c78b25a875f","operation":"list","client_token":"hmac- sha256:41f2474f04f6277eb43cc8eae700dbc8534c5369d9185991eed4c4f70b1a5840","client_tok en_accessor":"hmac- sha256:27e400da69c94fce2378f5738cbf950531d7a9513215274abfbbdaa4927e00ba","path":"sec ret/","data":null,"policy_override":false,"remote_address":"100.96.0.76","wrap_ttl": 0,"headers":{}},"response":{"data":{"error":"hmac- sha256:d9d7a78363fd091f1b4c12629b7c9b5d7a7ffbf904ef5d29d002d5265d5bbf33"}},"error":" 1 error occurred:\n\n* permission denied"}

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-107
SLIDE 107

73

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Vault

  • Tokens
  • LDAP
  • AWS
  • Kubernetes
  • Google Cloud
  • Username & Password
  • AppRole
  • GitHub
  • MFA
  • Okta
  • RADIUS
  • TLS Certificates
  • AWS
  • Consul
  • Cubbyhole
  • Databases
  • Identity
  • Static secrets (Key /Value)
  • Nomad
  • PKI (Certificates)
  • RabbitMQ
  • SSH
  • TOTP
  • Transit

Vault

├── aws │ └── creds │ ├── admin │ └── developer ├── database │ └── creds │ ├── clients │ └── contracts ├── pki │ └── issue │ └── example-com ├── secret │ └── team │ ├── app1 │ │ └── api-keys │ │ ├── google-analytics │ │ └── paypal │ └── app2 │ └── foo ├── ssh │ └── creds │ ├── erika │ └── erna └── transit ├── decrypt │ └── team-1-key └── encrypt └── team-1-key

policies

policies audit logs

slide-108
SLIDE 108

74

Vault internals

Secret Management with Hashicorp's Vault

slide-109
SLIDE 109

Vault internals — storage

75

Secret Management with Hashicorp's Vault

slide-110
SLIDE 110

Vault internals — storage

76

  • several storage backends available: Consul, Etcd, Azure,

Cassandra, CockroachDB, CouchDB, DynamoDB, Filesystem, FoundationDB, Google Cloud Spanner, Google Cloud Storage, In-Memory, Manta, MySQL, PostgreSQL, S3, Swift, Zookeeper

  • data encrypted at rest with a symmetric key
  • symmetric key is encrypted by “master key” and stored on

storage backend

  • master key is encrypted with “Shamir’s Secret Sharing”

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-111
SLIDE 111

Vault internals — storage

77

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

  • 1 … N keys are needed in order to decrypt the data
  • you can provide the decryption keys in any order
  • N … N+M keys can be created and distributed to different parties

Shamir’s Secret Sharing

slide-112
SLIDE 112

Vault internals — storage

78

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

  • by default, Vault creates 5 keys on initialization (which is a once

per storage backend operation)

  • 3 of the 5 keys are needed in order to unseal a Vault instance
  • this is configurable (e.g. 10/8, 15/5, etc.)

Shamir’s Secret Sharing

slide-113
SLIDE 113

Vault internals — storage

79

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

Shamir’s Secret Sharing

  • HA of key holders
  • one key alone is worthless
  • key holder != admins: designers, ops, devs, etc.
  • new unsealing keys can be created when provided enough

unsealing keys (e.g. when employees leave the company)

  • every time a Vault instance is started, the master key has to be

decrypted

slide-114
SLIDE 114

Vault internals — HA

80

Secret Management with Hashicorp's Vault

slide-115
SLIDE 115

Vault internals — HA

X

  • some backends support Vault HA mode (currently: Consul, Etcd,

DynamoDB, Foundation DB, Google Cloud Spanner, Google Cloud Storage, MySQL, Zookeeper)

  • Active-Passive mode:
  • only the active Vault instance replies to requests
  • all other Vault instances reply with a HTTP 302 to the active

Vault instance (i.e. LB in front of HA Vaults does not make sense)

  • leader election done in storage backend

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-116
SLIDE 116

81

Vault usage

Secret Management with Hashicorp's Vault

slide-117
SLIDE 117

Vault usage — integration

82

Secret Management with Hashicorp's Vault

slide-118
SLIDE 118

Vault usage — integration

83

  • some frameworks have integration for Vault
  • when home made solution
  • create config files with a helper app to avoid development pain
  • prepare your app for ttl’ed credentials: react accordingly if the

(e.g.) DB password is not valid anymore:

  • re-read config file with new credentials
  • make sure, helper app gets new credentials in time
  • re-try DB request
  • when in a container managed system, exit if appropriate

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-119
SLIDE 119

Vault usage — getting started

84

Secret Management with Hashicorp's Vault

slide-120
SLIDE 120

Vault — getting started (1 minute invest)

85

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

https:/ /www.vaultproject.io/#/demo/0

slide-121
SLIDE 121

Vault — getting started

86

  • interactive tutorial
  • download it locally and start it with ‘--dev’ parameter

(investment: 20 min - a few hours)

  • there is a steep learning curve
  • different backends use the same words with different meanings

(ttl, tokens, etc.)

  • hard to quickly test something as you need the backend

systems in place: AWS auth to get MySQL passwords?

  • most tutorials only run in dev mode

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-122
SLIDE 122

Vault — recap

X

You authenticate somehow, get a token with some policy attached to it, which again allows you to read some secrets.

Secret Management with Hashicorp's Vault Quelle / Max Mustermann

slide-123
SLIDE 123

Keynote 16:9-Vorlagen

Lorem ipsum dolor sit amet

EDITION 2018
 DIE FIRMA . EXPERIENCE DESIGN

Thank you and auf Wiedersehen

We are hiring in Hamburg, Berlin, Munich, Frankfurt, Monheim (between Düsseldorf and Cologne), and remote

https:/ /www.innoq.com/en/culture/working-at-innoq/ https:/ /www.innoq.com/de/culture/working-at-innoq/