I'm storing some sensitive data using eyaml. I have the encryption part working and integrated into my Hiera setup but I'm not sure how to unencrypt from within a puppet file.
When I run the following code in puppet:
$message = hiera('test_bitbucket_repo','unknown')
notify {"Message is $message":}
I get back ENC[PKCS7,...encrypted data...]
, where encrypted data is a random jumble.
I've set my keys in my hiera.yaml
file:
:backends:
- eyaml
- yaml
:hierarchy:
- "nodes/%{::trusted.certname}"
- common
- keys
:yaml:
:datadir: '/etc/puppetlabs/code/hieradata'
:eyaml:
:datadir: '/etc/puppetlabs/code/hieradata'
# uncomment below, if you want to use yaml extension for eyaml
:extension: 'yaml'
:pkcs7_private_key: /etc/puppetlabs/puppet/eyaml/keys/private_key.pkcs7.pem
:pkcs7_public_key: /etc/puppetlabs/puppet/eyaml/keys/public_key.pkcs7.pem