1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
From 86083e6f79c6af99a59d8ee27c61f5d9b407f436 Mon Sep 17 00:00:00 2001
From: Phiber2000 <phiber2000@gmx.de>
Date: Thu, 10 Mar 2016 16:43:54 +0100
Subject: [PATCH 1/3] added contact key in payload and email parameter
---
acme_tiny.py | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/acme_tiny.py b/acme_tiny.py
index 34a1863..bd79321 100644
--- a/acme_tiny.py
+++ b/acme_tiny.py
@@ -12,7 +12,7 @@
LOGGER.addHandler(logging.StreamHandler())
LOGGER.setLevel(logging.INFO)
-def get_crt(account_key, csr, acme_dir, log=LOGGER, CA=DEFAULT_CA):
+def get_crt(account_key, csr, acme_dir, account_email, log=LOGGER, CA=DEFAULT_CA):
# helper function base64 encode for jose spec
def _b64(b):
return base64.urlsafe_b64encode(b).decode('utf8').replace("=", "")
@@ -80,10 +80,13 @@ def _send_signed_request(url, payload):
# get the certificate domains and expiration
log.info("Registering account...")
- code, result = _send_signed_request(CA + "/acme/new-reg", {
+ payload = {
"resource": "new-reg",
"agreement": "https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf",
- })
+ }
+ if account_email:
+ payload["contact"] = ["mailto:"+account_email]
+ code, result = _send_signed_request(CA + "/acme/new-reg", payload)
if code == 201:
log.info("Registered!")
elif code == 409:
@@ -188,10 +191,11 @@ def main(argv):
parser.add_argument("--acme-dir", required=True, help="path to the .well-known/acme-challenge/ directory")
parser.add_argument("--quiet", action="store_const", const=logging.ERROR, help="suppress output except for errors")
parser.add_argument("--ca", default=DEFAULT_CA, help="certificate authority, default is Let's Encrypt")
+ parser.add_argument("--account-email", help="contact e-mail address")
args = parser.parse_args(argv)
LOGGER.setLevel(args.quiet or LOGGER.level)
- signed_crt = get_crt(args.account_key, args.csr, args.acme_dir, log=LOGGER, CA=args.ca)
+ signed_crt = get_crt(args.account_key, args.csr, args.acme_dir, args.account_email, log=LOGGER, CA=args.ca)
sys.stdout.write(signed_crt)
if __name__ == "__main__": # pragma: no cover
From b128ae1289b106e1ddf20d3787a431d8ea949cf3 Mon Sep 17 00:00:00 2001
From: Phiber2000 <phiber2000@gmx.de>
Date: Thu, 10 Mar 2016 19:27:17 +0100
Subject: [PATCH 2/3] code style correction
---
acme_tiny.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/acme_tiny.py b/acme_tiny.py
index bd79321..cea57ee 100644
--- a/acme_tiny.py
+++ b/acme_tiny.py
@@ -85,7 +85,7 @@ def _send_signed_request(url, payload):
"agreement": "https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf",
}
if account_email:
- payload["contact"] = ["mailto:"+account_email]
+ payload["contact"] = ["mailto:{0}".format(account_email)]
code, result = _send_signed_request(CA + "/acme/new-reg", payload)
if code == 201:
log.info("Registered!")
From 90eac8d6f22e858168ead32f00f13e7c997b64fc Mon Sep 17 00:00:00 2001
From: Phiber2000 <phiber2000@gmx.de>
Date: Thu, 10 Mar 2016 19:33:21 +0100
Subject: [PATCH 3/3] updated email argument helptext
---
acme_tiny.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/acme_tiny.py b/acme_tiny.py
index cea57ee..930cd43 100644
--- a/acme_tiny.py
+++ b/acme_tiny.py
@@ -191,7 +191,7 @@ def main(argv):
parser.add_argument("--acme-dir", required=True, help="path to the .well-known/acme-challenge/ directory")
parser.add_argument("--quiet", action="store_const", const=logging.ERROR, help="suppress output except for errors")
parser.add_argument("--ca", default=DEFAULT_CA, help="certificate authority, default is Let's Encrypt")
- parser.add_argument("--account-email", help="contact e-mail address")
+ parser.add_argument("--account-email", help="set contact e-mail address, leave empty to keep current")
args = parser.parse_args(argv)
LOGGER.setLevel(args.quiet or LOGGER.level)
|