Created
August 9, 2016 15:14
-
-
Save acharlieh/88e752e9e6b71980778530debe993715 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