X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=modules%2Fpuppetmaster%2Flib%2Fpuppet%2Fparser%2Ffunctions%2Fgen_tlsa_entry.rb;fp=modules%2Fpuppetmaster%2Flib%2Fpuppet%2Fparser%2Ffunctions%2Fgen_tlsa_entry.rb;h=7c07b7c9fcf5d5b978821ef7eb4ad7e373a6a27f;hb=b41bbe0bcc0ca74548ff8e99c3014452a7dc64f2;hp=0000000000000000000000000000000000000000;hpb=108cf6c59c96238bc76eb2150632e21c2c6d3e26;p=dsa-puppet.git diff --git a/modules/puppetmaster/lib/puppet/parser/functions/gen_tlsa_entry.rb b/modules/puppetmaster/lib/puppet/parser/functions/gen_tlsa_entry.rb new file mode 100644 index 00000000..7c07b7c9 --- /dev/null +++ b/modules/puppetmaster/lib/puppet/parser/functions/gen_tlsa_entry.rb @@ -0,0 +1,16 @@ +module Puppet::Parser::Functions + newfunction(:gen_tlsa_entry, :type => :rvalue) do |args| + certfile = args.shift() + hostname = args.shift() + port = args.shift() + + if File.exist?(certfile) + cmd = ['swede', 'create', '--usage=3', '--selector=1', '--mtype=1', '--certificate', certfile, '--port', port.to_s, hostname] + IO.popen(cmd, "r") {|i| + return i.read + } + else + return "; certfile #{certfile} did not exist to create TLSA record for #{hostname}:#{port}." + end + end +end