diff --git a/AUTHORS.md b/AUTHORS.md index bef1f4529..539eed4a4 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -221,6 +221,7 @@ Authors * [Piotr Kasprzyk](https://github.com/kwadrat) * [Prayag Verma](https://github.com/pra85) * [Preston Locke](https://github.com/Preston12321) +* [Q Misell][https://magicalcodewit.ch] * [Rasesh Patel](https://github.com/raspat1) * [Reinaldo de Souza Jr](https://github.com/juniorz) * [Remi Rampin](https://github.com/remram44) diff --git a/certbot/CHANGELOG.md b/certbot/CHANGELOG.md index b2f1743a3..3496e84d2 100644 --- a/certbot/CHANGELOG.md +++ b/certbot/CHANGELOG.md @@ -9,7 +9,7 @@ Certbot adheres to [Semantic Versioning](https://semver.org/). * `--dns-google-project` optionally allows for specifying the project that the DNS zone(s) reside in, which allows for Certbot usage in scenarios where the auth credentials reside in a different project to the zone(s) that are being managed. -* +* There is now a new `Other` annotated challenge object to allow plugins to support entirely novel challenges. ### Changed diff --git a/certbot/certbot/_internal/auth_handler.py b/certbot/certbot/_internal/auth_handler.py index 747520a7d..de41f7e4d 100644 --- a/certbot/certbot/_internal/auth_handler.py +++ b/certbot/certbot/_internal/auth_handler.py @@ -384,7 +384,8 @@ def challb_to_achall(challb: messages.ChallengeBody, account_key: josepy.JWK, challb=challb, domain=domain, account_key=account_key) elif isinstance(chall, challenges.DNS): return achallenges.DNS(challb=challb, domain=domain) - raise errors.Error(f"Received unsupported challenge of type: {chall.typ}") + else: + return achallenges.Other(challb=challb, domain=domain) def gen_challenge_path(challbs: List[messages.ChallengeBody], diff --git a/certbot/certbot/_internal/tests/auth_handler_test.py b/certbot/certbot/_internal/tests/auth_handler_test.py index 59cb66c38..0a61c8e8e 100644 --- a/certbot/certbot/_internal/tests/auth_handler_test.py +++ b/certbot/certbot/_internal/tests/auth_handler_test.py @@ -46,12 +46,12 @@ class ChallengeFactoryTest(unittest.TestCase): def test_unrecognized(self): authzr = acme_util.gen_authzr( - messages.STATUS_PENDING, "test", - [mock.Mock(chall="chall", typ="unrecognized")], - [messages.STATUS_PENDING]) + messages.STATUS_PENDING, "test", + [mock.Mock(chall="chall", typ="unrecognized")], + [messages.STATUS_PENDING]) - with pytest.raises(errors.Error): - self.handler._challenge_factory(authzr, [0]) + achalls = self.handler._challenge_factory(authzr, [0]) + assert type(achalls[0]) == achallenges.Other class HandleAuthorizationsTest(unittest.TestCase): diff --git a/certbot/certbot/achallenges.py b/certbot/certbot/achallenges.py index 081fa1c46..fb2deaa70 100644 --- a/certbot/certbot/achallenges.py +++ b/certbot/certbot/achallenges.py @@ -59,3 +59,9 @@ class DNS(AnnotatedChallenge): """Client annotated "dns" ACME challenge.""" __slots__ = ('challb', 'domain') # pylint: disable=redefined-slots-in-subclass acme_type = challenges.DNS + + +class Other(AnnotatedChallenge): + """Client annotated ACME challenge of an unknown type.""" + __slots__ = ('challb', 'domain') # pylint: disable=redefined-slots-in-subclass + acme_type = challenges.Challenge