mirror of
https://github.com/certbot/certbot.git
synced 2026-08-01 19:02:52 +02:00
patch auth_handler cleanup function
This commit is contained in:
@@ -123,7 +123,12 @@ class AuthHandler(object): # pylint: disable=too-many-instance-attributes
|
|||||||
self._cleanup_challenges(domain)
|
self._cleanup_challenges(domain)
|
||||||
|
|
||||||
def _satisfy_challenges(self):
|
def _satisfy_challenges(self):
|
||||||
"""Attempt to satisfy all saved challenge messages."""
|
"""Attempt to satisfy all saved challenge messages.
|
||||||
|
|
||||||
|
.. todo:: It might be worth it to try different challenges to
|
||||||
|
find one that doesn't throw an exception
|
||||||
|
|
||||||
|
"""
|
||||||
logging.info("Performing the following challenges:")
|
logging.info("Performing the following challenges:")
|
||||||
for dom in self.domains:
|
for dom in self.domains:
|
||||||
self.paths[dom] = gen_challenge_path(
|
self.paths[dom] = gen_challenge_path(
|
||||||
@@ -143,8 +148,19 @@ class AuthHandler(object): # pylint: disable=too-many-instance-attributes
|
|||||||
flat_client.extend(ichall.chall for ichall in self.client_c[dom])
|
flat_client.extend(ichall.chall for ichall in self.client_c[dom])
|
||||||
flat_auth.extend(ichall.chall for ichall in self.dv_c[dom])
|
flat_auth.extend(ichall.chall for ichall in self.dv_c[dom])
|
||||||
|
|
||||||
client_resp = self.client_auth.perform(flat_client)
|
try:
|
||||||
dv_resp = self.dv_auth.perform(flat_auth)
|
client_resp = self.client_auth.perform(flat_client)
|
||||||
|
dv_resp = self.dv_auth.perform(flat_auth)
|
||||||
|
# This will catch both specific types of errors.
|
||||||
|
except errors.LetsEncryptAuthHandlerError as err:
|
||||||
|
logging.critical("Failure in setting up challenges:")
|
||||||
|
logging.critical(str(err))
|
||||||
|
logging.info("Attempting to clean up outstanding challenges...")
|
||||||
|
for dom in self.domains:
|
||||||
|
self._cleanup_challenges(dom)
|
||||||
|
|
||||||
|
raise errors.LetsEncryptAuthHandlerError(
|
||||||
|
"Unable to perform challenges")
|
||||||
|
|
||||||
logging.info("Ready for verification...")
|
logging.info("Ready for verification...")
|
||||||
|
|
||||||
@@ -191,8 +207,10 @@ class AuthHandler(object): # pylint: disable=too-many-instance-attributes
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
logging.info("Cleaning up challenges for %s", domain)
|
logging.info("Cleaning up challenges for %s", domain)
|
||||||
self.dv_auth.cleanup(self.dv_c[domain])
|
# These are indexed challenges... give just the challenges to the auth
|
||||||
self.client_auth.cleanup(self.client_c[domain])
|
self.dv_auth.cleanup(ichall.chall for ichall in self.dv_c[domain])
|
||||||
|
self.client_auth.cleanup(
|
||||||
|
ichall.chall for ichall in self.client_c[domain])
|
||||||
|
|
||||||
def _cleanup_state(self, delete_list):
|
def _cleanup_state(self, delete_list):
|
||||||
"""Cleanup state after an authorization is received.
|
"""Cleanup state after an authorization is received.
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class LetsEncryptReverterError(LetsEncryptClientError):
|
|||||||
"""Let's Encrypt Reverter error."""
|
"""Let's Encrypt Reverter error."""
|
||||||
|
|
||||||
|
|
||||||
|
# Auth Handler Errors
|
||||||
class LetsEncryptAuthHandlerError(LetsEncryptClientError):
|
class LetsEncryptAuthHandlerError(LetsEncryptClientError):
|
||||||
"""Let's Encrypt Auth Handler error."""
|
"""Let's Encrypt Auth Handler error."""
|
||||||
|
|
||||||
@@ -17,6 +18,16 @@ class LetsEncryptClientAuthError(LetsEncryptAuthHandlerError):
|
|||||||
"""Let's Encrypt Client Authenticator error."""
|
"""Let's Encrypt Client Authenticator error."""
|
||||||
|
|
||||||
|
|
||||||
|
class LetsEncryptDvAuthError(LetsEncryptAuthHandlerError):
|
||||||
|
"""Let's Encrypt DV Authenticator error."""
|
||||||
|
|
||||||
|
|
||||||
|
# Authenticator - Challenge specific errors
|
||||||
|
class LetsEncryptDvsniError(LetsEncryptDvAuthError):
|
||||||
|
"""Let's Encrypt DVSNI error."""
|
||||||
|
|
||||||
|
|
||||||
|
# Configurator Errors
|
||||||
class LetsEncryptConfiguratorError(LetsEncryptClientError):
|
class LetsEncryptConfiguratorError(LetsEncryptClientError):
|
||||||
"""Let's Encrypt Configurator error."""
|
"""Let's Encrypt Configurator error."""
|
||||||
|
|
||||||
@@ -28,6 +39,3 @@ class LetsEncryptNoInstallationError(LetsEncryptConfiguratorError):
|
|||||||
class LetsEncryptMisconfigurationError(LetsEncryptConfiguratorError):
|
class LetsEncryptMisconfigurationError(LetsEncryptConfiguratorError):
|
||||||
"""Let's Encrypt Misconfiguration error."""
|
"""Let's Encrypt Misconfiguration error."""
|
||||||
|
|
||||||
|
|
||||||
class LetsEncryptDvsniError(LetsEncryptConfiguratorError):
|
|
||||||
"""Let's Encrypt DVSNI error."""
|
|
||||||
|
|||||||
Reference in New Issue
Block a user