How do I tell the OpenSSL Ruby library to ignore a self-signed certificate error?

I am trying to use Ruby SOAP support as follows:

SERVICE_URL = 'https://...'
...
def create_driver
  ::SOAP::WSDLDriverFactory.new(SERVICE_URL).create_rpc_driver
  driver.options['protocol.http.ssl_config.verify_mode']  = OpenSSL::SSL::VERIFY_NONE
  driver.options['protocol.http.ssl_config.client_cert']  = @certificate_path
  driver
end

but the call new(SERVICE_URL)calls " OpenSSL::SSL::SSLError: certificate verify failed". How to make an equivalent driver.options['protocol.http.ssl_config.verify_mode'] = OpenSSL::SSL::VERIFY_NONEfor the first call to retrieve the WSDL itself?

+3
source share
3 answers

I put a file named " soap/property" in my download path, for example:

- lib/
    - foo.rb
    - foo/
        - bar.rb
    - soap/
        - property

And put this in a file:

client.protocol.http.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE

Alternatively, if you have multiple parameters with the same prefix, you can use the group syntax:

[client.protocol.http]
ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
...
+5
source

try the following:

...
  OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
  ::SOAP::WSDLDriverFactory.new(SERVICE_URL).create_rpc_driver
...
0
source

I came across this URL: https://gist.github.com/fnichol/867550 . This can be useful for anyone who has similar problems.

0
source

Source: https://habr.com/ru/post/1719887/


All Articles