From: Ward Vandewege Date: Thu, 17 Mar 2022 17:06:50 +0000 (-0400) Subject: 18890: when ARVADOS_API_HOST_INSECURE is set, also disable certificate X-Git-Tag: 2.4.0~43^2 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/aebc2c0d06422698979a822bd59b9354e4bd8487 18890: when ARVADOS_API_HOST_INSECURE is set, also disable certificate hostname checking in the Python SDK when talking to Keep. Arvados-DCO-1.1-Signed-off-by: Ward Vandewege --- diff --git a/sdk/python/arvados/keep.py b/sdk/python/arvados/keep.py index 0018687ff3..1a83eae944 100644 --- a/sdk/python/arvados/keep.py +++ b/sdk/python/arvados/keep.py @@ -376,6 +376,7 @@ class KeepClient(object): curl.setopt(pycurl.HEADERFUNCTION, self._headerfunction) if self.insecure: curl.setopt(pycurl.SSL_VERIFYPEER, 0) + curl.setopt(pycurl.SSL_VERIFYHOST, 0) else: curl.setopt(pycurl.CAINFO, arvados.util.ca_certs_path()) if method == "HEAD": @@ -478,6 +479,7 @@ class KeepClient(object): curl.setopt(pycurl.HEADERFUNCTION, self._headerfunction) if self.insecure: curl.setopt(pycurl.SSL_VERIFYPEER, 0) + curl.setopt(pycurl.SSL_VERIFYHOST, 0) else: curl.setopt(pycurl.CAINFO, arvados.util.ca_certs_path()) self._setcurltimeouts(curl, timeout) diff --git a/sdk/python/tests/test_keep_client.py b/sdk/python/tests/test_keep_client.py index aa7e371bf4..605b90301c 100644 --- a/sdk/python/tests/test_keep_client.py +++ b/sdk/python/tests/test_keep_client.py @@ -265,6 +265,9 @@ class KeepClientServiceTestCase(unittest.TestCase, tutil.ApiClientMock): self.assertEqual( mock.responses[0].getopt(pycurl.SSL_VERIFYPEER), 0) + self.assertEqual( + mock.responses[0].getopt(pycurl.SSL_VERIFYHOST), + 0) api_client.insecure = False with tutil.mock_keep_responses(b'foo', 200) as mock: @@ -276,6 +279,9 @@ class KeepClientServiceTestCase(unittest.TestCase, tutil.ApiClientMock): self.assertEqual( mock.responses[0].getopt(pycurl.SSL_VERIFYPEER), None) + self.assertEqual( + mock.responses[0].getopt(pycurl.SSL_VERIFYHOST), + None) def test_refresh_signature(self): blk_digest = '6f5902ac237024bdd0c176cb93063dc4+11'