solrpy icon indicating copy to clipboard operation
solrpy copied to clipboard

Is it possible to connect to https website with self signed ssl cert?

Open cryptid11 opened this issue 10 years ago • 1 comments

If yes how?

I see here https://github.com/edsu/solrpy/blob/ae72fb90b100090328aab1949ba978b1717795f5/solr/core.py#L52 it seems possible but I take the ssl_key it seems, anyway I export what is seems the ssl_cert an put it into a file, it's like

-----BEGIN TRUSTED CERTIFICATE----- MIID4TCCAsmgAwIBAgIOYyUAAQACFJ0zFQLkbPQwDQYJKoZIhvcNAQEFBQAwezEL ..... dXN0Q2VudGVyIFVuaXZlcnNhbCBYQSBJSUk= -----END TRUSTED CERTIFICATE-----

but don't know hot to set the key?

Is there a way to simply ignore the initial warning and go on? I got

Traceback (most recent call last):
  File "solr1.py", line 36, in <module>
    response = s.query("directQuota_ss:*")
  File "build/bdist.linux-x86_64/egg/solr/core.py", line 703, in query
  File "build/bdist.linux-x86_64/egg/solr/core.py", line 798, in __call__
  File "build/bdist.linux-x86_64/egg/solr/core.py", line 822, in raw
  File "build/bdist.linux-x86_64/egg/solr/core.py", line 646, in _post
  File "build/bdist.linux-x86_64/egg/solr/core.py", line 625, in _reconnect
  File "/usr/lib64/python2.7/httplib.py", line 1274, in connect
    server_hostname=server_hostname)
  File "/usr/lib64/python2.7/ssl.py", line 352, in wrap_socket
    _context=self)
  File "/usr/lib64/python2.7/ssl.py", line 579, in __init__
    self.do_handshake()
  File "/usr/lib64/python2.7/ssl.py", line 808, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)

with the standard: s = solr.SolrConnection('https://IP_ADDRESS/solr/SOME_INDEX')

Any solution?

I also try

import requests
import requests.packages.urllib3
requests.packages.urllib3.disable_warnings()

and

import httplib2
h = httplib2.Http(".cache", disable_ssl_certificate_validation=True)

without results...

cryptid11 avatar Jul 22 '15 15:07 cryptid11

Is it possible to communicate with Solar running under HTTPS? Or will you send me a PR?

If you need to use a self-signed key, consider a patch.

search5 avatar Oct 11 '18 07:10 search5