Rationalize OT&E client ID validation rules

This makes the validation rules much simpler, thus placing less cognitive load on the users of the console and nomulus tool.  The changes are:

1. Don't allow hyphens. No real registrars use hyphens in their client IDs, and it's better to reserve these solely as the delimiter between the base client ID and the number representing the environment.
2. Allow the first character to be a number.  This has affected multiple real registrars, causing their OT&E and production client IDs to be different.  There's no reason for this restriction, as the only reason motivating it was that there are no TLDs that start with a number.  However, the OT&E TLDs are created only in sandbox and never have DNS syncing enabled, so this restriction is purposeless.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=229187198
This commit is contained in:
mcilwain 2019-01-14 08:27:52 -08:00 committed by Ben McIlwain
parent fd8a18b72e
commit 8ac8ecf8f6
6 changed files with 37 additions and 50 deletions

View file

@ -40,51 +40,41 @@ final class SetupOteCommand extends ConfirmingCommand implements CommandWithRemo
private static final int PASSWORD_LENGTH = 16;
@Parameter(
names = {"-r", "--registrar"},
description =
"must 1) consist of only lowercase letters, numbers, or hyphens, "
+ "2) start with a letter, and 3) be between 3 and 14 characters (inclusive). "
+ "We require 1 and 2 since the registrar name will be used to create TLDs,"
+ "and we require 3 since we append \"-[1234]\" to the name to create client"
+ "IDs which are required by the EPP XML schema to be between 3-16 chars.",
required = true
)
names = {"-r", "--registrar"},
description = "The registrar client ID, consisting of 3-14 lowercase letters and numbers.",
required = true)
private String registrar;
@Parameter(
names = {"-w", "--ip_whitelist"},
description = "comma separated list of IP addreses or CIDR ranges",
required = true
)
names = {"-w", "--ip_whitelist"},
description = "Comma-separated list of IP addreses or CIDR ranges.",
required = true)
private List<String> ipWhitelist = new ArrayList<>();
@Parameter(
names = {"--email"},
description =
"the registrar's account to use for console access. "
"The registrar's account to use for console access. "
+ "Must be on the registry's G Suite domain.",
required = true)
private String email;
@Parameter(
names = {"-c", "--certfile"},
description = "full path to cert file in PEM format (best if on local storage)",
validateWith = PathParameter.InputFile.class
)
names = {"-c", "--certfile"},
description = "Full path to cert file in PEM format (best if on local storage).",
validateWith = PathParameter.InputFile.class)
private Path certFile;
@Parameter(
names = {"-h", "--certhash"},
description =
"Hash of client certificate (SHA256 base64 no padding). Do not use this unless "
+ "you want to store ONLY the hash and not the full certificate"
)
names = {"-h", "--certhash"},
description =
"Hash of client certificate (SHA256 base64 no padding). Do not use this unless "
+ "you want to store ONLY the hash and not the full certificate.")
private String certHash;
@Parameter(
names = {"--overwrite"},
description = "whether to replace existing entities if we encounter any, instead of failing"
)
names = {"--overwrite"},
description = "Whether to replace existing entities if we encounter any, instead of failing.")
private boolean overwrite = false;
@Inject