Remove unnecessary token from delete_acme_token
This commit is contained in:
parent
7b1beb62b6
commit
5cdd88e033
|
@ -82,7 +82,7 @@ class AcmeHttpChallenge(AcmeChallenge):
|
||||||
orderr = acme_client.new_order(csr)
|
orderr = acme_client.new_order(csr)
|
||||||
|
|
||||||
chall = []
|
chall = []
|
||||||
validations = {}
|
deployed_challenges = []
|
||||||
all_pre_validated = True
|
all_pre_validated = True
|
||||||
for authz in orderr.authorizations:
|
for authz in orderr.authorizations:
|
||||||
# Choosing challenge.
|
# Choosing challenge.
|
||||||
|
@ -110,8 +110,8 @@ class AcmeHttpChallenge(AcmeChallenge):
|
||||||
|
|
||||||
for challenge in chall:
|
for challenge in chall:
|
||||||
try:
|
try:
|
||||||
response, validation = self.deploy(challenge, acme_client, validation_target)
|
response = self.deploy(challenge, acme_client, validation_target)
|
||||||
validations[challenge.chall.path] = validation
|
deployed_challenges.append(challenge.chall.path)
|
||||||
acme_client.answer_challenge(challenge, response)
|
acme_client.answer_challenge(challenge, response)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
current_app.logger.error(e)
|
current_app.logger.error(e)
|
||||||
|
@ -145,9 +145,9 @@ class AcmeHttpChallenge(AcmeChallenge):
|
||||||
else:
|
else:
|
||||||
pem_certificate_chain = finalized_orderr.fullchain_pem[len(pem_certificate):].lstrip()
|
pem_certificate_chain = finalized_orderr.fullchain_pem[len(pem_certificate):].lstrip()
|
||||||
|
|
||||||
if len(validations) != 0:
|
if len(deployed_challenges) != 0:
|
||||||
for token_path, token in validations.items():
|
for token_path in deployed_challenges:
|
||||||
self.cleanup(token_path, token, validation_target)
|
self.cleanup(token_path, validation_target)
|
||||||
|
|
||||||
# validation is a random string, we use it as external id, to make it possible to implement revoke_certificate
|
# validation is a random string, we use it as external id, to make it possible to implement revoke_certificate
|
||||||
return pem_certificate, pem_certificate_chain, None
|
return pem_certificate, pem_certificate_chain, None
|
||||||
|
@ -172,9 +172,9 @@ class AcmeHttpChallenge(AcmeChallenge):
|
||||||
destination_plugin.upload_acme_token(challenge.chall.path, validation, destination.options)
|
destination_plugin.upload_acme_token(challenge.chall.path, validation, destination.options)
|
||||||
current_app.logger.info("Uploaded HTTP-01 challenge token.")
|
current_app.logger.info("Uploaded HTTP-01 challenge token.")
|
||||||
|
|
||||||
return response, validation
|
return response
|
||||||
|
|
||||||
def cleanup(self, token_path, token, validation_target):
|
def cleanup(self, token_path, validation_target):
|
||||||
destination = destination_service.get(validation_target)
|
destination = destination_service.get(validation_target)
|
||||||
|
|
||||||
if destination is None:
|
if destination is None:
|
||||||
|
@ -183,7 +183,7 @@ class AcmeHttpChallenge(AcmeChallenge):
|
||||||
|
|
||||||
destination_plugin = plugins.get(destination.plugin_name)
|
destination_plugin = plugins.get(destination.plugin_name)
|
||||||
|
|
||||||
destination_plugin.delete_acme_token(token_path, token, destination.options)
|
destination_plugin.delete_acme_token(token_path, destination.options)
|
||||||
current_app.logger.info("Cleaned up HTTP-01 challenge token.")
|
current_app.logger.info("Cleaned up HTTP-01 challenge token.")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -135,13 +135,13 @@ class SFTPDestinationPlugin(DestinationPlugin):
|
||||||
self.upload_file(dst_path, files, options)
|
self.upload_file(dst_path, files, options)
|
||||||
|
|
||||||
# this is called from the acme http challenge
|
# this is called from the acme http challenge
|
||||||
def delete_acme_token(self, token_path, token, options, **kwargs):
|
def delete_acme_token(self, token_path, options, **kwargs):
|
||||||
dst_path = self.get_option("destinationPath", options)
|
dst_path = self.get_option("destinationPath", options)
|
||||||
|
|
||||||
_, filename = path.split(token_path)
|
_, filename = path.split(token_path)
|
||||||
|
|
||||||
# prepare files for upload
|
# prepare files for upload
|
||||||
files = {filename: token}
|
files = {filename: None}
|
||||||
|
|
||||||
self.delete_file(dst_path, files, options)
|
self.delete_file(dst_path, files, options)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue