Stop rejecting punycode domain names (#3626)

* Punycode is about to be permitted; stop rejecting it

* Remove spurious bracket

* More brackets rather than fewer!

* Change ops_test's notion of valid domains

* Remove spurious "certonly" from new test

* Make test more localized

* Remove commented-out punycode prohibition
This commit is contained in:
schoen 2016-10-17 19:48:48 -07:00 committed by Brad Warren
parent 91deb6ec53
commit 605a3cc931
3 changed files with 7 additions and 16 deletions

View file

@ -346,11 +346,12 @@ class CLITest(unittest.TestCase): # pylint: disable=too-many-public-methods
except errors.PluginSelectionError as e:
self.assertTrue('The requested bad_auth plugin does not appear' in str(e))
def test_punycode_ok(self):
# Punycode is now legal, so no longer an error; instead check
# that it's _not_ an error (at the initial sanity check stage)
util.enforce_domain_sanity('this.is.xn--ls8h.tld')
def test_check_config_sanity_domain(self):
# Punycode
self.assertRaises(errors.ConfigurationError,
self._call,
['-d', 'this.is.xn--ls8h.tld'])
# FQDN
self.assertRaises(errors.ConfigurationError,
self._call,

View file

@ -244,8 +244,8 @@ class ChooseNamesTest(unittest.TestCase):
all_valid = ["example.com", "second.example.com",
"also.example.com", "under_score.example.com",
"justtld"]
all_invalid = ["xn--ls8h.tld", "*.wildcard.com", "uniçodé.com"]
two_valid = ["example.com", "xn--ls8h.tld", "also.example.com"]
all_invalid = ["öóòps.net", "*.wildcard.com", "uniçodé.com"]
two_valid = ["example.com", "úniçøde.com", "also.example.com"]
self.assertEqual(get_valid_domains(all_valid), all_valid)
self.assertEqual(get_valid_domains(all_invalid), [])
self.assertEqual(len(get_valid_domains(two_valid)), 2)
@ -266,10 +266,6 @@ class ChooseNamesTest(unittest.TestCase):
unicode_error = UnicodeEncodeError('mock', u'', 0, 1, 'mock')
mock_sli.side_effect = unicode_error
self.assertEqual(_choose_names_manually(), [])
# Punycode and no retry
mock_util().input.return_value = (display_util.OK,
"xn--ls8h.tld")
self.assertEqual(_choose_names_manually(), [])
# Valid domains
mock_util().input.return_value = (display_util.OK,
("example.com,"

View file

@ -437,19 +437,13 @@ def enforce_domain_sanity(domain):
"""
if isinstance(domain, six.text_type):
wildcard_marker = u"*."
punycode_marker = u"xn--"
else:
wildcard_marker = b"*."
punycode_marker = b"xn--"
# Check if there's a wildcard domain
if domain.startswith(wildcard_marker):
raise errors.ConfigurationError(
"Wildcard domains are not supported: {0}".format(domain))
# Punycode
if punycode_marker in domain:
raise errors.ConfigurationError(
"Punycode domains are not presently supported: {0}".format(domain))
# Unicode
try: