Blame SOURCES/0003-Custodia-use-a-stronger-encryption-algo-when-exporting-keys_rhbz#2032806.patch

d8cf22
From 653a7fe02880c168755984133ee143567cc7bb4e Mon Sep 17 00:00:00 2001
d8cf22
From: Francisco Trivino <ftrivino@redhat.com>
a47729
Date: Wed, 26 Jan 2022 15:43:39 +0100
a47729
Subject: [PATCH] Custodia: use a stronger encryption algo when exporting keys
d8cf22
d8cf22
The Custodia key export handler is using the default's OpenSSL encryption
d8cf22
scheme for PKCS#12.
d8cf22
d8cf22
This represents an issue when performing a migration from CentOS Stream 8 (C8S)
d8cf22
to CentOS Steam 9 (C9S) where the Custodia client running in the new C9S
d8cf22
replica talks to the Custodia server on C8S source server. The later creates an
d8cf22
encrypted PKCS#12 file that contains the cert and the key using the OpenSSL's
d8cf22
default encryption scheme, which is no longer supported on C9S.
d8cf22
d8cf22
This commit enforces a stronger encryption algorigthm by adding following
d8cf22
arguments to the Custodia server handler:
d8cf22
d8cf22
-keypbe AES-256-CBC -certpbe AES-256-CBC -macalg sha384
d8cf22
d8cf22
The new arguments enforce stronger PBEv2 instead of the insecure PBEv1.
d8cf22
d8cf22
Fixes: https://pagure.io/freeipa/issue/9101
d8cf22
d8cf22
Signed-off-by: Francisco Trivino <ftrivino@redhat.com>
d8cf22
Reviewed-By: Christian Heimes <cheimes@redhat.com>
d8cf22
Reviewed-By: Florence Blanc-Renaud <flo@redhat.com>
d8cf22
---
a47729
 ipaserver/secrets/handlers/pemfile.py | 3 +++
a47729
 1 file changed, 3 insertions(+)
d8cf22
d8cf22
diff --git a/ipaserver/secrets/handlers/pemfile.py b/ipaserver/secrets/handlers/pemfile.py
a47729
index 4e8eff0e3..ad36bd020 100644
d8cf22
--- a/ipaserver/secrets/handlers/pemfile.py
d8cf22
+++ b/ipaserver/secrets/handlers/pemfile.py
d8cf22
@@ -31,6 +31,9 @@ def export_key(args, tmpdir):
d8cf22
         '-out', pk12file,
d8cf22
         '-inkey', args.keyfile,
d8cf22
         '-password', 'file:{pk12pwfile}'.format(pk12pwfile=pk12pwfile),
d8cf22
+        '-keypbe', 'AES-256-CBC',
d8cf22
+        '-certpbe', 'AES-256-CBC',
d8cf22
+        '-macalg', 'sha384',
d8cf22
     ])
d8cf22
 
d8cf22
     with open(pk12file, 'rb') as f:
a47729
-- 
a47729
2.34.1
d8cf22