DevSecOps SG Meetup -
Jun 29
Managing Secrets
Using HashiCorp Vault
DevSecOps SG Meetup - Jun 29
It’s been a while!
Hi mate!
Great Ocean Road, Victoria, Australia
Lake Bellfield - Grampians National Park, Victoria,
Australia
Sunrise at Boroka Lookout, Grampians National Park, Victoria, Australia
Sunset at Reed Lookout, Grampians National Park, Victoria, Australia
TimeLapse Drive - Khao Yai National Park, Thailand
Haew Suwat Waterfall - Khao Yai National Park, Thailand
https://about.me/fabian.lim
https://tech.gov.sg
@GovTechSG
@3jmaster
GovTech Pride Products
BeeLineCrowd-sourced Bus Services
MyRespond
erCrowd-source Responders for First Aid
Data.gov.sg
Providing Public Data for Open-Source Projects
Featured on RedHat Summ
Featured on AWS
Summit 2016
Interested to
make an
impact?
Join me @ GovTech
https://tech.gov.sg
¯_( ツ )_/¯
Why are we here, again?
¯_( ツ )_/¯ ¯_( ツ )_/¯
¯_( ツ )_/¯
¯_( ツ )_/¯ ¯_( ツ )_/¯
¯_( ツ )_/¯
RIGHT!
Remembe
r our
Github workshop
?
I think developers are
storing secrets in source
code.
To avoid repeating the
Uber Blunder
I aim to remove secrets
from source code
repositories.
Password
Hunting
https://fabianlim1989.github.io/devsecops-git-workshop/#/password-hunting
But WHY would developers
store secrets in code
repositories?
Identifying the root cause is plain simple,
yet implementing the solution is an uphill battle.
¯_( ツ )_/¯ ¯_( ツ )_/¯
¯_( ツ )_/¯
Note: Today is PART 1,
we will be back with more...
¯_( ツ )_/¯ ¯_( ツ )_/¯
¯_( ツ )_/¯
A Developer’s Workflow
Gather Feature Requirements
Code
Test New Code with Integration
Check In Code
Drink Beer to Celebrate
Code
Tokens required to interact with other APIs
Usernames and Passwords
Keys and Values
A Developer’s Workflow
A Developer’s Dilemma
{
"username": "$USERNAME",
"password": "$PASSWORD"
}
/server.conf
{
"username": "admin",
"password": "admin01"
}
/server.conf
A Developer’s Dilemma
{
"APItoken": "$APItoken"
}
/server.conf
{
"APItoken": "18be90ef56"
}
/server.conf
BUT
HOW???
Discussion Time
How would YOU do it?
Google, duh. http://lmgtfy.com/?q=secret+management+tools
What options does one have?
Secret Management Tools
Secret Management Tools
[HashiCorp | Ansible | Chef] Vault
CyberArk - Conjur
Knox
Thycotic
KeyWhiz
AWS KMS
HSM
Etc...
Comparison
http://lmgtfy.com/?q=hashicorp+vault+comparison
Yeah, market research is hard...
HashiCorp
FEED
ME
NOW!
Feeding an alpacas at Primo Piazza, Khao Yai, Thailand
https://www.vaultproject.io/#/demo/0
Other Useful Stuffs
Akin to a Swiss Army knife, its
abundant features are useful in
all kinds of situations.
Manage almost ANY secret
Certificate Authority
SSH Key Management
...
High Availability Cluster
Everything is an API call away
Open-Source! Sort of...
# SETUP and Test hello world
# export VAULT_ADDR=http://54.255.140.240
# export VAULT_TOKEN=508f84ac-a239-833e-8029-6b26e7a1d834
# curl -X GET -H "X-Vault-Token:$VAULT_TOKEN" $VAULT_ADDR/v1/secret/hello
{"request_id":"98039c27-213c-d901-98c3-
ce4803126ca3","lease_id":"","renewable":false,"lease_duration":2764800,"data":
{"value":"world"},"wrap_info":null,"warnings":null,"auth":null}
On Local Terminal [https://www.vaultproject.io/api/index.html]
# WRITE SECRET
# curl -H "X-Vault-Token: $VAULT_TOKEN" -H "Content-Type: application/json" -X
POST -d '{"value":"my name is $USER"}' $VAULT_ADDR/v1/secret/$USER
On Local Terminal [https://www.vaultproject.io/api/index.html]
# GET WRAP RESPONSE
# curl -X GET -H "X-Vault-Token:$VAULT_TOKEN" -H "X-Vault-Wrap-TTL:10m"
$VAULT_ADDR/v1/secret/hello
{"request_id":"","lease_id":"","renewable":false,"lease_duration":0,"data":nul
l,"wrap_info":{"token":"c2b0d030-fcc8-8942-e659-
bd978454a9e3","ttl":600,"creation_time":"2017-06-
29T09:27:12.289819346Z"},"warnings":null,"auth":null}
On Local Terminal [https://www.vaultproject.io/api/index.html]
# UNWRAP RESPONSE
# curl -X POST -H "X-Vault-Token:$WRAPPED_TOKEN" -H "Content-
Type:application/json" $VAULT_ADDR/v1/sys/wrapping/unwrap
{"request_id":"b36d6da3-ed0a-63ab-b731-
16789815e2c6","lease_id":"","renewable":false,"lease_duration":2764800,"data":
{"vaule":"world"},"wrap_info":null,"warnings":null,"auth":null}
On Local Terminal [https://www.vaultproject.io/api/index.html]
The Bigger Picture -
WHERE is the problem?
Build
Start -
CODE
IN
Build
Complete -
PRODUCT
OUT
Architecting Trust in CICD Pipeline
Server /
App
Continues
To
Require
Secrets
From
Architecting Trust is not the focus for today, in
Server / App
Continues
To
Require
Secrets
From
How does Vault
trust the app?
As an
ephemeral
docker container
/ VM / server?
Thanks & Stay Tuned for PART

Secret Mgmt using vault DevSecOps sg Meetup

Editor's Notes

  • #13 You should have spent only 10 minutes.
  • #15 Time, 8 minutes. Right, enough advertising for Govtech and myself
  • #19 Right, enough advertising for Govtech and myself
  • #21 Let’s put things into context
  • #23 My goal is really simple. I just want to replace these hard coded secret strings into variables
  • #25 Any one spent their nights thinking about this problem? I did. I was frustrated with the number of secrets I find EVERYWHERE. I want to make a change. So I started trying out different tools.
  • #27 Timer should be at 20 minutes. End discussion at 25 minutes.
  • #28 Introducing several secret management tools
  • #30 Due to limited time, I cannot compare all of it with you today. I listed the top few. This evaluation is best done by the user to evaluate the use cases in order to gain the maximum benefit from limited resources.
  • #33 Spend about 15 to 20 minutes here. Timer should be at 50 minutes after
  • #36 https://www.vaultproject.io/intro/getting-started/apis.html
  • #37 https://www.vaultproject.io/intro/getting-started/apis.html
  • #38 https://www.vaultproject.io/intro/getting-started/apis.html
  • #42 To go a little bit into the details and almost teasing, this is the problem. So we establish that we want to make everything into a variable, great, now what? Make an API call to replace all the variables into actual secrets using Vault, great. Then where do we store that API token to make the API calls to Vault? And if that’s not crazy enough, we want everything automated, secrets rotated, and our apps run in Docker containers so they die and revive multiple times a day.
  • #43 We run into what we call, the “Secret 0 problem” where we need to seed the initial secret using a tool and some semi-automated process that involves a human’s approval. Food for thought.