mirror of
https://github.com/certbot/certbot.git
synced 2026-07-31 18:25:24 +02:00
Move eula to registration
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""ACME protocol client class and helper functions."""
|
||||
import logging
|
||||
import os
|
||||
import pkg_resources
|
||||
|
||||
import M2Crypto
|
||||
import zope.component
|
||||
@@ -62,8 +63,7 @@ class Client(object):
|
||||
|
||||
# TODO: Allow for other alg types besides RS256
|
||||
self.network = network2.Network(
|
||||
"https://%s/acme/new-reg" % config.server,
|
||||
jwk.JWKRSA.load(self.account.key.pem))
|
||||
"https://" + config.server, jwk.JWKRSA.load(self.account.key.pem))
|
||||
|
||||
self.config = config
|
||||
|
||||
@@ -79,14 +79,18 @@ class Client(object):
|
||||
self.account = self.network.register_from_account(self.account)
|
||||
if self.account.terms_of_service:
|
||||
if not self.config.tos:
|
||||
# TODO: Replace with self.account.terms_of_service
|
||||
eula = pkg_resources.resource_string("letsencrypt", "EULA")
|
||||
agree = zope.component.getUtility(interfaces.IDisplay).yesno(
|
||||
self.account.terms_of_service, "Agree", "Cancel")
|
||||
eula, "Agree", "Cancel")
|
||||
else:
|
||||
agree = True
|
||||
|
||||
if agree:
|
||||
self.account.regr = self.network.agree_to_tos(self.account.regr)
|
||||
# TODO: Handle case where user doesn't agree
|
||||
else:
|
||||
# What is the proper response here...
|
||||
raise errors.LetsEncryptClientError("Must agree to TOS")
|
||||
|
||||
self.account.save()
|
||||
|
||||
|
||||
@@ -4,12 +4,9 @@ import mock
|
||||
import os
|
||||
import pkg_resources
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
import zope.component
|
||||
|
||||
from letsencrypt.acme import messages2
|
||||
|
||||
from letsencrypt.client import configuration
|
||||
|
||||
@@ -59,7 +59,8 @@ def create_parser():
|
||||
config_help = lambda name: interfaces.IConfig[name].__doc__
|
||||
|
||||
add("-d", "--domains", metavar="DOMAIN", nargs="+")
|
||||
add("-s", "--server", default="www.letsencrypt-demo.org/acme/new-reg",
|
||||
add("-s", "--server",
|
||||
default="www.letsencrypt-demo.org/acme/new-reg",
|
||||
help=config_help("server"))
|
||||
|
||||
# TODO: we should generate the list of choices from the set of
|
||||
@@ -194,9 +195,6 @@ def main(): # pylint: disable=too-many-branches, too-many-statements
|
||||
if acc is None:
|
||||
sys.exit(0)
|
||||
|
||||
if not args.tos:
|
||||
display_eula()
|
||||
|
||||
all_auths = init_auths(config)
|
||||
logging.debug('Initialized authenticators: %s', all_auths.keys())
|
||||
try:
|
||||
@@ -235,7 +233,11 @@ def main(): # pylint: disable=too-many-branches, too-many-statements
|
||||
# but this code should be safe on all environments.
|
||||
cert_file = None
|
||||
if auth is not None:
|
||||
acme.register()
|
||||
if acc.regr is None:
|
||||
try:
|
||||
acme.register()
|
||||
except errors.LetsEncryptClientError:
|
||||
sys.exit(0)
|
||||
cert_file, chain_file = acme.obtain_certificate(doms)
|
||||
if installer is not None and cert_file is not None:
|
||||
acme.deploy_certificate(doms, acc.key, cert_file, chain_file)
|
||||
@@ -243,14 +245,6 @@ def main(): # pylint: disable=too-many-branches, too-many-statements
|
||||
acme.enhance_config(doms, args.redirect)
|
||||
|
||||
|
||||
def display_eula():
|
||||
"""Displays the end user agreement."""
|
||||
eula = pkg_resources.resource_string("letsencrypt", "EULA")
|
||||
if not zope.component.getUtility(interfaces.IDisplay).yesno(
|
||||
eula, "Agree", "Cancel"):
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
def read_file(filename):
|
||||
"""Returns the given file's contents with universal new line support.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user