mirror of
https://github.com/certbot/certbot.git
synced 2026-08-01 19:02:52 +02:00
Remove acme-challenge after cleaning up all challenges
This commit is contained in:
@@ -2,8 +2,10 @@
|
|||||||
import errno
|
import errno
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
from collections import defaultdict
|
||||||
|
|
||||||
import zope.interface
|
import zope.interface
|
||||||
|
import six
|
||||||
|
|
||||||
from acme import challenges
|
from acme import challenges
|
||||||
|
|
||||||
@@ -44,6 +46,7 @@ to serve all files under specified web root ({0})."""
|
|||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(Authenticator, self).__init__(*args, **kwargs)
|
super(Authenticator, self).__init__(*args, **kwargs)
|
||||||
self.full_roots = {}
|
self.full_roots = {}
|
||||||
|
self.performed = defaultdict(set)
|
||||||
|
|
||||||
def prepare(self): # pylint: disable=missing-docstring
|
def prepare(self): # pylint: disable=missing-docstring
|
||||||
path_map = self.conf("map")
|
path_map = self.conf("map")
|
||||||
@@ -127,6 +130,8 @@ to serve all files under specified web root ({0})."""
|
|||||||
finally:
|
finally:
|
||||||
os.umask(old_umask)
|
os.umask(old_umask)
|
||||||
|
|
||||||
|
self.performed[root_path].add(achall)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def cleanup(self, achalls): # pylint: disable=missing-docstring
|
def cleanup(self, achalls): # pylint: disable=missing-docstring
|
||||||
@@ -135,3 +140,10 @@ to serve all files under specified web root ({0})."""
|
|||||||
validation_path = self._get_validation_path(root_path, achall)
|
validation_path = self._get_validation_path(root_path, achall)
|
||||||
logger.debug("Removing %s", validation_path)
|
logger.debug("Removing %s", validation_path)
|
||||||
os.remove(validation_path)
|
os.remove(validation_path)
|
||||||
|
self.performed[root_path].remove(achall)
|
||||||
|
|
||||||
|
for root_path, achalls in six.iteritems(self.performed):
|
||||||
|
if not achalls:
|
||||||
|
logger.debug("All challenges cleaned up, removing %s",
|
||||||
|
root_path)
|
||||||
|
os.rmdir(root_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user