Skip to content

Commit

Permalink
ssl verify mode update:
Browse files Browse the repository at this point in the history
  • Loading branch information
mdazam1942 committed Nov 21, 2023
1 parent 76c078a commit 521ab2a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def __init__(self, connection, configuration):
auth = BasicAuth(conf_auth['username'], conf_auth['password'])
self.client = RestApiClientAsync(None,
auth=auth,
cert_verify=connection.get('selfSignedCert', False),
url_modifier_function=lambda host_port, endpoint, headers: f'{endpoint}')

# We re-implement this method so we can fetch all the "bindings", as their method only
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def __init__(self, host, port=None, headers={}, url_modifier_function=None, cert

if self.ssl_context:
self.ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS)
self.ssl_context.verify_mode = ssl.CERT_REQUIRED
self.ssl_context.verify_mode = ssl.CERT_OPTIONAL
self.ssl_context.check_hostname = True

self.headers = headers
Expand All @@ -98,6 +98,7 @@ async def call_api(self, endpoint, method, headers=None, cookies=None, data=None
self.ssl_context.load_verify_locations(self.server_cert_name)
except Exception as ex:
self.logger.debug('Unable to load the certificate for ssl context. Reasons: Connection does not require certificate or unexpected exception while loading the certificate: ' + str(ex))
self.ssl_context.verify_mode = ssl.CERT_REQUIRED

url = None
actual_headers = self.headers.copy()
Expand Down

0 comments on commit 521ab2a

Please sign in to comment.