Skip to content
This repository was archived by the owner on Feb 25, 2023. It is now read-only.

Commit da5e1b7

Browse files
committed
Non-proxied ssl client now gets proper ca configuration to accept incoming connections in cases of cert_verification_mode!=none
1 parent 2342d4c commit da5e1b7

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ And the main options:
6969
- **-j --json** Print result in JSON format
7070
- **-t --tls** Use TLS socket if provided
7171
- **-k --tls_key_path** path to tls key file. Provides client identity to enable mTLS communication. Has effect only if --tls key is provided
72+
- **-m --cert_verification_mode** Peer certificate validation mode.
73+
**none** : server's certificate will not be validated. Connection will be established even if certificate is absent
74+
**optional** : server's certificate will be validated if provided. Absence of certificate doesn't prevent the connection
75+
**required** : Valid certificate must be provided by the server. This is default value if omitted
7276
- **-i --client_id [client_id]**
7377
Finagle client id to send request with
7478
- **-v --verbose** Provide detailed logging

thriftcli/thrift_executor.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,9 @@ def _open_connection(self, address):
148148
if self._tls_key_path is not None:
149149
ssl_context.load_cert_chain(self._tls_key_path, self._tls_key_path)
150150
ssl_context.verify_mode = verifier_type
151-
self._transport = TSSLSocket.TSSLSocket(url, port, ssl_context=ssl_context)
152-
else:
151+
self._transport = TSSLSocket.TSSLSocket(url, port, ca_certs=self._tls_key_path,
152+
validate_callback=lambda cert, hostname: None) # disabling hostname validation
153+
else:
153154
if self._proxy:
154155
proxy_host, proxy_port = self._proxy.split(":")
155156
self._transport = TProxySocket(proxy_host, proxy_port, url, port)

0 commit comments

Comments
 (0)