summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Inyukhin <shurick@sectorb.msk.ru>2017-01-07 20:42:36 +0300
committerAlexander Inyukhin <shurick@sectorb.msk.ru>2017-01-07 20:42:36 +0300
commite8cd7b2e3b68a0fa34e65c4829a9f599592b3d04 (patch)
tree89cba63d73cfea4c0f2027e77d73596761bbf8ac
parent8749f651907729d09cfbd1f0e54481a5b7b59036 (diff)
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 ..."
-rw-r--r--sign_csr.py2
1 files changed, 1 insertions, 1 deletions
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)