Skip to content

Commit 792782c

Browse files
committed
SPL-264208 MSB-3468 Update python library to support mTLS when web private key is encrypted
1 parent 1f39b57 commit 792782c

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

solnlib/server_info.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,25 +85,20 @@ def __init__(
8585

8686
web_key_file = getWebKeyFile()
8787
web_cert_file = getWebCertFile()
88-
if (
89-
web_cert_file
90-
and web_key_file
91-
and not is_cert_or_key_encrypted(web_key_file)
88+
if web_cert_file and (
89+
web_key_file is None or not is_cert_or_key_encrypted(web_key_file)
9290
):
9391
context["cert_file"] = web_cert_file
94-
context["key_file"] = web_key_file
92+
93+
if web_key_file is not None:
94+
context["key_file"] = web_key_file
9595

9696
if all([is_localhost, context.get("verify") is None]):
9797
# NOTE: this is specifically for mTLS communication
9898
# ONLY if scheme, host, port aren't provided AND user hasn't provided server certificate
9999
# we set verify to off (similar to 'rest.simpleRequest' implementation)
100100
context["verify"] = False
101101

102-
elif web_cert_file is not None:
103-
context["cert_file"] = web_cert_file
104-
if all([is_localhost, context.get("verify") is None]):
105-
context["verify"] = False
106-
107102
self._rest_client = rest_client.SplunkRestClient(
108103
session_key, "-", scheme=scheme, host=host, port=port, **context
109104
)

0 commit comments

Comments
 (0)