Puppet Function: icinga2_ticket_id

Defined in:
lib/puppet/parser/functions/icinga2_ticket_id.rb
Function type:
Ruby 3.x API

Summary

Generates a auth ticket to get a certificate

Overview

icinga2_ticket_id()Any

Returns:

  • (Any)

    The ticket to get a certificate



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/puppet/parser/functions/icinga2_ticket_id.rb', line 8

newfunction(:icinga2_ticket_id, :type => :rvalue) do |args|
  raise Puppet::ParseError, 'Must provide exactly two arguments to icinga2_ticket_id' if args.length != 2

  if !args[0] or args[0] == ''
    raise Puppet::ParseError, 'first argument (cn) can not be empty for icinga2_ticket_id'
  end
  if !args[1] or args[1] == ''
    raise Puppet::ParseError, 'second argument (salt) can not be empty for icinga2_ticket_id'
  end

  PBKDF2.new(
    :password => args[0],
    :salt => args[1],
    :iterations => 50000,
    :hash_function => OpenSSL::Digest.new("sha1")
  ).hex_string
end