From 9537453586cd5124d5e4e46d78f9ed909180835d Mon Sep 17 00:00:00 2001 From: Maximilian Kaul Date: Thu, 27 Apr 2017 08:21:33 +0200 Subject: [PATCH] FIX CN parsing to work with OpenSSL 1.1 CN used to be without whitespaces around the `=` but OpenSSL 1.1 introduced whitespaces: 1.0.1: subject=/CN=example.com 1.1.0: subject=CN = example.com This commit makes them optional. --- acme_tiny.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acme_tiny.py b/acme_tiny.py index 0f4cb43..bf8e1a4 100644 --- a/acme_tiny.py +++ b/acme_tiny.py @@ -69,7 +69,7 @@ def get_crt(account_key, csr, acme_dir, log=LOGGER, CA=DEFAULT_CA): if proc.returncode != 0: raise IOError("Error loading {0}: {1}".format(csr, err)) domains = set([]) - common_name = re.search(r"Subject:.*? CN=([^\s,;/]+)", out.decode('utf8')) + common_name = re.search(r"Subject:.*? CN\s?=\s?([^\s,;/]+)", out.decode('utf8')) if common_name is not None: domains.add(common_name.group(1)) subject_alt_names = re.search(r"X509v3 Subject Alternative Name: \n +([^\n]+)\n", out.decode('utf8'), re.MULTILINE|re.DOTALL)