Showing with 6 additions and 5 deletions.
  1. +1 −0 .travis.yml
  2. +2 −2 acme_tiny.py
  3. +1 −1 tests/server.py
  4. +2 −2 tests/test_module.py
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -6,6 +6,7 @@ python:
- "3.3"
- "3.4"
- "3.5"
- "3.6"
- "nightly"
before_install:
- sudo apt-get install fuse
Expand Down
4 changes: 2 additions & 2 deletions acme_tiny.py
Expand Up @@ -69,7 +69,7 @@ def _send_signed_request(url, payload):
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)
Expand All @@ -82,7 +82,7 @@ def _send_signed_request(url, payload):
log.info("Registering account...")
code, result = _send_signed_request(CA + "/acme/new-reg", {
"resource": "new-reg",
"agreement": "https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf",
"agreement": json.loads(urlopen(CA + "/directory").read().decode('utf8'))['meta']['terms-of-service'],
})
if code == 201:
log.info("Registered!")
Expand Down
2 changes: 1 addition & 1 deletion tests/server.py
Expand Up @@ -11,7 +11,7 @@ def app(req, resp):
body = req['wsgi.input'].read(body_len).decode("utf8")
body = re.sub(r"[^A-Za-z0-9_\-\.]", "_", body)
KEY_AUTHORIZATION['uri'] = "/{0}".format(body.split(".", 1)[0])
KEY_AUTHORIZATION['body'] = body
KEY_AUTHORIZATION['data'] = body
resp('201 Created', [])
return ["".encode("utf8")]
else:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_module.py
Expand Up @@ -110,7 +110,7 @@ def test_weak_key(self):
except Exception as e:
result = e
self.assertIsInstance(result, ValueError)
self.assertIn("Key too small", result.args[0])
self.assertIn("key too small", result.args[0])

def test_invalid_domain(self):
""" Let's Encrypt rejects invalid domains """
Expand Down Expand Up @@ -152,5 +152,5 @@ def test_account_key_domain(self):
except Exception as e:
result = e
self.assertIsInstance(result, ValueError)
self.assertIn("Certificate public key must be different than account key", result.args[0])
self.assertIn("certificate public key must be different than account key", result.args[0])