hiera-eyaml icon indicating copy to clipboard operation
hiera-eyaml copied to clipboard

Parsing of encrypted hiera from raw ruby

Open sergii-zemlianyi opened this issue 6 years ago • 1 comments

Dear all,

We are using a set of ruby+capistrano scripts altogether with hiera to run deployments . Currently we intend to start using eyaml backend. This is what I have: here I just initialize eyaml backend and load keys from eyaml files. Backend.datasourcefiles(:eyaml, scope, 'eyaml', Config[:hierarchy]) do |source, yamlfile| data = @cache.read_file(yamlfile) do |chunk| YAML.load(chunk) || {} end ...

So my first question is: should I then call the following method to decrypt values? new_answer = parse_answer(data, scope)

if I do so I get the following error

/usr/local/rvm/gems/ruby-1.9.3-p551/gems/hiera-eyaml-2.1.0/lib/hiera/backend/eyaml/encryptors/pkcs7.rb:51:in decrypt': undefined local variable or method private_key' for Hiera::Backend::Eyaml::Encryptors::Pkcs7:Class (NameError)

I believe this is cause Hiera::Backend::Eyaml::Encryptor.option method returns a full hash @@options rather than single private_key value

if all above doesn't make sense which method should I pass my encrypted data into?

Thanks a lot in advance, Sergey

sergii-zemlianyi avatar Mar 28 '18 19:03 sergii-zemlianyi

Did you ever find a solution to how to use hiera-eyaml in a ruby script?

This may help https://github.com/voxpupuli/hiera-eyaml/issues/153

spuder avatar Sep 24 '20 22:09 spuder