mirror of
https://github.com/certbot/certbot.git
synced 2026-07-30 16:14:44 +02:00
Make final tweaks for landing #1421
This commit is contained in:
+1
-2
@@ -107,7 +107,7 @@ def _find_domains(args, installer):
|
|||||||
|
|
||||||
if not domains:
|
if not domains:
|
||||||
raise errors.Error("Please specify --domains, or --installer that "
|
raise errors.Error("Please specify --domains, or --installer that "
|
||||||
"will help in domain names autodiscovery")
|
"will help in domain names autodiscovery")
|
||||||
|
|
||||||
return domains
|
return domains
|
||||||
|
|
||||||
@@ -1085,7 +1085,6 @@ def main(cli_args=sys.argv[1:]):
|
|||||||
# note: arg parser internally handles --help (and exits afterwards)
|
# note: arg parser internally handles --help (and exits afterwards)
|
||||||
plugins = plugins_disco.PluginsRegistry.find_all()
|
plugins = plugins_disco.PluginsRegistry.find_all()
|
||||||
args = prepare_and_parse_args(plugins, cli_args)
|
args = prepare_and_parse_args(plugins, cli_args)
|
||||||
# Check command line parameters sanity, and error out in case of problem.
|
|
||||||
config = configuration.NamespaceConfig(args)
|
config = configuration.NamespaceConfig(args)
|
||||||
zope.component.provideUtility(config)
|
zope.component.provideUtility(config)
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ class NamespaceConfig(object):
|
|||||||
|
|
||||||
def __init__(self, namespace):
|
def __init__(self, namespace):
|
||||||
self.namespace = namespace
|
self.namespace = namespace
|
||||||
|
# Check command line parameters sanity, and error out in case of problem.
|
||||||
check_config_sanity(self)
|
check_config_sanity(self)
|
||||||
|
|
||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
@@ -120,7 +121,7 @@ def check_config_sanity(config):
|
|||||||
"""
|
"""
|
||||||
# Port check
|
# Port check
|
||||||
if config.http01_port == config.tls_sni_01_port:
|
if config.http01_port == config.tls_sni_01_port:
|
||||||
raise errors.Error(
|
raise errors.ConfigurationError(
|
||||||
"Trying to run http-01 and tls-sni-01 "
|
"Trying to run http-01 and tls-sni-01 "
|
||||||
"on the same port ({0})".format(config.tls_sni_01_port))
|
"on the same port ({0})".format(config.tls_sni_01_port))
|
||||||
|
|
||||||
@@ -134,7 +135,9 @@ def _check_config_domain_sanity(domains):
|
|||||||
domain flag values and errors out if the requirements are not met.
|
domain flag values and errors out if the requirements are not met.
|
||||||
|
|
||||||
:param domains: List of domains
|
:param domains: List of domains
|
||||||
:type args: `list` of `string`
|
:type domains: `list` of `string`
|
||||||
|
:raises ConfigurationError: for invalid domains and cases where Let's
|
||||||
|
Encrypt currently will not issue certificates
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# Check if there's a wildcard domain
|
# Check if there's a wildcard domain
|
||||||
@@ -145,8 +148,10 @@ def _check_config_domain_sanity(domains):
|
|||||||
if any("xn--" in d for d in domains):
|
if any("xn--" in d for d in domains):
|
||||||
raise errors.ConfigurationError(
|
raise errors.ConfigurationError(
|
||||||
"Punycode domains are not supported")
|
"Punycode domains are not supported")
|
||||||
# FQDN, checks:
|
# FQDN checks from
|
||||||
|
# http://www.mkyong.com/regular-expressions/domain-name-regular-expression-example/
|
||||||
# Characters used, domain parts < 63 chars, tld > 1 < 7 chars
|
# Characters used, domain parts < 63 chars, tld > 1 < 7 chars
|
||||||
|
# first and last char is not "-"
|
||||||
fqdn = re.compile("^((?!-)[A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{2,6}$")
|
fqdn = re.compile("^((?!-)[A-Za-z0-9-]{1,63}(?<!-)\\.)+[A-Za-z]{2,6}$")
|
||||||
if any(True for d in domains if not fqdn.match(d)):
|
if any(True for d in domains if not fqdn.match(d)):
|
||||||
raise errors.ConfigurationError("Requested domain is not FQDN")
|
raise errors.ConfigurationError("Requested domain is not a FQDN")
|
||||||
|
|||||||
@@ -95,5 +95,6 @@ class StandaloneBindError(Error):
|
|||||||
self.socket_error = socket_error
|
self.socket_error = socket_error
|
||||||
self.port = port
|
self.port = port
|
||||||
|
|
||||||
|
|
||||||
class ConfigurationError(Error):
|
class ConfigurationError(Error):
|
||||||
"""Configuration sanity error."""
|
"""Configuration sanity error."""
|
||||||
|
|||||||
Reference in New Issue
Block a user