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

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