Skip to content

Commit 4cc8d22

Browse files
committed
Support client key/certificate in TLSTransport
1 parent 3e181d9 commit 4cc8d22

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

riemann_client/transport.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,20 @@ def send(self, message):
148148

149149

150150
class TLSTransport(TCPTransport):
151-
def __init__(self, host=HOST, port=PORT, timeout=TIMEOUT, ca_certs=None):
151+
def __init__(self, host=HOST, port=PORT, timeout=TIMEOUT, ca_certs=None,
152+
keyfile=None, certfile=None):
152153
"""Communicates with Riemann over TCP + TLS
153154
154155
Options are the same as :py:class:`.TCPTransport` unless noted
155156
156157
:param str ca_certs: Path to a CA Cert bundle used to create the socket
158+
:param str keyfile: Path to a client key file
159+
:param str certfile: Path to a client certificate file
157160
"""
158161
super(TLSTransport, self).__init__(host, port, timeout)
159162
self.ca_certs = ca_certs
163+
self.keyfile = keyfile
164+
self.certfile = certfile
160165

161166
def connect(self):
162167
"""Connects using :py:meth:`TLSTransport.connect` and wraps with TLS"""
@@ -165,7 +170,9 @@ def connect(self):
165170
self.socket,
166171
ssl_version=ssl.PROTOCOL_TLSv1,
167172
cert_reqs=ssl.CERT_REQUIRED,
168-
ca_certs=self.ca_certs)
173+
ca_certs=self.ca_certs,
174+
keyfile=self.keyfile,
175+
certfile=self.certfile)
169176

170177

171178
class BlankTransport(Transport):

0 commit comments

Comments
 (0)