From c57cd239c330a11a3f5d795fb6ac056578813355 Mon Sep 17 00:00:00 2001 From: Jakub Warmuz Date: Fri, 10 Jul 2015 07:25:29 +0000 Subject: [PATCH] Register key creation before writing out. --- letsencrypt/plugins/common.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/letsencrypt/plugins/common.py b/letsencrypt/plugins/common.py index 460af1b15..104e8d9c4 100644 --- a/letsencrypt/plugins/common.py +++ b/letsencrypt/plugins/common.py @@ -168,7 +168,9 @@ class Dvsni(object): # pylint: disable=invalid-name """Generate and write out challenge certificate.""" cert_path = self.get_cert_path(achall) + key_path = self.get_key_path(achall) # Register the path before you write out the file + self.configurator.reverter.register_file_creation(True, key_path) self.configurator.reverter.register_file_creation(True, cert_path) cert_pem, response = achall.gen_cert_and_response(s) @@ -177,14 +179,13 @@ class Dvsni(object): with open(cert_path, "wb") as cert_chall_fd: cert_chall_fd.write(cert_pem) - key_path = self.get_key_path(achall) + # Write out challenge key key_pem = achall.key.key.private_bytes( encoding=serialization.Encoding.PEM, format=serialization.PrivateFormat.TraditionalOpenSSL, encryption_algorithm=serialization.NoEncryption()) with le_util.safe_open(key_path, 'wb', chmod=0o400) as key_file: key_file.write(key_pem) - self.configurator.reverter.register_file_creation(True, key_path) return response