From c45dfa9371702980acf97e828a691e4534a720e0 Mon Sep 17 00:00:00 2001 From: Moshe Kaplan Date: Wed, 31 Jul 2019 15:33:07 -0400 Subject: [PATCH] Disable SSL when verify=false Previously, verify=false would only disable SSL validation if the user was running Python 2.7.9 or later. This commit allows users running Python versions before 2.7.9 to also disable SSL validation. --- splunklib/binding.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/splunklib/binding.py b/splunklib/binding.py index 3fe7c8495..283a0a8c7 100644 --- a/splunklib/binding.py +++ b/splunklib/binding.py @@ -1357,7 +1357,7 @@ def connect(scheme, host, port): if cert_file is not None: kwargs['cert_file'] = cert_file # If running Python 2.7.9+, disable SSL certificate validation - if (sys.version_info >= (2,7,9) and key_file is None and cert_file is None) and not verify: + if (sys.version_info >= (2,7,9) and key_file is None and cert_file is None) or not verify: kwargs['context'] = ssl._create_unverified_context() return six.moves.http_client.HTTPSConnection(host, port, **kwargs) raise ValueError("unsupported scheme: %s" % scheme)