0

I am using elasticsearch 2.3.1 and python 2.7. I am trying to create a simple instance and testing as

esInstance = Elasticsearch(['https://'+shield_uname+":"+shield_pass+"@"+server+":"+port])

print esInstance.info()

but i get

elasticsearch.exceptions.SSLError: ConnectionError(EOF occurred in violation of protocol (_ssl.c:590)) caused by: SSLError(EOF occurred in violation of protocol (_ssl.c:590))

what am i doing wrong ? I get the same error when i try

requests.get("https://"+shield_uname+":"+shield_pass+"@"+server+":"+port, verify=False)

how can i fix this?

AbtPst
  • 7,778
  • 17
  • 91
  • 172

1 Answers1

1

I think you're better off just passing the fields as arguments, given that you have them as separate variables already.

This the "fullest" version of the authentication example, with your variables plugged in:

# SSL client authentication using client_cert and client_key

es = Elasticsearch(
    [server],
    http_auth=(shield_uname, shield_pass),
    port=port,
    use_ssl=True,
    verify_certs=True,
    ca_certs='/path/to/cacert.pem',
    client_cert='/path/to/client_cert.pem',
    client_key='/path/to/client_key.pem',
)

Note the parameters after port all deal with SSL. If you're actually using certificates, then you need to be sure that you have told Python about them. If you're using standard certificates, then you can use certifi as shown in the link above.

pickypg
  • 22,034
  • 5
  • 72
  • 84
  • thanks, but i dont have any certs or keys on my side. can i just use the http_auth with use_ssl=False? – AbtPst Jun 07 '16 at 15:51
  • Yes, you can use `http_auth` without SSL, but it does mean that your username / password are going over your network in plaintext (okay for testing, but not for production!). That's equivalent to using `http`, but to do so you can remove everything after the `port` is set to remove SSL usage/settings. – pickypg Jun 07 '16 at 15:52