mirror of
https://github.com/certbot/certbot.git
synced 2026-08-02 19:22:16 +02:00
Protect opened files against IO-exceptions
This commit is contained in:
@@ -313,8 +313,8 @@ class NginxConfigurator(common.Plugin):
|
|||||||
cert_pem = OpenSSL.crypto.dump_certificate(
|
cert_pem = OpenSSL.crypto.dump_certificate(
|
||||||
OpenSSL.crypto.FILETYPE_PEM, cert)
|
OpenSSL.crypto.FILETYPE_PEM, cert)
|
||||||
cert_file, cert_path = le_util.unique_file(os.path.join(tmp_dir, "cert.pem"))
|
cert_file, cert_path = le_util.unique_file(os.path.join(tmp_dir, "cert.pem"))
|
||||||
cert_file.write(cert_pem)
|
with cert_file:
|
||||||
cert_file.close()
|
cert_file.write(cert_pem)
|
||||||
return cert_path, le_key.file
|
return cert_path, le_key.file
|
||||||
|
|
||||||
def _make_server_ssl(self, vhost):
|
def _make_server_ssl(self, vhost):
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ def init_save_key(key_size, key_dir, keyname="key-letsencrypt.pem"):
|
|||||||
config.strict_permissions)
|
config.strict_permissions)
|
||||||
key_f, key_path = le_util.unique_file(
|
key_f, key_path = le_util.unique_file(
|
||||||
os.path.join(key_dir, keyname), 0o600)
|
os.path.join(key_dir, keyname), 0o600)
|
||||||
key_f.write(key_pem)
|
with key_f:
|
||||||
key_f.close()
|
key_f.write(key_pem)
|
||||||
|
|
||||||
logger.info("Generating key (%d bits): %s", key_size, key_path)
|
logger.info("Generating key (%d bits): %s", key_size, key_path)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user