Blame SOURCES/0013-Vault-fix-interoperability-issues-with-older-RHEL-systems_rhbz#2148255.patch

097621
From c643e56e4c45b7cb61aa53989657143627c23e04 Mon Sep 17 00:00:00 2001
097621
From: Francisco Trivino <ftrivino@redhat.com>
097621
Date: Nov 22 2022 06:56:00 +0000
097621
Subject: Vault: fix interoperability issues with older RHEL systems
097621
097621
097621
AES-128-CBC was recently enabled as default wrapping algorithm for transport of secrets.
097621
This change was done in favor of FIPS as crypto-policies disabled 3DES in RHEL9, but
097621
setting AES as default ended-up breaking backwards compatibility with older RHEL systems.
097621
097621
This commit is tuning some defaults so that interoperability with older RHEL systems
097621
works again. The new logic reflects:
097621
097621
- when an old client is calling a new server, it doesn't send any value for wrapping_algo
097621
  and the old value is used (3DES), so that the client can decrypt using 3DES.
097621
097621
- when a new client is calling a new server, it sends wrapping_algo = AES128_CBC
097621
097621
- when a new client is calling an old server, it doesn't send any value and the default is
097621
  to use 3DES.
097621
097621
Finally, as this logic is able to handle overlapping wrapping algorithm between server and
097621
client, the Option "--wrapping-algo" is hidden from "ipa vault-archive --help" and "ipa
097621
vault-retrieve --help" commands.
097621
097621
Fixes: https://pagure.io/freeipa/issue/9259
097621
Signed-off-by: Francisco Trivino <ftrivino@redhat.com>
097621
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
097621
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
097621
097621
---
097621
097621
diff --git a/API.txt b/API.txt
097621
index 9892211..2bd1cc2 100644
097621
--- a/API.txt
097621
+++ b/API.txt
097621
@@ -6666,7 +6666,7 @@ option: Flag('shared?', autofill=True, default=False)
097621
 option: Str('username?', cli_name='user')
097621
 option: Bytes('vault_data')
097621
 option: Str('version?')
097621
-option: StrEnum('wrapping_algo?', autofill=True, default=u'aes-128-cbc', values=[u'aes-128-cbc', u'des-ede3-cbc'])
097621
+option: StrEnum('wrapping_algo?', autofill=True, default=u'des-ede3-cbc', values=[u'aes-128-cbc', u'des-ede3-cbc'])
097621
 output: Entry('result')
097621
 output: Output('summary', type=[<type 'unicode'>, <type 'NoneType'>])
097621
 output: PrimaryKey('value')
097621
@@ -6766,7 +6766,7 @@ option: Bytes('session_key')
097621
 option: Flag('shared?', autofill=True, default=False)
097621
 option: Str('username?', cli_name='user')
097621
 option: Str('version?')
097621
-option: StrEnum('wrapping_algo?', autofill=True, default=u'aes-128-cbc', values=[u'aes-128-cbc', u'des-ede3-cbc'])
097621
+option: StrEnum('wrapping_algo?', autofill=True, default=u'des-ede3-cbc', values=[u'aes-128-cbc', u'des-ede3-cbc'])
097621
 output: Entry('result')
097621
 output: Output('summary', type=[<type 'unicode'>, <type 'NoneType'>])
097621
 output: PrimaryKey('value')
097621
diff --git a/VERSION.m4 b/VERSION.m4
097621
index 7d60b01..b4b1774 100644
097621
--- a/VERSION.m4
097621
+++ b/VERSION.m4
097621
@@ -86,8 +86,8 @@ define(IPA_DATA_VERSION, 20100614120000)
097621
 #                                                      #
097621
 ########################################################
097621
 define(IPA_API_VERSION_MAJOR, 2)
097621
-# Last change: add graceperiodlimit
097621
-define(IPA_API_VERSION_MINOR, 248)
097621
+# Last change: fix vault interoperability issues.
097621
+define(IPA_API_VERSION_MINOR, 251)
097621
 
097621
 ########################################################
097621
 # Following values are auto-generated from values above
097621
diff --git a/ipaclient/plugins/vault.py b/ipaclient/plugins/vault.py
097621
index 115171c..d4c84eb 100644
097621
--- a/ipaclient/plugins/vault.py
097621
+++ b/ipaclient/plugins/vault.py
097621
@@ -687,7 +687,7 @@ class ModVaultData(Local):
097621
         default_algo = config.get('wrapping_default_algorithm')
097621
         if default_algo is None:
097621
             # old server
097621
-            wrapping_algo = constants.VAULT_WRAPPING_AES128_CBC
097621
+            wrapping_algo = constants.VAULT_WRAPPING_3DES
097621
         elif default_algo in constants.VAULT_WRAPPING_SUPPORTED_ALGOS:
097621
             # try to use server default
097621
             wrapping_algo = default_algo
097621
@@ -801,7 +801,8 @@ class vault_archive(ModVaultData):
097621
             if option.name not in ('nonce',
097621
                                    'session_key',
097621
                                    'vault_data',
097621
-                                   'version'):
097621
+                                   'version',
097621
+                                   'wrapping_algo'):
097621
                 yield option
097621
         for option in super(vault_archive, self).get_options():
097621
             yield option
097621
@@ -1053,7 +1054,7 @@ class vault_retrieve(ModVaultData):
097621
 
097621
     def get_options(self):
097621
         for option in self.api.Command.vault_retrieve_internal.options():
097621
-            if option.name not in ('session_key', 'version'):
097621
+            if option.name not in ('session_key', 'version', 'wrapping_algo'):
097621
                 yield option
097621
         for option in super(vault_retrieve, self).get_options():
097621
             yield option
097621
diff --git a/ipaserver/plugins/vault.py b/ipaserver/plugins/vault.py
097621
index 4d40f66..574c83a 100644
097621
--- a/ipaserver/plugins/vault.py
097621
+++ b/ipaserver/plugins/vault.py
097621
@@ -1051,7 +1051,7 @@ class vault_archive_internal(PKQuery):
097621
             'wrapping_algo?',
097621
             doc=_('Key wrapping algorithm'),
097621
             values=VAULT_WRAPPING_SUPPORTED_ALGOS,
097621
-            default=VAULT_WRAPPING_DEFAULT_ALGO,
097621
+            default=VAULT_WRAPPING_3DES,
097621
             autofill=True,
097621
         ),
097621
     )
097621
@@ -1130,7 +1130,7 @@ class vault_retrieve_internal(PKQuery):
097621
             'wrapping_algo?',
097621
             doc=_('Key wrapping algorithm'),
097621
             values=VAULT_WRAPPING_SUPPORTED_ALGOS,
097621
-            default=VAULT_WRAPPING_DEFAULT_ALGO,
097621
+            default=VAULT_WRAPPING_3DES,
097621
             autofill=True,
097621
         ),
097621
     )