authority.v2: Guess directory data if retrieval fails

This commit is contained in:
Kishi85 2019-03-22 12:12:16 +01:00
parent 53f61f19d1
commit d62afac9d6
1 changed files with 9 additions and 1 deletions

View File

@ -44,7 +44,15 @@ class ACMEAuthority(AbstractACMEAuthority):
self.contact = ["mailto:{}".format(contact_email)]
# Initialize runtime vars
_, self.directory, _ = self._request_url(self.ca + '/directory')
code, self.directory, _ = self._request_url(self.ca + '/directory')
if code >= 400 or not self.directory:
self.directory = {
"meta": {},
"newAccount": "{}/acme/new-acct".format(self.ca),
"newNonce": "{}/acme/new-nonce".format(self.ca),
"newOrder": "{}/acme/new-order".format(self.ca),
}
print("API directory retrieval failed ({}). Guessed necessary values: {}".format(code, self.directory))
self._request_endpoint('newNonce') # cache the first nonce
# @todo: Add support for key-types other than RSA