Puppet::Util::Certencryption library to use SSL certs to encrypt/decrypt data
Library to do RSA based encryption for Puppet
There are 4 methods:
- encrypt(the rsa key, the file)
- decrypt(the rsa key, the file)
- encryptstring(the rsa key, the string)
- decryptstring(the rsa key, the string)
Also included are a parser function (decrypt()) and a fact demonstrating how to pass data around
This example uses the sample encfact
fact in the lib/facter directory of this repo:
class foo {
$foovar = decrypt('/etc/foo/privatekey.pem',$::encfact')
notify { $foovar: }
}
require 'puppet'
require 'puppet/util/certencryption'
a=Puppet::Util::Certencryption.new
moo = a.encryptstring('/etc/puppetlabs/puppet/ssl/private_keys/puppet1.spence.org.uk.local.pem','moo')
puts moo
clear = a.decryptstring('/etc/puppetlabs/puppet/ssl/private_keys/puppet1.spence.org.uk.local.pem',moo)
puts clear