diff options
author | siddharth <s@ricketyspace.net> | 2021-05-29 11:06:10 -0400 |
---|---|---|
committer | siddharth <s@ricketyspace.net> | 2021-05-29 11:06:10 -0400 |
commit | 74d7f0733490f743d0609bdc3af2d785d9714dbd (patch) | |
tree | c5708de8a155a7c7e92742ae0f5d0f3ff2c7c898 | |
parent | ddbb58bb5f141a93c7dcf85ebbccb7878ed1cdde (diff) |
acmens.py: Explicitly ask user to agree to LE Subscriber Agreement
* acmens.py (_agree_to): New function.
(sign_csr): Update function.
-rw-r--r-- | acmens.py | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -12,7 +12,7 @@ from urllib.request import urlopen from urllib.error import HTTPError -__version__ = "0.1.4-dev0" +__version__ = "0.1.4-dev1" CA_PRD = "https://acme-v02.api.letsencrypt.org" CA_STG = "https://acme-staging-v02.api.letsencrypt.org" @@ -215,6 +215,19 @@ Notes: sys.stderr.write("{} verified!\n".format(domain)) +def _agree_to(terms): + """Asks user whether they agree to the Let's Encrypt Subscriber + Agreement. It will immediately exit if user does not agree.""" + ans = input( + "\nDo you agree to the Let's Encrypt Subscriber Agreement\n({})? ".format( + terms + ) + ) + if re.search(r"[Yy]", ans) is None: + sys.stderr.write("Error: Cannot continue. Exiting.\n") + sys.exit(1) + + def sign_csr(ca_url, account_key, csr, email=None, challenge_type="http"): """Use the ACME protocol to get an ssl certificate signed by a certificate authority. @@ -298,6 +311,7 @@ def sign_csr(ca_url, account_key, csr, email=None, challenge_type="http"): # Step 4: Generate the payload for registering user and initiate registration. sys.stderr.write("Registering {0}...\n".format(email)) + _agree_to(_directory(ca_url)["meta"]["termsOfService"]) reg = {"termsOfServiceAgreed": True} nonce_url = _directory(ca_url)["newNonce"] auth = {"jwk": jwk} |