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 #{autosign.inspect}"
39: end
40:
41: unless FileTest.exists?(autosign)
42: unless defined?(@@warnedonautosign)
43: @@warnedonautosign = true
44: Puppet.info "Autosign is enabled but #{autosign} is missing"
45: end
46: return false
47: end
48: auth = Puppet::Network::AuthStore.new
49: File.open(autosign) { |f|
50: f.each { |line|
51: next if line =~ /^\s*#/
52: next if line =~ /^\s*$/
53: auth.allow(line.chomp)
54: }
55: }
56:
57:
58: auth.allowed?(hostname, "127.1.1.1")
59: end