Browse Source

Merge branch 'master' into pypi

Jonas Haag 7 years ago
parent
commit
5289e321ed
3 changed files with 5 additions and 4 deletions
  1. 1 0
      .travis.yml
  2. 2 2
      acme_tiny.py
  3. 2 2
      tests/test_module.py

+ 1 - 0
.travis.yml

@@ -6,6 +6,7 @@ python:
   - "3.3"
   - "3.4"
   - "3.5"
+  - "3.6"
   - "nightly"
 before_install:
   - sudo apt-get install fuse

+ 2 - 2
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)
@@ -82,7 +82,7 @@ def get_crt(account_key, csr, acme_dir, log=LOGGER, CA=DEFAULT_CA):
     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!")

+ 2 - 2
tests/test_module.py

@@ -110,7 +110,7 @@ class TestModule(unittest.TestCase):
         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 """
@@ -152,5 +152,5 @@ class TestModule(unittest.TestCase):
         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])