pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone

Blame SOURCES/0151-certs-do-not-export-keys-world-readable-in-install_k.patch

ac7d03
From 9e724963967a79fd171e79d2353ec7b655f13c47 Mon Sep 17 00:00:00 2001
ac7d03
From: Jan Cholasta <jcholast@redhat.com>
ac7d03
Date: Thu, 11 May 2017 07:00:42 +0000
ac7d03
Subject: [PATCH] certs: do not export keys world-readable in
ac7d03
 install_key_from_p12
ac7d03
ac7d03
Make sure the exported private key files are readable only by the owner.
ac7d03
ac7d03
https://pagure.io/freeipa/issue/6831
ac7d03
ac7d03
Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
ac7d03
Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
ac7d03
---
ac7d03
 ipaserver/install/certs.py | 3 ++-
ac7d03
 1 file changed, 2 insertions(+), 1 deletion(-)
ac7d03
ac7d03
diff --git a/ipaserver/install/certs.py b/ipaserver/install/certs.py
ac7d03
index 17b9ebad4a128e292e453af44ca9d63cfb1e6ea2..06a7e2143964484fa45106ca381043eb440dc5b1 100644
ac7d03
--- a/ipaserver/install/certs.py
ac7d03
+++ b/ipaserver/install/certs.py
ac7d03
@@ -73,7 +73,8 @@ def install_key_from_p12(p12_fname, p12_passwd, pem_fname):
ac7d03
     pwd = ipautil.write_tmp_file(p12_passwd)
ac7d03
     ipautil.run([paths.OPENSSL, "pkcs12", "-nodes", "-nocerts",
ac7d03
                  "-in", p12_fname, "-out", pem_fname,
ac7d03
-                 "-passin", "file:" + pwd.name])
ac7d03
+                 "-passin", "file:" + pwd.name],
ac7d03
+                umask=0o077)
ac7d03
 
ac7d03
 
ac7d03
 def export_pem_p12(pkcs12_fname, pkcs12_pwd_fname, nickname, pem_fname):
ac7d03
-- 
ac7d03
2.9.4
ac7d03