Vault - Secret and Key Management

Anthony Ikeda
Anthony IkedaTechnical Team Lead at Roche Molecular Systems um Roche Molecular Systems
HashiCorp Vault
Managing Secrets and Passwords
What this Brown Bag is about
Quick intro to HashiCorp Vault
Storing secrets/config with Vault
Integrating systems using Vault
What this Brown Bag is NOT
about
Consul Discovery
Using Vault as an oAuth service
Ever had this happen to you?
**** WARNING AWS SECRET FOUND IN REPO ****
**** WARNING CREDENTIALS FOUND! ****
config:
aws_access_key_id: AHSSKK21342KJ234LJH
aws_secret_access_key_id: XXXXXXXXXXXXXXX
config:
jdbc.username: quickadminuser
jdbc.password: G3tM30u70fH3r3!
Storing credentials in a
public repo is risky!
Tip
Never push credentials
to GitHub.
GitHub uses bots to
scan files on public
repos to discover keys
and secrets!
Vault by Hashicorp
Vault secures, stores, and tightly controls access to tokens,
passwords, certificates, API keys, and other secrets in modern
computing. Vault handles leasing, key revocation, key rolling,
and auditing. Through a unified API, users can access an
encrypted Key/Value store and network encryption-as-a-
service, or generate AWS IAM/STS credentials, SQL/NoSQL
databases, X.509 certificates, SSH credentials, and more.
How many times do you
change your
password? Tip
No one is expected to
change their password
every day.
Though it is a good idea
to change your
password regularly.
Agenda
Overview of Vault
Vault Architecture
Vault Data Storage Options
Vault Authentication Options
Policies
Using Vault
Demo
Vault by Hashicorp
● Secret storage
● Key & Password Rotation
● Audit Logs
● Object Storage
Vault Architecture
Vault Architecture
Access Vault with:
command line tool
HTTP APIs
$ vault read secret/patient-svc
$ curl -X GET -H “X-Vault-Token: $VAULT_TOKEN”
“http://vault:8200/v1/secret/patient-svc”
12 Factor App
Software as a Service
Declarative Format
Minimize Divergence
Scale up without changes
https://12factor.net
Tip
12 Factor App helps
separate the application
from the environment
removing the distinction
of the environment and
the application.
Vault Storage Options
Consul (HA)
etcd (HA)
ZooKeeper (HA)
DynamoDB (HA)
S3
Google Cloud Storage
Azure
Swift
MySQL
PostgreSQL
InMem
File
Vault Backends (Mounts)
AWS
Cassandra
Consul
Cubbyhole
Generic
MongoDB
MSSQL
MySQL
PKI Certificates
PostgreSQL
RabbitMQ
SSH
Transit
Custom
Vault Authentication
App Id
AppRole
AWS EC2
GitHub
LDAP
● MFA
● TLS Certificates
● Tokens
● Username & Password
AppRole Authentication
Requires a role_id (UUID) and secret (UUID)
Secret is volatile
lasts for a preconfigured time and number of uses
Application requests a client token using role_id & secret_id
Client token is used to access vault
AppRole Authentication
Vault Policies
Control who has access to which parts of Vault
Capabilities include:
Create
Read
Update
List
Sudo
Vault Policies
Create a new consumer (Token)
$ vault policy-write patient-policy @patient-policy.json
$ vault token-create -policy=’patient-policy’
Key Value
--- -----
token a7c4e3c1-f9b3-71c0-514c-67c469b9bd3f
token_accessor 40d7fcf6-8ff1-c6c4-632f-9916935ba9a3
token_duration 768h0m0s
token_renewable true
token_policies [patient-policy default]
Create a new consumer
(AppRole)
$ vault write auth/approle/role/cloud-auth-role secret_id_ttl=10m
token_ttl=20m token_max_ttl=30m secret_id_num_uses=40 policies=patient-
policy
$ vault read auth/approle/role/cloud-auth-role/role_id
Key Value
--- -----
role_id d4494db4-4047-90fb-30ec-18a5fa79cc19
Create a new consumer
(AppRole)
$ vault write -f auth/approle/role/cloud-auth-role/secret-id
Key Value
--- -----
secret_id e01b6593-03c4-6023-cec2-24c8f3c0f2d7
secret_id_accessor cde853e3-f264-816f-479e-a63a15097630
Create a new consumer
(AppRole)
$ vault write auth/approle/login 
role_id=d4494db4-4047-90fb-30ec-18a5fa79cc19
secret_id=e01b6593-03c4-6023-cec2-24c8f3c0f2d7
Key Value
--- -----
token 50a69d9b-f5ad-21d8-386d-f6fbbbef404d
token_accessor 6a72e1af-15ae-b896-211d-4f218214db20
token_duration 20m0s
token_renewable true
token_policies [default patient-policy]
Storing data to Vault
$ vault write secret/application app_name=”My Application”
Success! Data written to secret/application
$ vault read secret/application
Key Value
--- -----
refresh_interval 768h0m0s
name My Application
Storing data to Vault
$ vault write secret/application @data.json
Success! Data written to secret/application
$ vault read secret/application
Key Value
--- -----
refresh_interval 768h0m0s
name My Application
conn_url tcp(192.168.99.100:3306)
data.json
{
“name” : “My Application”,
“conn_url” : “tcp(192.168.99.100:3306)”
}
Setting up MySQL Mount
$ vault mount mysql
$vault write mysql/config/connection
connection_url=”user:password@tcp(database:port)/”
$ vault write mysql/roles/patient-svc
sql = “CREATE USER ‘{{name}}’@’%’ IDENTIFIED BY ‘{{password}}’;
GRANT ALL ON patient_db.* TO ‘{{name}}’@’%’;”
Configure your application
spring.cloud.vault.mysql:
enabled: true
role: patient-svc
backend: mysql
DEMO
Spring Cloud Vault
Demo
Basic Spring JDBC integration
Request JDBC Username/Password
Return database metadata (database name & version)
Request config data from Vault
Display value
JPA Integration
Persist data to MySQL using:
Architecture
Spring Cloud Vault
http://cloud.spring.io/spring-cloud-vault-config/
Currently at 1.0.0.M1
Add-on to the Spring Cloud Suite
Supports configuration and optional database config
1 von 31

Recomendados

HashiCorp's Vault - The Examples von
HashiCorp's Vault - The ExamplesHashiCorp's Vault - The Examples
HashiCorp's Vault - The ExamplesMichał Czeraszkiewicz
3.2K views42 Folien
Hashicorp Vault ppt von
Hashicorp Vault pptHashicorp Vault ppt
Hashicorp Vault pptShrey Agarwal
4.4K views11 Folien
Introducing Vault von
Introducing VaultIntroducing Vault
Introducing VaultRamit Surana
1.3K views34 Folien
Secret Management with Hashicorp’s Vault von
Secret Management with Hashicorp’s VaultSecret Management with Hashicorp’s Vault
Secret Management with Hashicorp’s VaultAWS Germany
2.4K views100 Folien
Vault 101 von
Vault 101Vault 101
Vault 101Hazzim Anaya
528 views39 Folien
Vault von
VaultVault
Vaultdawnlua
658 views30 Folien

Más contenido relacionado

Was ist angesagt?

Credential store using HashiCorp Vault von
Credential store using HashiCorp VaultCredential store using HashiCorp Vault
Credential store using HashiCorp VaultMayank Patel
376 views34 Folien
Keeping a Secret with HashiCorp Vault von
Keeping a Secret with HashiCorp VaultKeeping a Secret with HashiCorp Vault
Keeping a Secret with HashiCorp VaultMitchell Pronschinske
1.5K views26 Folien
Neil Saunders (Beamly) - Securing your AWS Infrastructure with Hashicorp Vault von
Neil Saunders (Beamly) - Securing your AWS Infrastructure with Hashicorp Vault Neil Saunders (Beamly) - Securing your AWS Infrastructure with Hashicorp Vault
Neil Saunders (Beamly) - Securing your AWS Infrastructure with Hashicorp Vault Outlyer
2.1K views22 Folien
Chickens & Eggs: Managing secrets in AWS with Hashicorp Vault von
Chickens & Eggs: Managing secrets in AWS with Hashicorp VaultChickens & Eggs: Managing secrets in AWS with Hashicorp Vault
Chickens & Eggs: Managing secrets in AWS with Hashicorp VaultJeff Horwitz
6.2K views53 Folien
HashiCorp Vault Workshop:幫 Credentials 找個窩 von
HashiCorp Vault Workshop:幫 Credentials 找個窩HashiCorp Vault Workshop:幫 Credentials 找個窩
HashiCorp Vault Workshop:幫 Credentials 找個窩smalltown
2.3K views109 Folien
Building secure applications with keycloak von
Building secure applications with keycloak Building secure applications with keycloak
Building secure applications with keycloak Abhishek Koserwal
7.9K views20 Folien

Was ist angesagt?(20)

Credential store using HashiCorp Vault von Mayank Patel
Credential store using HashiCorp VaultCredential store using HashiCorp Vault
Credential store using HashiCorp Vault
Mayank Patel376 views
Neil Saunders (Beamly) - Securing your AWS Infrastructure with Hashicorp Vault von Outlyer
Neil Saunders (Beamly) - Securing your AWS Infrastructure with Hashicorp Vault Neil Saunders (Beamly) - Securing your AWS Infrastructure with Hashicorp Vault
Neil Saunders (Beamly) - Securing your AWS Infrastructure with Hashicorp Vault
Outlyer2.1K views
Chickens & Eggs: Managing secrets in AWS with Hashicorp Vault von Jeff Horwitz
Chickens & Eggs: Managing secrets in AWS with Hashicorp VaultChickens & Eggs: Managing secrets in AWS with Hashicorp Vault
Chickens & Eggs: Managing secrets in AWS with Hashicorp Vault
Jeff Horwitz6.2K views
HashiCorp Vault Workshop:幫 Credentials 找個窩 von smalltown
HashiCorp Vault Workshop:幫 Credentials 找個窩HashiCorp Vault Workshop:幫 Credentials 找個窩
HashiCorp Vault Workshop:幫 Credentials 找個窩
smalltown 2.3K views
Building secure applications with keycloak von Abhishek Koserwal
Building secure applications with keycloak Building secure applications with keycloak
Building secure applications with keycloak
Abhishek Koserwal7.9K views
Using Vault to decouple MySQL Secrets von Derek Downey
Using Vault to decouple MySQL SecretsUsing Vault to decouple MySQL Secrets
Using Vault to decouple MySQL Secrets
Derek Downey2K views
Vault Open Source vs Enterprise v2 von Stenio Ferreira
Vault Open Source vs Enterprise v2Vault Open Source vs Enterprise v2
Vault Open Source vs Enterprise v2
Stenio Ferreira2.1K views
“How to Secure Your Applications With a Keycloak? von GlobalLogic Ukraine
“How to Secure Your Applications With a Keycloak?“How to Secure Your Applications With a Keycloak?
“How to Secure Your Applications With a Keycloak?
Kubernetes Secrets Management on Production with Demo von Opsta
Kubernetes Secrets Management on Production with DemoKubernetes Secrets Management on Production with Demo
Kubernetes Secrets Management on Production with Demo
Opsta167 views
HashiCorp Vault configuration as code via HashiCorp Terraform- stories from t... von Andrey Devyatkin
HashiCorp Vault configuration as code via HashiCorp Terraform- stories from t...HashiCorp Vault configuration as code via HashiCorp Terraform- stories from t...
HashiCorp Vault configuration as code via HashiCorp Terraform- stories from t...
Andrey Devyatkin781 views
Designing High Availability for HashiCorp Vault in AWS von ☁ Bryan Krausen
Designing High Availability for HashiCorp Vault in AWSDesigning High Availability for HashiCorp Vault in AWS
Designing High Availability for HashiCorp Vault in AWS
☁ Bryan Krausen971 views
Kong API Gateway von Chris Mague
Kong API Gateway Kong API Gateway
Kong API Gateway
Chris Mague3.1K views
Building an Ethereum Wallet using Hashicorp Vault von Jeff Ploughman
Building an Ethereum Wallet using Hashicorp VaultBuilding an Ethereum Wallet using Hashicorp Vault
Building an Ethereum Wallet using Hashicorp Vault
Jeff Ploughman1.1K views
Keycloak Single Sign-On von Ravi Yasas
Keycloak Single Sign-OnKeycloak Single Sign-On
Keycloak Single Sign-On
Ravi Yasas516 views
Eliminating Secret Sprawl in the Cloud with HashiCorp Vault - 07.11.2018 von HashiCorp
Eliminating Secret Sprawl in the Cloud with HashiCorp Vault - 07.11.2018Eliminating Secret Sprawl in the Cloud with HashiCorp Vault - 07.11.2018
Eliminating Secret Sprawl in the Cloud with HashiCorp Vault - 07.11.2018
HashiCorp2.6K views
Container Network Interface: Network Plugins for Kubernetes and beyond von KubeAcademy
Container Network Interface: Network Plugins for Kubernetes and beyondContainer Network Interface: Network Plugins for Kubernetes and beyond
Container Network Interface: Network Plugins for Kubernetes and beyond
KubeAcademy14.1K views

Similar a Vault - Secret and Key Management

API Security : Patterns and Practices von
API Security : Patterns and PracticesAPI Security : Patterns and Practices
API Security : Patterns and PracticesPrabath Siriwardena
4.6K views34 Folien
Adding Identity Management and Access Control to your App von
Adding Identity Management and Access Control to your AppAdding Identity Management and Access Control to your App
Adding Identity Management and Access Control to your AppFIWARE
892 views40 Folien
Adding identity management and access control to your app von
Adding identity management and access control to your appAdding identity management and access control to your app
Adding identity management and access control to your appÁlvaro Alonso González
409 views40 Folien
Hashicorp Chicago HUG - Secure and Automated Workflows in Azure with Vault an... von
Hashicorp Chicago HUG - Secure and Automated Workflows in Azure with Vault an...Hashicorp Chicago HUG - Secure and Automated Workflows in Azure with Vault an...
Hashicorp Chicago HUG - Secure and Automated Workflows in Azure with Vault an...Stenio Ferreira
236 views17 Folien
OWASP_Top_Ten_Proactive_Controls_v2.pptx von
OWASP_Top_Ten_Proactive_Controls_v2.pptxOWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxFernandoVizer
8 views53 Folien
Managing your secrets in a cloud environment von
Managing your secrets in a cloud environmentManaging your secrets in a cloud environment
Managing your secrets in a cloud environmentTaswar Bhatti
2.1K views62 Folien

Similar a Vault - Secret and Key Management(20)

Adding Identity Management and Access Control to your App von FIWARE
Adding Identity Management and Access Control to your AppAdding Identity Management and Access Control to your App
Adding Identity Management and Access Control to your App
FIWARE892 views
Hashicorp Chicago HUG - Secure and Automated Workflows in Azure with Vault an... von Stenio Ferreira
Hashicorp Chicago HUG - Secure and Automated Workflows in Azure with Vault an...Hashicorp Chicago HUG - Secure and Automated Workflows in Azure with Vault an...
Hashicorp Chicago HUG - Secure and Automated Workflows in Azure with Vault an...
Stenio Ferreira236 views
OWASP_Top_Ten_Proactive_Controls_v2.pptx von FernandoVizer
OWASP_Top_Ten_Proactive_Controls_v2.pptxOWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptx
FernandoVizer8 views
Managing your secrets in a cloud environment von Taswar Bhatti
Managing your secrets in a cloud environmentManaging your secrets in a cloud environment
Managing your secrets in a cloud environment
Taswar Bhatti2.1K views
Apache CloudStack Integration with HashiCorp Vault von CloudOps2005
Apache CloudStack Integration with HashiCorp VaultApache CloudStack Integration with HashiCorp Vault
Apache CloudStack Integration with HashiCorp Vault
CloudOps2005148 views
FIWARE Wednesday Webinars - How to Secure IoT Devices von FIWARE
FIWARE Wednesday Webinars - How to Secure IoT DevicesFIWARE Wednesday Webinars - How to Secure IoT Devices
FIWARE Wednesday Webinars - How to Secure IoT Devices
FIWARE785 views
Azure Low Lands 2019 - Building secure cloud applications with Azure Key Vault von Tom Kerkhove
Azure Low Lands 2019 - Building secure cloud applications with Azure Key VaultAzure Low Lands 2019 - Building secure cloud applications with Azure Key Vault
Azure Low Lands 2019 - Building secure cloud applications with Azure Key Vault
Tom Kerkhove1.6K views
REST API Security: OAuth 2.0, JWTs, and More! von Stormpath
REST API Security: OAuth 2.0, JWTs, and More!REST API Security: OAuth 2.0, JWTs, and More!
REST API Security: OAuth 2.0, JWTs, and More!
Stormpath7.8K views
[Wroclaw #9] The purge - dealing with secrets in Opera Software von OWASP
[Wroclaw #9] The purge - dealing with secrets in Opera Software[Wroclaw #9] The purge - dealing with secrets in Opera Software
[Wroclaw #9] The purge - dealing with secrets in Opera Software
OWASP745 views
Are You Properly Using JWTs? von 42Crunch
Are You Properly Using JWTs?Are You Properly Using JWTs?
Are You Properly Using JWTs?
42Crunch178 views
FIWARE Global Summit - Adding Identity Management, Access Control and API Man... von FIWARE
FIWARE Global Summit - Adding Identity Management, Access Control and API Man...FIWARE Global Summit - Adding Identity Management, Access Control and API Man...
FIWARE Global Summit - Adding Identity Management, Access Control and API Man...
FIWARE290 views
OAuth 2.0 – A standard is coming of age by Uwe Friedrichsen von Codemotion
OAuth 2.0 – A standard is coming of age by Uwe FriedrichsenOAuth 2.0 – A standard is coming of age by Uwe Friedrichsen
OAuth 2.0 – A standard is coming of age by Uwe Friedrichsen
Codemotion1.2K views
JWT Authentication with AngularJS von robertjd
JWT Authentication with AngularJSJWT Authentication with AngularJS
JWT Authentication with AngularJS
robertjd8.3K views
Azure Key Vault with a PaaS Architecture and ARM Template Deployment von Roy Kim
Azure Key Vault with a PaaS Architecture and ARM Template DeploymentAzure Key Vault with a PaaS Architecture and ARM Template Deployment
Azure Key Vault with a PaaS Architecture and ARM Template Deployment
Roy Kim429 views
Securing MongoDB to Serve an AWS-Based, Multi-Tenant, Security-Fanatic SaaS A... von MongoDB
Securing MongoDB to Serve an AWS-Based, Multi-Tenant, Security-Fanatic SaaS A...Securing MongoDB to Serve an AWS-Based, Multi-Tenant, Security-Fanatic SaaS A...
Securing MongoDB to Serve an AWS-Based, Multi-Tenant, Security-Fanatic SaaS A...
MongoDB27K views
12 Ways Not to get 'Hacked' your Kubernetes Cluster von Suman Chakraborty
12 Ways Not to get 'Hacked' your Kubernetes Cluster12 Ways Not to get 'Hacked' your Kubernetes Cluster
12 Ways Not to get 'Hacked' your Kubernetes Cluster

Último

Airline Booking Software von
Airline Booking SoftwareAirline Booking Software
Airline Booking SoftwareSharmiMehta
6 views26 Folien
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra... von
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra....NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra...
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra...Marc Müller
40 views62 Folien
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P... von
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...NimaTorabi2
12 views17 Folien
Short_Story_PPT.pdf von
Short_Story_PPT.pdfShort_Story_PPT.pdf
Short_Story_PPT.pdfutkarshsatishkumarsh
5 views16 Folien
ShortStory_qlora.pptx von
ShortStory_qlora.pptxShortStory_qlora.pptx
ShortStory_qlora.pptxpranathikrishna22
5 views10 Folien
The Era of Large Language Models.pptx von
The Era of Large Language Models.pptxThe Era of Large Language Models.pptx
The Era of Large Language Models.pptxAbdulVahedShaik
6 views9 Folien

Último(20)

Airline Booking Software von SharmiMehta
Airline Booking SoftwareAirline Booking Software
Airline Booking Software
SharmiMehta6 views
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra... von Marc Müller
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra....NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra...
.NET Developer Conference 2023 - .NET Microservices mit Dapr – zu viel Abstra...
Marc Müller40 views
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P... von NimaTorabi2
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
NimaTorabi212 views
Fleet Management Software in India von Fleetable
Fleet Management Software in India Fleet Management Software in India
Fleet Management Software in India
Fleetable11 views
JioEngage_Presentation.pptx von admin125455
JioEngage_Presentation.pptxJioEngage_Presentation.pptx
JioEngage_Presentation.pptx
admin1254556 views
360 graden fabriek von info33492
360 graden fabriek360 graden fabriek
360 graden fabriek
info33492122 views
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports von Ra'Fat Al-Msie'deen
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug ReportsBushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ... von Donato Onofri
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...
Donato Onofri860 views
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with... von sparkfabrik
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...
sparkfabrik7 views
FIMA 2023 Neo4j & FS - Entity Resolution.pptx von Neo4j
FIMA 2023 Neo4j & FS - Entity Resolution.pptxFIMA 2023 Neo4j & FS - Entity Resolution.pptx
FIMA 2023 Neo4j & FS - Entity Resolution.pptx
Neo4j8 views

Vault - Secret and Key Management

  • 2. What this Brown Bag is about Quick intro to HashiCorp Vault Storing secrets/config with Vault Integrating systems using Vault
  • 3. What this Brown Bag is NOT about Consul Discovery Using Vault as an oAuth service
  • 4. Ever had this happen to you? **** WARNING AWS SECRET FOUND IN REPO **** **** WARNING CREDENTIALS FOUND! **** config: aws_access_key_id: AHSSKK21342KJ234LJH aws_secret_access_key_id: XXXXXXXXXXXXXXX config: jdbc.username: quickadminuser jdbc.password: G3tM30u70fH3r3!
  • 5. Storing credentials in a public repo is risky! Tip Never push credentials to GitHub. GitHub uses bots to scan files on public repos to discover keys and secrets!
  • 6. Vault by Hashicorp Vault secures, stores, and tightly controls access to tokens, passwords, certificates, API keys, and other secrets in modern computing. Vault handles leasing, key revocation, key rolling, and auditing. Through a unified API, users can access an encrypted Key/Value store and network encryption-as-a- service, or generate AWS IAM/STS credentials, SQL/NoSQL databases, X.509 certificates, SSH credentials, and more.
  • 7. How many times do you change your password? Tip No one is expected to change their password every day. Though it is a good idea to change your password regularly.
  • 8. Agenda Overview of Vault Vault Architecture Vault Data Storage Options Vault Authentication Options Policies Using Vault Demo
  • 9. Vault by Hashicorp ● Secret storage ● Key & Password Rotation ● Audit Logs ● Object Storage
  • 11. Vault Architecture Access Vault with: command line tool HTTP APIs $ vault read secret/patient-svc $ curl -X GET -H “X-Vault-Token: $VAULT_TOKEN” “http://vault:8200/v1/secret/patient-svc”
  • 12. 12 Factor App Software as a Service Declarative Format Minimize Divergence Scale up without changes https://12factor.net Tip 12 Factor App helps separate the application from the environment removing the distinction of the environment and the application.
  • 13. Vault Storage Options Consul (HA) etcd (HA) ZooKeeper (HA) DynamoDB (HA) S3 Google Cloud Storage Azure Swift MySQL PostgreSQL InMem File
  • 15. Vault Authentication App Id AppRole AWS EC2 GitHub LDAP ● MFA ● TLS Certificates ● Tokens ● Username & Password
  • 16. AppRole Authentication Requires a role_id (UUID) and secret (UUID) Secret is volatile lasts for a preconfigured time and number of uses Application requests a client token using role_id & secret_id Client token is used to access vault
  • 18. Vault Policies Control who has access to which parts of Vault Capabilities include: Create Read Update List Sudo
  • 20. Create a new consumer (Token) $ vault policy-write patient-policy @patient-policy.json $ vault token-create -policy=’patient-policy’ Key Value --- ----- token a7c4e3c1-f9b3-71c0-514c-67c469b9bd3f token_accessor 40d7fcf6-8ff1-c6c4-632f-9916935ba9a3 token_duration 768h0m0s token_renewable true token_policies [patient-policy default]
  • 21. Create a new consumer (AppRole) $ vault write auth/approle/role/cloud-auth-role secret_id_ttl=10m token_ttl=20m token_max_ttl=30m secret_id_num_uses=40 policies=patient- policy $ vault read auth/approle/role/cloud-auth-role/role_id Key Value --- ----- role_id d4494db4-4047-90fb-30ec-18a5fa79cc19
  • 22. Create a new consumer (AppRole) $ vault write -f auth/approle/role/cloud-auth-role/secret-id Key Value --- ----- secret_id e01b6593-03c4-6023-cec2-24c8f3c0f2d7 secret_id_accessor cde853e3-f264-816f-479e-a63a15097630
  • 23. Create a new consumer (AppRole) $ vault write auth/approle/login role_id=d4494db4-4047-90fb-30ec-18a5fa79cc19 secret_id=e01b6593-03c4-6023-cec2-24c8f3c0f2d7 Key Value --- ----- token 50a69d9b-f5ad-21d8-386d-f6fbbbef404d token_accessor 6a72e1af-15ae-b896-211d-4f218214db20 token_duration 20m0s token_renewable true token_policies [default patient-policy]
  • 24. Storing data to Vault $ vault write secret/application app_name=”My Application” Success! Data written to secret/application $ vault read secret/application Key Value --- ----- refresh_interval 768h0m0s name My Application
  • 25. Storing data to Vault $ vault write secret/application @data.json Success! Data written to secret/application $ vault read secret/application Key Value --- ----- refresh_interval 768h0m0s name My Application conn_url tcp(192.168.99.100:3306) data.json { “name” : “My Application”, “conn_url” : “tcp(192.168.99.100:3306)” }
  • 26. Setting up MySQL Mount $ vault mount mysql $vault write mysql/config/connection connection_url=”user:password@tcp(database:port)/” $ vault write mysql/roles/patient-svc sql = “CREATE USER ‘{{name}}’@’%’ IDENTIFIED BY ‘{{password}}’; GRANT ALL ON patient_db.* TO ‘{{name}}’@’%’;”
  • 27. Configure your application spring.cloud.vault.mysql: enabled: true role: patient-svc backend: mysql
  • 29. Demo Basic Spring JDBC integration Request JDBC Username/Password Return database metadata (database name & version) Request config data from Vault Display value JPA Integration Persist data to MySQL using:
  • 31. Spring Cloud Vault http://cloud.spring.io/spring-cloud-vault-config/ Currently at 1.0.0.M1 Add-on to the Spring Cloud Suite Supports configuration and optional database config

Hinweis der Redaktion

  1. Only the storage backend and the HTTP API are outside, all other components are inside the barrier. The storage backend is untrusted and is used to durably store encrypted data. When the Vault server is started, it must be provided with a storage backend so that data is available across restarts. The HTTP API similarly must be started by the Vault server on start so that clients can interact with it. Once started, the Vault is in a sealed state
  2. https://www.vaultproject.io/docs/config/index.html#backend swift - Store data within an OpenStack Swift container Swift. This backend does not support HA. This is a community-supported backend.
  3. The AWS secret backend for Vault generates AWS access credentials dynamically based on IAM policies. This makes IAM much easier to use: credentials could be generated on the fly, and are automatically revoked when the Vault lease is expired. The cubbyhole secret backend is used to store arbitrary secrets within the configured physical storage for Vault. It is mounted at the cubbyhole/ prefix by default and cannot be mounted elsewhere or removed. The PKI secret backend for Vault generates X.509 certificates dynamically based on configured roles. This means services can get certificates needed for both client and server authentication without going through the usual manual process of generating a private key and CSR, submitting to a CA, and waiting for a verification and signing process to complete. Vault's built-in authentication and authorization mechanisms provide the verification functionality.
  4. You can now use this token to access vault
  5. You can now use this token to access vault
  6. You can now use this token to access vault
  7. Provided the JSON is well formed, the data is loaded into the vault
  8. Instructs vault how to connect to the database Instructs vault how to create a user on a particular database
  9. Instructs vault how to connect to the database Instructs vault how to create a user on a particular database ‘backend’ specifies the mount path to the mysql you wish to use (customisable)