-
-
Save nmattam/30cbecb0156d8e77e045e168f88fd5ad to your computer and use it in GitHub Desktop.
Figuring out that one vagrant vault key wasn't updated
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
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