Class: Infrataster::Contexts::SslCertificatesContext

Inherits:
BaseContext
  • Object
show all
Defined in:
lib/infrataster/contexts/ssl_certificates_context.rb

Instance Method Summary collapse

Instance Method Details

#certificateObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/infrataster/contexts/ssl_certificates_context.rb', line 7

def certificate
  options = { port: 443 }

  if server.options[:ssl]
    options = options.merge(server.options[:ssl])
  end

  https = Net::HTTP.new(resource.domain, options[:port])
  https.use_ssl = true
  https.verify_mode = OpenSSL::SSL::VERIFY_PEER
  https.start do
    https.peer_cert
  end
end