From 36842b7bbbd52f0086a706264f92b7ba6519ded7 Mon Sep 17 00:00:00 2001 From: Miquel Ruiz Date: Sat, 24 Oct 2015 13:25:04 +0100 Subject: [PATCH] Ask for email unless --allow-unsafe-registration Add new option that explicitly allows to not provide an email. Fixes #414 --- letsencrypt/cli.py | 14 ++++++++++++-- letsencrypt/display/ops.py | 4 +++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/letsencrypt/cli.py b/letsencrypt/cli.py index e9cb31a21..175354f5d 100644 --- a/letsencrypt/cli.py +++ b/letsencrypt/cli.py @@ -139,9 +139,9 @@ def _determine_account(args, config): elif len(accounts) == 1: acc = accounts[0] else: # no account registered yet - if args.email is None: + if args.email is None and not args.allow_unsafe_registration: args.email = display_ops.get_email() - if not args.email: # get_email might return "" + else: args.email = None def _tos_cb(regr): @@ -842,6 +842,16 @@ def prepare_and_parse_args(plugins, args): helpful.add( None, "-t", "--text", dest="text_mode", action="store_true", help="Use the text output instead of the curses UI.") + helpful.add( + None, "--allow-unsafe-registration", action="store_true", + help="Specifying this flag enables registering an account with no " + "email address. This is strongly discouraged, because in the " + "event of key loss or account compromise you will irrevocably " + "lose access to your account. You will also be unable to receive " + "notice about impending expiration of revocation of your " + "certificates. Updates to the Subscriber Agreement will still " + "affect you, and will be effective N days after posting an " + "update to the web site.") helpful.add(None, "-m", "--email", help=config_help("email")) # positional arg shadows --domains, instead of appending, and # --domains is useful, because it can be stored in config diff --git a/letsencrypt/display/ops.py b/letsencrypt/display/ops.py index 37ce66b62..31913e708 100644 --- a/letsencrypt/display/ops.py +++ b/letsencrypt/display/ops.py @@ -124,7 +124,9 @@ def get_email(): """ while True: code, email = zope.component.getUtility(interfaces.IDisplay).input( - "Enter email address (used for urgent notices and lost key recovery)") + "Enter email address (mandatory since no " + "--allow-unsafe-registration was provided)" + "(used for urgent notices and lost key recovery)") if code == display_util.OK: if le_util.safe_email(email):