2
# this scripts calls a client and ask him to trigger a puppetd run
3
# uses SSL for communication based on the puppet infrastructure
4
# the client allows access based on the namespaceauth
9
warn "Usage: hostname to run against"
15
require 'puppet/sslcertificates/support'
18
# load puppet configuration, needed to find ssl certificates
19
Puppet[:config] = "/etc/puppet/puppet.conf"
22
# establish the certificate
23
ctx = OpenSSL::SSL::SSLContext.new()
24
ctx.key = OpenSSL::PKey::RSA.new(File::read(Puppet[:hostprivkey]))
25
ctx.cert = OpenSSL::X509::Certificate.new(File::read(Puppet[:hostcert]))
26
ctx.verify_mode = OpenSSL::SSL::VERIFY_PEER
27
ctx.ca_file = Puppet[:localcacert]
29
# establish the connection
30
s = TCPSocket.new(host, port)
31
ssl = OpenSSL::SSL::SSLSocket.new(s, ctx)
32
ssl.connect # start SSL session
33
ssl.sync_close = true # if true the underlying socket will be
34
# closed in SSLSocket#close. (default: false)
35
while (line = ssl.gets)