diff options
author | kaiyou <pierre@jaury.eu> | 2016-11-08 01:22:20 +0300 |
---|---|---|
committer | Peter Eckersley <pde@users.noreply.github.com> | 2016-11-08 01:22:20 +0300 |
commit | 82c69815d11a0c947b16be05ff1208363a09b110 (patch) | |
tree | 27e561d36a4d206ffb953c6a0891007611a6f71d /certbot-nginx | |
parent | 549f0eccf90d71a5a0bc93ce1a01281ad10ace05 (diff) |
Fix writing pem files with Python3 (#3757)
* Standardize arguments name for mode and chmod in the util API
* Handle OpenSSL pem as bytes objects only for Python3 compatibility
* Handle OpenSSL pem as bytes objects only (remaining bits)
* Manipulate bytes objects only when testing PEM-related functions
* Fix argument order when calling util.unique_file
Diffstat (limited to 'certbot-nginx')
-rw-r--r-- | certbot-nginx/certbot_nginx/configurator.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/certbot-nginx/certbot_nginx/configurator.py b/certbot-nginx/certbot_nginx/configurator.py index bfc7b6a67..503599423 100644 --- a/certbot-nginx/certbot_nginx/configurator.py +++ b/certbot-nginx/certbot_nginx/configurator.py @@ -405,7 +405,8 @@ class NginxConfigurator(common.Plugin): cert = acme_crypto_util.gen_ss_cert(key, domains=[socket.gethostname()]) cert_pem = OpenSSL.crypto.dump_certificate( OpenSSL.crypto.FILETYPE_PEM, cert) - cert_file, cert_path = util.unique_file(os.path.join(tmp_dir, "cert.pem")) + cert_file, cert_path = util.unique_file( + os.path.join(tmp_dir, "cert.pem"), mode="wb") with cert_file: cert_file.write(cert_pem) return cert_path, le_key.file |