From e8cd7b2e3b68a0fa34e65c4829a9f599592b3d04 Mon Sep 17 00:00:00 2001 From: Alexander Inyukhin Date: Sat, 7 Jan 2017 20:42:36 +0300 Subject: Fix subject line parsing openssl output may contain spaces around = symbol in the 'Subject: CN = ' line. This breaks registering new certificates without extra domains (subjectAltNames) with error "Error creating new cert :: Authorizations for these names not found or expired ..." --- sign_csr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sign_csr.py b/sign_csr.py index e6af1f0..4421f8b 100644 --- a/sign_csr.py +++ b/sign_csr.py @@ -67,7 +67,7 @@ def sign_csr(pubkey, csr, email=None, file_based=False): if proc.returncode != 0: raise IOError("Error loading {0}".format(csr)) domains = set([]) - common_name = re.search("Subject:.*? CN=([^\s,;/]+)", out) + common_name = re.search("Subject:.*? CN *= *([^\s,;/]+)", out) if common_name is not None: domains.add(common_name.group(1)) subject_alt_names = re.search("X509v3 Subject Alternative Name: \n +([^\n]+)\n", out, re.MULTILINE|re.DOTALL) -- cgit v1.2.3