Skip to content

Instantly share code, notes, and snippets.

@acharlieh
Created August 9, 2016 15:14
Show Gist options
  • Save acharlieh/88e752e9e6b71980778530debe993715 to your computer and use it in GitHub Desktop.
Save acharlieh/88e752e9e6b71980778530debe993715 to your computer and use it in GitHub Desktop.
Figuring out that one vagrant vault key wasn't updated
require 'chef-vault'
data = JSON.parse(File.open('data_bags/cerner_splunk/license_secrets_keys.json').read())
keys = (data['clients'] + data['admins']).inject({}) do |m,c|
pem = (c == 'knife_workstation') ? 'fake-key.pem' : "pems/#{c}.pem"
private_key = OpenSSL::PKey::RSA.new(File.open(pem).read())
m[c] = private_key.private_decrypt(Base64.decode64(data[c]))
m
end
keys.each { |k,v| puts "'#{v.unpack('H*').join('')}'\t#{k}" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment