SlideShare a Scribd company logo
Hiding secrets in Vault
STJEPAN HADJIĆ
RAILS TEAM LEAD
20 person backend team
Rails, Elixir, Go and DevOps
01THE TWELVE-FACTOR APP
Heroku
12 points - how to build your
web app
Chapter III:
strict separation of config from code
Multiple environments
Make it open source
External services
Ryan Hellyer
TruffleHog
Hiding secrets in Vault
Carlo van Wyk
Creating private repositories with Visual Studio
2015
Private public repository
Hiding secrets in Vault
Keep them hidden! Keep them safe!
02FIRST STEPS
STOP hardcoding your secrets
STOP committing secrets to
SCM
Extra: use git-secrets
Hiding secrets in Vault
Hiding secrets in Vault
Hiding secrets in Vault
Hiding secrets in Vault
Hiding secrets in Vault
Hiding secrets in Vault
Hiding secrets in Vault
Hiding secrets in Vault
Hiding secrets in Vault
Hiding secrets in Vault
Hiding secrets in Vault
Hiding secrets in Vault
Hiding secrets in Vault
03OPTIONS
Dropbox/S3/docs/VPS
Puppet/Chef/similar
Amazon Key Management
Service (KMS)
Confidant?
Keywhiz
Vault
HashiCorp
Vagrant
Consul
04VAULT
Secure Secret Storage
$ vault init
Key 1: 427cd2c310be3b84fe69372e683a790e01
Key 2: 0e2b8f3555b42a232f7ace6fe0e68eaf02
Key 3: 37837e5559b322d0585a6e411614695403
Key 4: 8dd72fd7d1af254de5f82d1270fd87ab04
Key 5: b47fdeb7dda82dbe92d88d3c860f605005
Initial Root Token: eaf5cc32-b48f-7785-5c94-90b5ce300e9b
Vault initialized with 5 keys and a key threshold of 3!
Secret Backends
Auth Backends
APPID
APPROLE
LDAP
USERNAME & PASSWORD
MFA
Audit Backends
FILE
SYSLOG
SOCKET
Dynamic Secrets
Data Encryption
Leasing and Renewal
Revocation
Pro and Enterprise editions
05THE SETUP
Vault CLI
backend "consul" {
address = "127.0.0.1:8500"
path = "vault"
}
listener "tcp" {
address = "127.0.0.1:8200"
}
Configuration
$ vault server -config=example.hcl
==> Vault server configuration:
Log Level: info
Backend: consul
Listener 1: tcp (addr: "127.0.0.1:8200")
==> Vault server started! Log data will stream in below:
Starting the server
$ vault init
Key 1: 427cd2c310be3b84fe69372e683a790e01
Key 2: 0e2b8f3555b42a232f7ace6fe0e68eaf02
Key 3: 37837e5559b322d0585a6e411614695403
Key 4: 8dd72fd7d1af254de5f82d1270fd87ab04
Key 5: b47fdeb7dda82dbe92d88d3c860f605005
Initial Root Token: eaf5cc32-b48f-7785-5c94-90b5ce300e9b
Vault initialized with 5 keys and a key threshold of 3!
...
Initialising Vault
$ vault unseal
Key (will be hidden):
Sealed: true
Key Shares: 5
Key Threshold: 3
Unseal Progress: 1
Unsealing
$ vault auth-enable github
Successfully enabled 'github' at ‘github'!
$ vault write auth/github/config organization=awesomecorp
Success! Data written to: auth/github/config
Authentication
# policy.hcl
path “path/to/secret” {
policy = "write"
}
$ vault policy-write dev-policy policy.hcl
Authorization
$ vault write auth/github/map/teams/dev-team value=dev-policy
Success! Data written to: auth/github/map/teams/dev-team
Mapping policies
$ vault auth -method=github token=000000905b381e723b3d6a
Successfully authenticated! You are now logged in.
The token below is already saved in the session. You do
not
need to "vault auth" again with the token.
token: 0d9ab511-bc25-4fb6-a58b-94ce12b8da9c
token_duration: 2764800
token_policies: [default dev-policy]
Authentication
$ vault write path/to/secret foo=bar
$ vault read path/to/secret
Writing and reading to Vault
$ vault write path/to/secret foo=bar
$ vault read path/to/secret
Writing and reading to Vault
$ vault write path/to/secret foo=bar
$ vault read path/to/secret
Writing and reading to Vault
$ vault write path/to/secret foo=bar
$ vault read path/to/secret
Writing and reading to Vault
Hiding secrets in Vault
Hiding secrets in Vault
Hiding secrets in Vault
Hiding secrets in Vault
Hiding secrets in Vault
Hiding secrets in Vault
Hiding secrets in Vault
Hiding secrets in Vault
Hiding secrets in Vault
Hiding secrets in Vault
Hiding secrets in Vault
Hiding secrets in Vault
Hiding secrets in Vault
06REAL WORLD USAGE
$ vault write path/to/secret foo=bar
$ vault read path/to/secret
Naming convention
#{technology}/#{git_repo_name}/#{environment}
Naming convention
rails/#{git_repo_name}/#{environment}
Naming convention
rails/awesome-app/#{environment}
Naming convention
rails/awesome-app/production
github.com/infinum/secrets_cli
$ secrets init
# file where your secrets are kept depending on your
environment gem
:secrets_file: config/application.yml
# vault path where your secrets will be kept
:secrets_storage_key: rails/awesome-app/
$ secrets push
Are you sure you want to write config/application.yml to rails/awesome-app/dev Yes
There are some differences between config/application.yml and vault:
@@ -18,8 +18,8 @@
development:
- # database_database: awesome_app_development
- database_database: awesome_app_dev
+ database_database: awesome_app_development
+ # database_database: awesome_app_dev
test:
database_database: awesome_app_test
Are you sure you want to override rails/awesome-app/dev? Yes
$ secrets pull
secret_key_base: 766c50c121afcf5dcfb78487e97
devise_secret_key: 73056c18285b9251987a10d9aabfcfc
database_host: localhost
database_username: postgres
database_password:
amazon_access_key_id: ****
amazon_secret_access_key: ****
amazon_region: eu-central-1
bugsnag_api_key: ae81c7effa
braintree_env: sandbox
braintree_merchant_id: bfpb5vm
braintree_public_key: 44n9nh9t
braintree_private_key: b4e458a
braintree_plan_id: 1234
Visit infinum.co or find us on social networks:
infinum.co infinumco infinumco infinum
Any questions?
STJEPAN.HADJIC@INFINUM.CO
@_BEAST_

More Related Content

PPTX
Vault - Secret and Key Management
PDF
HashiCorp Vault Plugin Infrastructure
PDF
HashiCorp's Vault - The Examples
PDF
Chickens & Eggs: Managing secrets in AWS with Hashicorp Vault
PDF
HashiCorp Vault Workshop:幫 Credentials 找個窩
PPTX
Hashicorp Vault ppt
PDF
Issuing temporary credentials for my sql using hashicorp vault
PDF
Dynamic Database Credentials: Security Contingency Planning
Vault - Secret and Key Management
HashiCorp Vault Plugin Infrastructure
HashiCorp's Vault - The Examples
Chickens & Eggs: Managing secrets in AWS with Hashicorp Vault
HashiCorp Vault Workshop:幫 Credentials 找個窩
Hashicorp Vault ppt
Issuing temporary credentials for my sql using hashicorp vault
Dynamic Database Credentials: Security Contingency Planning

What's hot (20)

PDF
Exploring, understanding and monitoring macOS activity with osquery
PDF
Breach > ATT&CK > Osquery: Cross-platform Endpoint Monitoring with Osquery
PDF
Pycon - Python for ethical hackers
PDF
HTTP For the Good or the Bad
PPTX
Malware Detection with OSSEC HIDS - OSSECCON 2014
PDF
How to Use HashiCorp Vault with Hiera 5 for Secret Management With Puppet
PPTX
Architecting Secure and Compliant Applications with MongoDB
PDF
Nessus and Reporting Karma
PDF
Building A Poor man’s Fir3Ey3 Mail Scanner
PPTX
BlueHat v17 || Detecting Compromise on Windows Endpoints with Osquery
PDF
Testing NodeJS Security
PPTX
Openssl
PPTX
Webinar: Securing your data - Mitigating the risks with MongoDB
PDF
CQURE_BHAsia19_Paula_Januszkiewicz_slides
PDF
Static Typing in Vault
PPTX
Security in NodeJS applications
PDF
MuleSoft ESB Payload Encrypt Decrypt using anypoint enterprise security
ODP
Remove php calls and scale your site like crazy !
PDF
rsa_usa_2019_paula_januszkiewicz
Exploring, understanding and monitoring macOS activity with osquery
Breach > ATT&CK > Osquery: Cross-platform Endpoint Monitoring with Osquery
Pycon - Python for ethical hackers
HTTP For the Good or the Bad
Malware Detection with OSSEC HIDS - OSSECCON 2014
How to Use HashiCorp Vault with Hiera 5 for Secret Management With Puppet
Architecting Secure and Compliant Applications with MongoDB
Nessus and Reporting Karma
Building A Poor man’s Fir3Ey3 Mail Scanner
BlueHat v17 || Detecting Compromise on Windows Endpoints with Osquery
Testing NodeJS Security
Openssl
Webinar: Securing your data - Mitigating the risks with MongoDB
CQURE_BHAsia19_Paula_Januszkiewicz_slides
Static Typing in Vault
Security in NodeJS applications
MuleSoft ESB Payload Encrypt Decrypt using anypoint enterprise security
Remove php calls and scale your site like crazy !
rsa_usa_2019_paula_januszkiewicz
Ad

Viewers also liked (6)

PDF
Advanced SQL functions explained
PPTX
dome and vault
PDF
VAULT CONSTRUCTION
PDF
SlideShare 101
PDF
How to Make Awesome SlideShares: Tips & Tricks
PDF
Getting Started With SlideShare
Advanced SQL functions explained
dome and vault
VAULT CONSTRUCTION
SlideShare 101
How to Make Awesome SlideShares: Tips & Tricks
Getting Started With SlideShare
Ad

Similar to Hiding secrets in Vault (20)

PDF
Introducing Vault
PDF
[Wroclaw #9] The purge - dealing with secrets in Opera Software
PDF
Keybase Vault Auto-Unseal HashiTalks2020
PDF
Using Vault to decouple MySQL Secrets
PDF
Docker Registry + Basic Auth
PPTX
Docker Security workshop slides
PDF
Null bhopal Sep 2016: What it Takes to Secure a Web Application
PDF
PHP SA 2014 - Releasing Your Open Source Project
PPTX
drupal ci cd concept cornel univercity.pptx
PDF
Pentesting an unfriendly environment: bypassing (un)common defences and mate ...
PDF
Год в Github bugbounty, опыт участия
PDF
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
PDF
Kubernetes Story - Day 3: Deploying and Scaling Applications on OpenShift
PDF
Kubernetes Summit 2019 - Harden Your Kubernetes Cluster
PPTX
Python from zero to hero (Twitter Explorer)
PDF
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
PDF
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
PDF
Manage WordPress with Awesome using wp cli
ODP
Caching and tuning fun for high scalability
ODP
Itb session v_memcached
Introducing Vault
[Wroclaw #9] The purge - dealing with secrets in Opera Software
Keybase Vault Auto-Unseal HashiTalks2020
Using Vault to decouple MySQL Secrets
Docker Registry + Basic Auth
Docker Security workshop slides
Null bhopal Sep 2016: What it Takes to Secure a Web Application
PHP SA 2014 - Releasing Your Open Source Project
drupal ci cd concept cornel univercity.pptx
Pentesting an unfriendly environment: bypassing (un)common defences and mate ...
Год в Github bugbounty, опыт участия
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
Kubernetes Story - Day 3: Deploying and Scaling Applications on OpenShift
Kubernetes Summit 2019 - Harden Your Kubernetes Cluster
Python from zero to hero (Twitter Explorer)
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...
Manage WordPress with Awesome using wp cli
Caching and tuning fun for high scalability
Itb session v_memcached

Recently uploaded (20)

PDF
The Internet -By the Numbers, Sri Lanka Edition
PDF
Paper PDF World Game (s) Great Redesign.pdf
PDF
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PPTX
CSharp_Syntax_Basics.pptxxxxxxxxxxxxxxxxxxxxxxxxxxxx
PPTX
QR Codes Qr codecodecodecodecocodedecodecode
PPTX
Digital Literacy And Online Safety on internet
PDF
An introduction to the IFRS (ISSB) Stndards.pdf
PPTX
durere- in cancer tu ttresjjnklj gfrrjnrs mhugyfrd
PDF
Cloud-Scale Log Monitoring _ Datadog.pdf
PDF
Unit-1 introduction to cyber security discuss about how to secure a system
PPTX
Introuction about ICD -10 and ICD-11 PPT.pptx
PDF
LABUAN4D EXCLUSIVE SERVER STAR GAMING ASIA NO.1
PDF
“Google Algorithm Updates in 2025 Guide”
PPT
tcp ip networks nd ip layering assotred slides
PPTX
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
PPTX
artificial intelligence overview of it and more
PPTX
innovation process that make everything different.pptx
PPTX
INTERNET------BASICS-------UPDATED PPT PRESENTATION
PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
The Internet -By the Numbers, Sri Lanka Edition
Paper PDF World Game (s) Great Redesign.pdf
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
CSharp_Syntax_Basics.pptxxxxxxxxxxxxxxxxxxxxxxxxxxxx
QR Codes Qr codecodecodecodecocodedecodecode
Digital Literacy And Online Safety on internet
An introduction to the IFRS (ISSB) Stndards.pdf
durere- in cancer tu ttresjjnklj gfrrjnrs mhugyfrd
Cloud-Scale Log Monitoring _ Datadog.pdf
Unit-1 introduction to cyber security discuss about how to secure a system
Introuction about ICD -10 and ICD-11 PPT.pptx
LABUAN4D EXCLUSIVE SERVER STAR GAMING ASIA NO.1
“Google Algorithm Updates in 2025 Guide”
tcp ip networks nd ip layering assotred slides
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
artificial intelligence overview of it and more
innovation process that make everything different.pptx
INTERNET------BASICS-------UPDATED PPT PRESENTATION
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION

Hiding secrets in Vault