Page MenuHomeMiraheze
Paste P143

(An Untitled Masterwork)
ActivePublic

Authored by Paladox on Nov 21 2018, 23:20.
Tags
None
Referenced Files
F868446:
Nov 21 2018, 23:20
Subscribers
None
diff --git a/acme_tiny.py b/acme_tiny.py
index ba04e37..264c3c4 100755
--- a/acme_tiny.py
+++ b/acme_tiny.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# Copyright Daniel Roesler, under MIT license, see LICENSE at github.com/diafygi/acme-tiny
-import argparse, subprocess, json, os, sys, base64, binascii, time, hashlib, re, copy, textwrap, logging
+import argparse, subprocess, json, os, sys, base64, binascii, time, hashlib, re, copy, textwrap, logging, ssl
try:
from urllib.request import urlopen, Request # Python 3
except ImportError:
@@ -31,7 +31,10 @@ def get_crt(account_key, csr, acme_dir, log=LOGGER, CA=DEFAULT_CA, disable_check
# helper function - make request and automatically parse json response
def _do_request(url, data=None, err_msg="Error", depth=0):
try:
- resp = urlopen(Request(url, data=data, headers={"Content-Type": "application/jose+json", "User-Agent": "acme-tiny"}))
+ ctx = ssl.create_default_context()
+ ctx.check_hostname = False
+ ctx.verify_mode = ssl.CERT_NONE
+ resp = urlopen(Request(url, data=data, headers={"Content-Type": "application/jose+json", "User-Agent": "acme-tiny"}), context=ctx)
resp_data, code, headers = resp.read().decode("utf8"), resp.getcode(), resp.headers
except IOError as e:
resp_data = e.read().decode("utf8") if hasattr(e, "read") else str(e)