3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

IRCNetwork: handle the case when certificate fingerprint checking is on but the remote provides no cert

This commit is contained in:
James Lu 2018-06-15 15:50:32 -07:00
parent fefd5a1f6b
commit b26d75a6a8

View File

@ -1642,8 +1642,12 @@ class IRCNetwork(PyLinkNetworkCoreWithUtils):
raise conf.ConfigurationError('Unsupported or invalid TLS/SSL certificate fingerprint type %r', raise conf.ConfigurationError('Unsupported or invalid TLS/SSL certificate fingerprint type %r',
hashtype) hashtype)
else: else:
fp = hashfunc(peercert).hexdigest()
expected_fp = self.serverdata.get('ssl_fingerprint') expected_fp = self.serverdata.get('ssl_fingerprint')
if expected_fp and peercert is None:
raise ssl.CertificateError('TLS/SSL certificate fingerprint checking is enabled but the uplink '
'did not provide a certificate')
fp = hashfunc(peercert).hexdigest()
if expected_fp: if expected_fp:
if fp != expected_fp: if fp != expected_fp: