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

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