Sha256: 8f2ea7d60d50430e103768453e9a231cce2cbc9e628bedf15cd426717256cbdc

Contents?: true

Size: 1.05 KB

Versions: 164

Compression:

Stored size: 1.05 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.initialize_settings

# 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

164 entries across 164 versions & 3 rubygems

Version Path
puppet-4.2.3-x86-mingw32 ext/puppetlisten/puppetrun.rb
puppet-4.2.3-x64-mingw32 ext/puppetlisten/puppetrun.rb
puppet-3.8.3 ext/puppetlisten/puppetrun.rb
puppet-3.8.3-x86-mingw32 ext/puppetlisten/puppetrun.rb
puppet-3.8.3-x64-mingw32 ext/puppetlisten/puppetrun.rb
puppet-4.2.2 ext/puppetlisten/puppetrun.rb
puppet-4.2.2-x86-mingw32 ext/puppetlisten/puppetrun.rb
puppet-4.2.2-x64-mingw32 ext/puppetlisten/puppetrun.rb
puppet-3.8.2 ext/puppetlisten/puppetrun.rb
puppet-3.8.2-x86-mingw32 ext/puppetlisten/puppetrun.rb
puppet-3.8.2-x64-mingw32 ext/puppetlisten/puppetrun.rb
puppet-4.2.1 ext/puppetlisten/puppetrun.rb
puppet-4.2.1-x86-mingw32 ext/puppetlisten/puppetrun.rb
puppet-4.2.1-x64-mingw32 ext/puppetlisten/puppetrun.rb
puppet-4.2.0 ext/puppetlisten/puppetrun.rb
puppet-4.2.0-x86-mingw32 ext/puppetlisten/puppetrun.rb
puppet-4.2.0-x64-mingw32 ext/puppetlisten/puppetrun.rb
puppet-3.8.1 ext/puppetlisten/puppetrun.rb
puppet-3.8.1-x86-mingw32 ext/puppetlisten/puppetrun.rb
puppet-3.8.1-x64-mingw32 ext/puppetlisten/puppetrun.rb