Fix Windows webroot crash when multiple domains have the same webroot (#9108)

* Certificate issuing on Window while having web.confing and more then one domain in request

* add a test

* update changelog

Co-authored-by: Serghei Trufkin <Serghei.Trufkin@Technosoft.md>
This commit is contained in:
alexzorin
2021-11-22 19:00:55 +01:00
committed by GitHub
co-authored by Serghei Trufkin
parent d2578e05e7
commit 6766786049
3 changed files with 19 additions and 1 deletions
+16
View File
@@ -115,6 +115,22 @@ class AuthenticatorTest(unittest.TestCase):
from certbot._internal.plugins.webroot import _WEB_CONFIG_SHA256SUMS
self.assertTrue(webconfig_hash not in _WEB_CONFIG_SHA256SUMS)
@unittest.skipIf(filesystem.POSIX_MODE, reason='Test specific to Windows')
def test_foreign_webconfig_multiple_domains(self):
# Covers bug https://github.com/certbot/certbot/issues/9091
achall_2 = achallenges.KeyAuthorizationAnnotatedChallenge(
challb=acme_util.chall_to_challb(challenges.HTTP01(token=b"bingo"), "pending"),
domain="second-thing.com", account_key=KEY)
self.config.webroot_map["second-thing.com"] = self.path
challenge_path = os.path.join(self.path, ".well-known", "acme-challenge")
filesystem.makedirs(challenge_path)
webconfig_path = os.path.join(challenge_path, "web.config")
with open(webconfig_path, "w") as file:
file.write("something")
self.auth.perform([self.achall, achall_2])
@test_util.patch_display_util()
def test_webroot_from_list_help_and_cancel(self, mock_get_utility):
self.config.webroot_path = []