30: def autosign?(hostname)
31:
32: if autosign == true or autosign == false
33: return autosign
34: end
35:
36:
37: unless autosign =~ /^\//
38: raise Puppet::Error, "Invalid autosign value %s" %
39: autosign.inspect
40: end
41:
42: unless FileTest.exists?(autosign)
43: unless defined? @@warnedonautosign
44: @@warnedonautosign = true
45: Puppet.info "Autosign is enabled but %s is missing" % autosign
46: end
47: return false
48: end
49: auth = Puppet::Network::AuthStore.new
50: File.open(autosign) { |f|
51: f.each { |line|
52: next if line =~ /^\s*#/
53: next if line =~ /^\s*$/
54: auth.allow(line.chomp)
55: }
56: }
57:
58:
59: return auth.allowed?(hostname, "127.1.1.1")
60: end