diff --git a/lib/lookup_http.rb b/lib/lookup_http.rb index 432aa8b..abf7cb8 100644 --- a/lib/lookup_http.rb +++ b/lib/lookup_http.rb @@ -21,15 +21,15 @@ def initialize(opts={}) else @http.verify_mode = OpenSSL::SSL::VERIFY_PEER end - + if @config[:ssl_cert] - store = OpenSSL::X509::Store.new - store.add_cert(OpenSSL::X509::Certificate.new(File.read(@config[:ssl_ca_cert]))) - @http.cert_store = store - - @http.key = OpenSSL::PKey::RSA.new(File.read(@config[:ssl_cert])) - @http.cert = OpenSSL::X509::Certificate.new(File.read(@config[:ssl_key])) - end + @http.cert = OpenSSL::X509::Certificate.new(File.read(@config[:ssl_cert])) + @http.key = OpenSSL::PKey::RSA.new(File.read(@config[:ssl_key])) + end + + if @config[:ssl_ca_cert] + @http.ca_file = @config[:ssl_ca_cert] + end else @http.use_ssl = false end