SlideShare una empresa de Scribd logo
1 de 25
Descargar para leer sin conexión
Copyright © 2018
HashiCorp
May 23, 2018
How to Use HashiCorp
Vault with Hiera 5 for
Secret Management with
Puppet
“Technical Account Manager at HashiCorp
Peter Souter
Based in...
London, UK
Been using...
The HashiCorp stack and Puppet for about 7
years
Worn a lot of hats in my time...
Developer, Consultant, Pre-Sales, TAM
Interested in...
Making people’s operational life easier and
more secure
DEVOPS ALL THE THINGS
Introductions - Who are these People?
“
Introductions - Who are these People?
Principal Solutions Architect at Puppet
Andrew Brader
Based in...
Philadelphia, Pennsylvania
Been using...
Puppet for about 8 years
Also worn a lot of hats in his time...
Developer, Consultant, Solutions Architect
Interested in...
Making people’s operational life easier and
more secure
DEVOPS ALL THE THINGS
“
▪ You’re using Puppet to
manage systems
▪ You’re happy!
▪ Your infrastructure as
code is great!
▪ Everything is awesome!
Let's talk about the landscape
“
“Uhhh, the production passwords are in
plaintext in the Puppet code… and I accidentally
pushed it to a public Git repo...”
But there is a problem:
“▪ Puppet code needs to be treated like any code: secrets
need to be encrypted at rest
▪ You need to think about some things:
• How would you rotate your secrets?
• How would you know what was leaked?
• How do you onboard new team members?
• How do new secrets get introduced?
• How do you track what secrets have been changed?
Managing Secrets is Hard
“
Best Practises for Secrets in Puppet
Here’s something I made earlier! - https://www.youtube.com/watch?v=JwuXUxSCDGY
“▪Hiera-eyaml
▪Git-crypt
▪Mozilla’s SOPS
▪Transcrypt
▪Blackbox
Previous Secret Management Solutions
Different tools but the
same idea:
encrypted secrets in the git
repo with asymmetric
encryption (ie. public and
private keys)
“
These have a similar problems...
▪The rotation process is a little fiddly
▪Onboarding new team members is hard
▪Harder to keep track of who changed what
▪No easy way audit whats being used where
“
“If only there was a Secret management
application we could tap into to...”
There’s got to be a better way!?
“
Enter Vault!
“
Installing Vault with Puppet
class profile::vault_server {
class { '::vault':
manage_storage_dir => true,
storage => {
file => {
path => '/mnt/vault/data',
},
},
listener => {
tcp => {
address => '0.0.0.0:8200',
tls_disable => 1,
},
},
version => '0.10.1',
enable_ui => true,
}
}
▪ https://github.com/jsok/puppet-vault
“
▪ Hiera is just key/value lookup
▪ So, Hiera will plug into Vault with a little bit of Ruby glue
▪ https://github.com/davealden/hiera-vault
▪ This uses Hiera 5, so allows finer tuning and features
Plugging Hiera into Vault
“---
version: 5
hierarchy:
- name: "Hiera-vault lookup"
lookup_key: hiera_vault
options:
confine_to_keys:
- '^vault_.*'
- '^.*_password$'
- '^password.*'
address: https://vault:8200
token: 97402490-eeb0-6530-13f6-fc0525503f23
default_field: value
mounts:
generic:
- secret/puppet/%{::trusted.certname}/
An example Hiera backend configuration
“
confine_to_keys
▪ With automatic parameter lookup, it might be trying
to make a call to Vault for every parameter you
could set in your Puppet code
▪ This an increase to catalog compilation time, as it’s
an extra hop to check if it exists
▪ The backend has a key called “confine_to_keys”,
which allows you to set Vault lookup to certain
key-names
▪ For example, a regex that only allows lookup for
“password” or containing the string “vault”
▪
“▪ We can secure our lookup process even more by
creating a Hiera specific policy:
path "secret/puppet/*" {
capabilities = ["read", "list"]
}
▪ When we create a token using this policy, the Puppet
token will only be able to read values under the
Puppet namespace from Vault
Vault Policy for Hiera
“
How it looks architecturally
“$ puppet lookup <key> --explain
Environment Data Provider (hiera configuration version 5)
Using configuration "/etc/puppetlabs/code/environments/production/hiera.yaml"
Hierarchy entry "Hiera-vault lookup"
Found key: "vault_lookup_example" value: "FOOBAR"
[hiera-vault] Client configured to connect to https://vault:8200
[hiera-vault] Looking in path secret/puppet/puppet.home/vault_lookup_example
[hiera-vault] Read secret: vault_lookup_example
Explain can help debug Hiera lookups
“
This is a sandbox example, and is not hardened
to production standards!
Standard Demo Pre-Warning!
Copyright © 2018 HashiCorp
Demo
“▪ One of the easiest solutions to integrate Vault on an
existing Puppet estate
▪ Minimises connectivity requirements: Vault only needs to
be able to talk to the Puppetserver, not all agents
▪ Debugging can be done normally through Hiera processes
▪ However, you can’t do finer tuned control like one could
do with a cubbyhole system
There are advantages and disadvantages
“▪ Use Puppet to configure consul-env or
consul-template
Advantages
● Secrets never touch Puppet
● Puppet does not need to run on a regular
interval to catch changes
● Puppet does not need to interact with
Vault at all
Disadvantages
● Go's templating language is not fun
● Added indirection
● Wouldn’t work for non templated resources
(user management for example)
Alternative Solution: consul-env/template
▪ {{ with vault "postgresql/creds/readonly" }}
[config]
username = "{{ .Data.username }}"
password = "{{ .Data.password }}"
{{ end }}
“▪ Use a library in your application to talk to
Vault directly
▪ Vault-rails, Vault-spring
Advantages
● More performant
● More control over interactions with Vault
● Less responsibility on configuration
management
Disadvantages
● Requires applications to be Vault-aware
● Requires engineering effort
● Slower (for existing applications)
Alternative Solution: Direct Integration
▪ class Person < ActiveRecord::Base
include Vault::EncryptedModel
vault_attribute :ssn
end
class AddEncryptedSSNToPerson < ActiveRecord::Migration
add_column :persons, :ssn_encrypted, :string
end
person = Person.new
person.ssn = "123-45-6789"
person.save #=> true
person.ssn_encrypted #=> "vault:v0:EE3EV8P5hyo9h..."
Copyright © 2018 HashiCorp
Q&A
“● Using HashiCorp's Vault With Puppet - Seth Vargo, PuppetConf 2016
○ https://www.youtube.com/watch?v=PEdhD1hOpds
● Good Opsec Hygiene with Puppet - Peter Souter, PuppetConf 2016
○ https://www.youtube.com/watch?v=JwuXUxSCDGY
● Hiera 5 Vault Backend
○ https://github.com/davealden/hiera-vault
● Vault Puppet module
○ https://forge.puppet.com/jsok/vault
Would you like to know more?

Más contenido relacionado

La actualidad más candente

2020-02-20 - HashiTalks 2020 - HashiCorp Vault configuration as code via Hash...
2020-02-20 - HashiTalks 2020 - HashiCorp Vault configuration as code via Hash...2020-02-20 - HashiTalks 2020 - HashiCorp Vault configuration as code via Hash...
2020-02-20 - HashiTalks 2020 - HashiCorp Vault configuration as code via Hash...
Andrey Devyatkin
 

La actualidad más candente (20)

Chickens & Eggs: Managing secrets in AWS with Hashicorp Vault
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
 
Keybase Vault Auto-Unseal HashiTalks2020
Keybase Vault Auto-Unseal HashiTalks2020Keybase Vault Auto-Unseal HashiTalks2020
Keybase Vault Auto-Unseal HashiTalks2020
 
HashiTLS Demystifying Security Certs
HashiTLS Demystifying Security CertsHashiTLS Demystifying Security Certs
HashiTLS Demystifying Security Certs
 
Vault 101
Vault 101Vault 101
Vault 101
 
Managing secrets at scale
Managing secrets at scaleManaging secrets at scale
Managing secrets at scale
 
Vault - Secret and Key Management
Vault - Secret and Key ManagementVault - Secret and Key Management
Vault - Secret and Key Management
 
Hashicorp Vault ppt
Hashicorp Vault pptHashicorp Vault ppt
Hashicorp Vault ppt
 
Using Vault to decouple MySQL Secrets
Using Vault to decouple MySQL SecretsUsing Vault to decouple MySQL Secrets
Using Vault to decouple MySQL Secrets
 
HashiCorp's Vault - The Examples
HashiCorp's Vault - The ExamplesHashiCorp's Vault - The Examples
HashiCorp's Vault - The Examples
 
2020-02-20 - HashiTalks 2020 - HashiCorp Vault configuration as code via Hash...
2020-02-20 - HashiTalks 2020 - HashiCorp Vault configuration as code via Hash...2020-02-20 - HashiTalks 2020 - HashiCorp Vault configuration as code via Hash...
2020-02-20 - HashiTalks 2020 - HashiCorp Vault configuration as code via Hash...
 
HashiCorp Vault Plugin Infrastructure
HashiCorp Vault Plugin InfrastructureHashiCorp Vault Plugin Infrastructure
HashiCorp Vault Plugin Infrastructure
 
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
Neil Saunders (Beamly) - Securing your AWS Infrastructure with Hashicorp Vault
 
Issuing temporary credentials for my sql using hashicorp vault
Issuing temporary credentials for my sql using hashicorp vaultIssuing temporary credentials for my sql using hashicorp vault
Issuing temporary credentials for my sql using hashicorp vault
 
Dynamic Database Credentials: Security Contingency Planning
Dynamic Database Credentials: Security Contingency PlanningDynamic Database Credentials: Security Contingency Planning
Dynamic Database Credentials: Security Contingency Planning
 
Nodejsvault austin2019
Nodejsvault austin2019Nodejsvault austin2019
Nodejsvault austin2019
 
Introducing Vault
Introducing VaultIntroducing Vault
Introducing Vault
 
Red Team vs Blue Team on AWS - RSA 2018
Red Team vs Blue Team on AWS - RSA 2018Red Team vs Blue Team on AWS - RSA 2018
Red Team vs Blue Team on AWS - RSA 2018
 
Hiding secrets in Vault
Hiding secrets in VaultHiding secrets in Vault
Hiding secrets in Vault
 
ContainerDays Boston 2016: "Hiding in Plain Sight: Managing Secrets in a Cont...
ContainerDays Boston 2016: "Hiding in Plain Sight: Managing Secrets in a Cont...ContainerDays Boston 2016: "Hiding in Plain Sight: Managing Secrets in a Cont...
ContainerDays Boston 2016: "Hiding in Plain Sight: Managing Secrets in a Cont...
 
A tale of application development
A tale of application developmentA tale of application development
A tale of application development
 

Similar a How to Use HashiCorp Vault with Hiera 5 for Secret Management With Puppet

Puppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG editionPuppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG edition
Joshua Thijssen
 

Similar a How to Use HashiCorp Vault with Hiera 5 for Secret Management With Puppet (20)

From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...
 
Toplog candy elves - HOCM Talk
Toplog candy elves - HOCM TalkToplog candy elves - HOCM Talk
Toplog candy elves - HOCM Talk
 
Virtues of platform development
Virtues of platform developmentVirtues of platform development
Virtues of platform development
 
Puppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG editionPuppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG edition
 
Puppet for Sys Admins
Puppet for Sys AdminsPuppet for Sys Admins
Puppet for Sys Admins
 
Don't Mind the Gap by Galen Emery
Don't Mind the Gap by Galen EmeryDon't Mind the Gap by Galen Emery
Don't Mind the Gap by Galen Emery
 
Don't Mind the Gap by Galen Emery
Don't Mind the Gap by Galen EmeryDon't Mind the Gap by Galen Emery
Don't Mind the Gap by Galen Emery
 
DevOps for Drupal: Why We Cook With Chef
DevOps for Drupal: Why We Cook With ChefDevOps for Drupal: Why We Cook With Chef
DevOps for Drupal: Why We Cook With Chef
 
Php on the Web and Desktop
Php on the Web and DesktopPhp on the Web and Desktop
Php on the Web and Desktop
 
Panther: test your Symfony apps with real web browsers
Panther: test your Symfony apps with real web browsersPanther: test your Symfony apps with real web browsers
Panther: test your Symfony apps with real web browsers
 
Secret Management Journey - Here Be Dragons aka Secret Dragons
Secret Management Journey - Here Be Dragons aka Secret DragonsSecret Management Journey - Here Be Dragons aka Secret Dragons
Secret Management Journey - Here Be Dragons aka Secret Dragons
 
Puppet101
Puppet101Puppet101
Puppet101
 
Hadoop: Big Data Stacks validation w/ iTest How to tame the elephant?
Hadoop:  Big Data Stacks validation w/ iTest  How to tame the elephant?Hadoop:  Big Data Stacks validation w/ iTest  How to tame the elephant?
Hadoop: Big Data Stacks validation w/ iTest How to tame the elephant?
 
Puppetizing Your Organization
Puppetizing Your OrganizationPuppetizing Your Organization
Puppetizing Your Organization
 
Configuration Management with Puppet
Configuration Management with Puppet Configuration Management with Puppet
Configuration Management with Puppet
 
Twig: Friendly Curly Braces Invade Your Templates!
Twig: Friendly Curly Braces Invade Your Templates!Twig: Friendly Curly Braces Invade Your Templates!
Twig: Friendly Curly Braces Invade Your Templates!
 
Better Python Coding with Prefect Blocks
Better Python Coding with Prefect BlocksBetter Python Coding with Prefect Blocks
Better Python Coding with Prefect Blocks
 
XP Days 2019: First secret delivery for modern cloud-native applications
XP Days 2019: First secret delivery for modern cloud-native applicationsXP Days 2019: First secret delivery for modern cloud-native applications
XP Days 2019: First secret delivery for modern cloud-native applications
 
Django at Scale
Django at ScaleDjango at Scale
Django at Scale
 
Taking Spinnaker for a spin @ London DevOps Meetup 36
Taking Spinnaker for a spin @ London DevOps Meetup 36Taking Spinnaker for a spin @ London DevOps Meetup 36
Taking Spinnaker for a spin @ London DevOps Meetup 36
 

Más de Amanda MacLeod

Más de Amanda MacLeod (6)

Managing and Integrating Vault at The New York Times
Managing and Integrating Vault at The New York TimesManaging and Integrating Vault at The New York Times
Managing and Integrating Vault at The New York Times
 
Secure and Convenient Workflows: Integrating HashiCorp Vault with Pivotal Clo...
Secure and Convenient Workflows: Integrating HashiCorp Vault with Pivotal Clo...Secure and Convenient Workflows: Integrating HashiCorp Vault with Pivotal Clo...
Secure and Convenient Workflows: Integrating HashiCorp Vault with Pivotal Clo...
 
Secure and Convenient Workflows: Integrating HashiCorp Vault with Pivotal Clo...
Secure and Convenient Workflows: Integrating HashiCorp Vault with Pivotal Clo...Secure and Convenient Workflows: Integrating HashiCorp Vault with Pivotal Clo...
Secure and Convenient Workflows: Integrating HashiCorp Vault with Pivotal Clo...
 
Provision to Production with Terraform Enterprise
Provision to Production with Terraform EnterpriseProvision to Production with Terraform Enterprise
Provision to Production with Terraform Enterprise
 
Easy and Flexible Application Deployment with HashiCorp Nomad
Easy and Flexible Application Deployment with HashiCorp NomadEasy and Flexible Application Deployment with HashiCorp Nomad
Easy and Flexible Application Deployment with HashiCorp Nomad
 
Rein in Your Cloud Costs with Terraform and AWS Lambda
Rein in Your Cloud Costs with Terraform and AWS LambdaRein in Your Cloud Costs with Terraform and AWS Lambda
Rein in Your Cloud Costs with Terraform and AWS Lambda
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Último (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 

How to Use HashiCorp Vault with Hiera 5 for Secret Management With Puppet

  • 1. Copyright © 2018 HashiCorp May 23, 2018 How to Use HashiCorp Vault with Hiera 5 for Secret Management with Puppet
  • 2. “Technical Account Manager at HashiCorp Peter Souter Based in... London, UK Been using... The HashiCorp stack and Puppet for about 7 years Worn a lot of hats in my time... Developer, Consultant, Pre-Sales, TAM Interested in... Making people’s operational life easier and more secure DEVOPS ALL THE THINGS Introductions - Who are these People?
  • 3. “ Introductions - Who are these People? Principal Solutions Architect at Puppet Andrew Brader Based in... Philadelphia, Pennsylvania Been using... Puppet for about 8 years Also worn a lot of hats in his time... Developer, Consultant, Solutions Architect Interested in... Making people’s operational life easier and more secure DEVOPS ALL THE THINGS
  • 4. “ ▪ You’re using Puppet to manage systems ▪ You’re happy! ▪ Your infrastructure as code is great! ▪ Everything is awesome! Let's talk about the landscape
  • 5. “ “Uhhh, the production passwords are in plaintext in the Puppet code… and I accidentally pushed it to a public Git repo...” But there is a problem:
  • 6. “▪ Puppet code needs to be treated like any code: secrets need to be encrypted at rest ▪ You need to think about some things: • How would you rotate your secrets? • How would you know what was leaked? • How do you onboard new team members? • How do new secrets get introduced? • How do you track what secrets have been changed? Managing Secrets is Hard
  • 7. “ Best Practises for Secrets in Puppet Here’s something I made earlier! - https://www.youtube.com/watch?v=JwuXUxSCDGY
  • 8. “▪Hiera-eyaml ▪Git-crypt ▪Mozilla’s SOPS ▪Transcrypt ▪Blackbox Previous Secret Management Solutions Different tools but the same idea: encrypted secrets in the git repo with asymmetric encryption (ie. public and private keys)
  • 9. “ These have a similar problems... ▪The rotation process is a little fiddly ▪Onboarding new team members is hard ▪Harder to keep track of who changed what ▪No easy way audit whats being used where
  • 10. “ “If only there was a Secret management application we could tap into to...” There’s got to be a better way!?
  • 12. “ Installing Vault with Puppet class profile::vault_server { class { '::vault': manage_storage_dir => true, storage => { file => { path => '/mnt/vault/data', }, }, listener => { tcp => { address => '0.0.0.0:8200', tls_disable => 1, }, }, version => '0.10.1', enable_ui => true, } } ▪ https://github.com/jsok/puppet-vault
  • 13. “ ▪ Hiera is just key/value lookup ▪ So, Hiera will plug into Vault with a little bit of Ruby glue ▪ https://github.com/davealden/hiera-vault ▪ This uses Hiera 5, so allows finer tuning and features Plugging Hiera into Vault
  • 14. “--- version: 5 hierarchy: - name: "Hiera-vault lookup" lookup_key: hiera_vault options: confine_to_keys: - '^vault_.*' - '^.*_password$' - '^password.*' address: https://vault:8200 token: 97402490-eeb0-6530-13f6-fc0525503f23 default_field: value mounts: generic: - secret/puppet/%{::trusted.certname}/ An example Hiera backend configuration
  • 15. “ confine_to_keys ▪ With automatic parameter lookup, it might be trying to make a call to Vault for every parameter you could set in your Puppet code ▪ This an increase to catalog compilation time, as it’s an extra hop to check if it exists ▪ The backend has a key called “confine_to_keys”, which allows you to set Vault lookup to certain key-names ▪ For example, a regex that only allows lookup for “password” or containing the string “vault” ▪
  • 16. “▪ We can secure our lookup process even more by creating a Hiera specific policy: path "secret/puppet/*" { capabilities = ["read", "list"] } ▪ When we create a token using this policy, the Puppet token will only be able to read values under the Puppet namespace from Vault Vault Policy for Hiera
  • 17. “ How it looks architecturally
  • 18. “$ puppet lookup <key> --explain Environment Data Provider (hiera configuration version 5) Using configuration "/etc/puppetlabs/code/environments/production/hiera.yaml" Hierarchy entry "Hiera-vault lookup" Found key: "vault_lookup_example" value: "FOOBAR" [hiera-vault] Client configured to connect to https://vault:8200 [hiera-vault] Looking in path secret/puppet/puppet.home/vault_lookup_example [hiera-vault] Read secret: vault_lookup_example Explain can help debug Hiera lookups
  • 19. “ This is a sandbox example, and is not hardened to production standards! Standard Demo Pre-Warning!
  • 20. Copyright © 2018 HashiCorp Demo
  • 21. “▪ One of the easiest solutions to integrate Vault on an existing Puppet estate ▪ Minimises connectivity requirements: Vault only needs to be able to talk to the Puppetserver, not all agents ▪ Debugging can be done normally through Hiera processes ▪ However, you can’t do finer tuned control like one could do with a cubbyhole system There are advantages and disadvantages
  • 22. “▪ Use Puppet to configure consul-env or consul-template Advantages ● Secrets never touch Puppet ● Puppet does not need to run on a regular interval to catch changes ● Puppet does not need to interact with Vault at all Disadvantages ● Go's templating language is not fun ● Added indirection ● Wouldn’t work for non templated resources (user management for example) Alternative Solution: consul-env/template ▪ {{ with vault "postgresql/creds/readonly" }} [config] username = "{{ .Data.username }}" password = "{{ .Data.password }}" {{ end }}
  • 23. “▪ Use a library in your application to talk to Vault directly ▪ Vault-rails, Vault-spring Advantages ● More performant ● More control over interactions with Vault ● Less responsibility on configuration management Disadvantages ● Requires applications to be Vault-aware ● Requires engineering effort ● Slower (for existing applications) Alternative Solution: Direct Integration ▪ class Person < ActiveRecord::Base include Vault::EncryptedModel vault_attribute :ssn end class AddEncryptedSSNToPerson < ActiveRecord::Migration add_column :persons, :ssn_encrypted, :string end person = Person.new person.ssn = "123-45-6789" person.save #=> true person.ssn_encrypted #=> "vault:v0:EE3EV8P5hyo9h..."
  • 24. Copyright © 2018 HashiCorp Q&A
  • 25. “● Using HashiCorp's Vault With Puppet - Seth Vargo, PuppetConf 2016 ○ https://www.youtube.com/watch?v=PEdhD1hOpds ● Good Opsec Hygiene with Puppet - Peter Souter, PuppetConf 2016 ○ https://www.youtube.com/watch?v=JwuXUxSCDGY ● Hiera 5 Vault Backend ○ https://github.com/davealden/hiera-vault ● Vault Puppet module ○ https://forge.puppet.com/jsok/vault Would you like to know more?