Created
April 20, 2015 20:20
-
-
Save dustinmm80/519f497d2387f423094e to your computer and use it in GitHub Desktop.
An example of pulling secrets at Chef runtime with Conjur
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First, let's define some secrets we want to pass to Chef | |
cat << SECRETS > /etc/chef.secrets | |
DB_PASSWORD: !var db/postgres/customers/password # exports value as env var | |
SSL_CERT: !tmp certs/ssl/mydomain # creates temporary file and exports path as env var | |
SECRETS | |
# In our recipe we can use ENV['DB_PASSWORD'] and ENV['SSL_CERT'] where secrets are needed | |
# We have the Conjur CLI on the machine, so we can use conjur env | |
# This pattern works with any tool that accepts environment variables | |
conjur env run -c /etc/chef.secrets -- chef-client | |
# Once chef-client exits, the environment variables are no longer on the machine. | |
# They will be fetched again for the next run. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment