Commit bd38513e authored by Alexander Pace's avatar Alexander Pace
Browse files

certificate checking fix, and packaging changes.

fixes: #24
parent 645ebd46
Pipeline #169421 failed with stages
in 1 minute and 20 seconds
ligo-gracedb (2.7.2-1) unstable; urgency=low
* Bugfix for certificate check failure with tuple'd credentials
-- Alexander E. Pace <> Mon, 16 Nov 2020 21:03:38 +0000
ligo-gracedb (2.7.1-1) unstable; urgency=low
* Improved exception handling for HTTPErrors
* Fix and deprecation warning for gracedb_legacy CLI tool
%define name ligo-gracedb
%define version 2.7.1
%define unmangled_version 2.7.1
%define version 2.7.2
%define unmangled_version 2.7.2
%define release 1
Summary: Gravity Wave Candidate Event Database
......@@ -39,7 +39,22 @@ far_future = datetime.timedelta(days=365)
def load_certificate(cert):
""" Loads in a path to a x509 certificate and returns a
x509.cryptography object """
with open(cert, 'rb') as cert_obj:
# Check certificate type. First check if cert is a tuple, then
# take the first entry, which is assumed to be the cert.
# If it's a string, then take that. Otherwise fail.
if isinstance(cert, tuple):
cert_file = cert[0]
elif isinstance(cert, str):
cert_file = cert
raise RuntimeError('Unknown certificate format. Certificate must '
'be a tuple of format ("/path/to/cert",'
'"/path/to/key") or a string or the path to the '
'combined certificate/key')
with open(cert_file, 'rb') as cert_obj:
cert_obj =
# Try loading with PEM, then try loading with DER, then give up.
......@@ -50,7 +65,7 @@ def load_certificate(cert):
except ValueError:
return x509.load_pem_x509_certificate(
return x509.load_der_x509_certificate(
cert_obj, default_backend()
except ValueError:
__version__ = '2.7.1'
__version__ = '2.7.2'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment