Skip to content

Instantly share code, notes, and snippets.

@mechanicalduck
Created September 2, 2014 20:23
Show Gist options
  • Select an option

  • Save mechanicalduck/8cc146a718e57304dd41 to your computer and use it in GitHub Desktop.

Select an option

Save mechanicalduck/8cc146a718e57304dd41 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require "shellwords"
module Puppet::Parser::Functions
newfunction(:password_dec, :type => :rvalue) do |args|
encrypted = args[0]
key = args[1]
plaintext = exec "/scripts/aesdecrypt.py ${%k} ${%p}" % [Shellwords.escape(key), Shellwords.escape(plaintext)]
return plaintext
end
end
#!/usr/bin/env ruby
require "shellwords"
module Puppet::Parser::Functions
newfunction(:password_enc, :type => :rvalue) do |args|
plaintext = args[0]
encrypted = exec "awk '/auto/ { print %s }' /root/.axp.secret" % Shellwords.escape(plaintext)
return encrypted
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment