18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/smart_proxy_dynflow_core/callback.rb', line 18
def ssl_options
return @ssl_options if defined? @ssl_options
@ssl_options = {}
settings = Settings.instance
return @ssl_options unless URI.parse(settings.foreman_url).scheme == 'https'
@ssl_options[:verify_ssl] = OpenSSL::SSL::VERIFY_PEER
private_key_file = settings.foreman_ssl_key || settings.ssl_private_key
if private_key_file
private_key = File.read(private_key_file)
@ssl_options[:ssl_client_key] = OpenSSL::PKey::RSA.new(private_key)
end
certificate_file = settings.foreman_ssl_cert || settings.ssl_certificate
if certificate_file
certificate = File.read(certificate_file)
@ssl_options[:ssl_client_cert] = OpenSSL::X509::Certificate.new(certificate)
end
ca_file = settings.foreman_ssl_ca || settings.ssl_ca_file
@ssl_options[:ssl_ca_file] = ca_file if ca_file
@ssl_options
end
|