acme_certificate: be nicer to non-compliant CAs (#832)

* Be nicer to non-compliant CAs.

* Mark as a feature, not a bugfix.
This commit is contained in:
Felix Fontein
2024-12-30 11:30:33 +01:00
committed by GitHub
parent db04914ab6
commit 0d4b16aadb
2 changed files with 9 additions and 1 deletions

View File

@@ -141,7 +141,12 @@ class Authorization(object):
def _setup(self, client, data):
data['uri'] = self.url
self.data = data
self.challenges = [Challenge.from_json(client, challenge) for challenge in data['challenges']]
# While 'challenges' is a required field, apparently not every CA cares
# (https://github.com/ansible-collections/community.crypto/issues/824)
if data.get('challenges'):
self.challenges = [Challenge.from_json(client, challenge) for challenge in data['challenges']]
else:
self.challenges = []
if client.version == 1 and 'status' not in data:
# https://tools.ietf.org/html/draft-ietf-acme-acme-02#section-6.1.2
# "status (required, string): ...