From d178f19045fe41eb543227ab36b2c7fa18aeb970 Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Sep 02 2016 21:12:26 +0000 Subject: Print a more sane error in case of TLS issues Signed-off-by: Patrick Uiterwijk --- diff --git a/koji/__init__.py b/koji/__init__.py index 1810042..340b84e 100644 --- a/koji/__init__.py +++ b/koji/__init__.py @@ -49,6 +49,7 @@ import shutil import signal import socket import ssl.SSLCommon +from OpenSSL.SSL import Error as SSLError try: from ssl import ssl as pyssl except ImportError: @@ -1927,6 +1928,11 @@ class ClientSession(object): if self._port == 80 and not self.explicit_port: self._port = 443 sinfo = self.callMethod('sslLogin', proxyuser) + except SSLError as ex: + if (len(ex.args) == 1 and ex.args[0][0][0] == 'SSL routines' and + ex.args[0][0][2] == 'shutdown while in init'): + raise Exception('TLS issue. Expired certificate?') + raise finally: if old_timeout is None: del self._cnxOpts['timeout']