Sha256: 2ecc80bd71cc0cb7ffc769acbe2749f214691b6a474baaf912556a2d8a66d780

Contents?: true

Size: 1.09 KB

Versions: 54

Compression:

Stored size: 1.09 KB

Contents

#! /usr/bin/env ruby
# this scripts calls a client and ask him to trigger a puppetd run
# uses SSL for communication based on the puppet infrastructure
# the client allows access based on the namespaceauth
# ohadlevy@gmail.com

port = 8139
if ARGV[0].nil?
  warn "Usage: hostname to run against"
  exit 1
else
  host = ARGV[0]
end

require 'puppet/sslcertificates/support'
require 'socket'

# load puppet configuration, needed to find ssl certificates
Puppet[:config] = "/etc/puppet/puppet.conf"
Puppet.parse_config

# establish the certificate
ctx = OpenSSL::SSL::SSLContext.new
ctx.key = OpenSSL::PKey::RSA.new(File::read(Puppet[:hostprivkey]))
ctx.cert = OpenSSL::X509::Certificate.new(File::read(Puppet[:hostcert]))
ctx.verify_mode = OpenSSL::SSL::VERIFY_PEER
ctx.ca_file = Puppet[:localcacert]

# establish the connection
s = TCPSocket.new(host, port)
ssl = OpenSSL::SSL::SSLSocket.new(s, ctx)
ssl.connect # start SSL session
ssl.sync_close = true  # if true the underlying socket will be
#                        closed in SSLSocket#close. (default: false)
while (line = ssl.gets)
  puts line
end

ssl.close

Version data entries

54 entries across 54 versions & 3 rubygems

Version Path
puppet-2.7.26 ext/puppetlisten/puppetrun.rb
puppet-2.7.25 ext/puppetlisten/puppetrun.rb
puppet-2.7.24 ext/puppetlisten/puppetrun.rb
puppet-2.7.23 ext/puppetlisten/puppetrun.rb
puppet-2.7.22 ext/puppetlisten/puppetrun.rb
puppet-2.7.21 ext/puppetlisten/puppetrun.rb
puppet-2.6.18 ext/puppetlisten/puppetrun.rb
puppet-2.7.20 ext/puppetlisten/puppetrun.rb
puppet-2.7.20.rc1 ext/puppetlisten/puppetrun.rb
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/puppet-2.7.18/ext/puppetlisten/puppetrun.rb
puppet-2.7.19 ext/puppetlisten/puppetrun.rb
supply_drop-0.11.0 examples/vendored-puppet/vendor/puppet-2.7.8/ext/puppetlisten/puppetrun.rb
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/puppet-2.7.18/ext/puppetlisten/puppetrun.rb
supply_drop-0.10.2 examples/vendored-puppet/vendor/puppet-2.7.8/ext/puppetlisten/puppetrun.rb
puppet-2.7.18 ext/puppetlisten/puppetrun.rb
puppet-2.6.17 ext/puppetlisten/puppetrun.rb
supply_drop-0.10.1 examples/vendored-puppet/vendor/puppet-2.7.8/ext/puppetlisten/puppetrun.rb
supply_drop-0.10.0 examples/vendored-puppet/vendor/puppet-2.7.8/ext/puppetlisten/puppetrun.rb
puppet-2.7.17 ext/puppetlisten/puppetrun.rb
puppet-2.7.16 ext/puppetlisten/puppetrun.rb