class PuppetDB::FixSSLConnectionAdapter

Public Instance Methods

attach_ssl_certificates(http, options) click to toggle source
# File lib/puppetdb/client.rb, line 8
def attach_ssl_certificates(http, options)
  if options[:pem].empty?
    http.ca_file = options[:cacert]
  else
    http.cert    = OpenSSL::X509::Certificate.new(File.read(options[:pem]['cert']))
    http.key     = OpenSSL::PKey::RSA.new(File.read(options[:pem]['key']))
    http.ca_file = options[:pem]['ca_file']
  end
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER
end