Skip to content

Commit

Permalink
Load certificate chain only if a certificate was specified
Browse files Browse the repository at this point in the history
Closes #79.
  • Loading branch information
eht16 committed Jul 30, 2023
1 parent 527483e commit 3f07caa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions logstash_async/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,10 @@ def _create_socket(self):
else:
cert_reqs = ssl.CERT_NONE

ssl_context.verify_mode = cert_reqs
ssl_context.check_hostname = False
ssl_context.load_cert_chain(self._certfile, self._keyfile)
ssl_context.verify_mode = cert_reqs
if self._certfile and self._keyfile:
ssl_context.load_cert_chain(self._certfile, self._keyfile)
self._sock = ssl_context.wrap_socket(self._sock, server_side=False)
except socket.error:
self._close()
Expand Down

0 comments on commit 3f07caa

Please sign in to comment.