bb0ded
From b016683552a58f9cc2a05cf628cc467234eaf599 Mon Sep 17 00:00:00 2001
bb0ded
From: Alexander Bokovoy <abokovoy@redhat.com>
bb0ded
Date: Mon, 28 Feb 2022 11:10:49 +0200
bb0ded
Subject: [PATCH] tests: ensure AD-SUPPORT subpolicy is active
bb0ded
bb0ded
Use AD-SUPPORT subpolicy when testing trust to Active Directory in FIPS
bb0ded
mode. This is required in FIPS mode due to AD not supporting Kerberos
bb0ded
AES-bases encryption types using FIPS-compliant PBKDF2 and KDF, as
bb0ded
defined in RFC 8009.
bb0ded
bb0ded
Fixes: https://pagure.io/freeipa/issue/9119
bb0ded
bb0ded
Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
bb0ded
Reviewed-By: Julien Rische <jrische@redhat.com>
bb0ded
Reviewed-By: Francisco Trivino <ftrivino@redhat.com>
bb0ded
---
bb0ded
 ipatests/pytest_ipa/integration/fips.py  | 6 ++++++
bb0ded
 ipatests/pytest_ipa/integration/tasks.py | 3 +++
bb0ded
 2 files changed, 9 insertions(+)
bb0ded
bb0ded
diff --git a/ipatests/pytest_ipa/integration/fips.py b/ipatests/pytest_ipa/integration/fips.py
bb0ded
index 694ec8a9927da917fe99482094f68540a1032c14..b33aa91b14552d6f47191c913db4f974a5a5948c 100644
bb0ded
--- a/ipatests/pytest_ipa/integration/fips.py
bb0ded
+++ b/ipatests/pytest_ipa/integration/fips.py
bb0ded
@@ -68,3 +68,9 @@ def disable_userspace_fips(host):
bb0ded
     # sanity check
bb0ded
     assert not is_fips_enabled(host)
bb0ded
     host.run_command(["openssl", "md5", "/dev/null"])
bb0ded
+
bb0ded
+
bb0ded
+def enable_crypto_subpolicy(host, subpolicy):
bb0ded
+    result = host.run_command(["update-crypto-policies", "--show"])
bb0ded
+    policy = result.stdin_text.strip() + ":" + subpolicy
bb0ded
+    host.run_command(["update-crypto-policies", "--set", policy])
bb0ded
diff --git a/ipatests/pytest_ipa/integration/tasks.py b/ipatests/pytest_ipa/integration/tasks.py
bb0ded
index 7e1b7c24dab00986ff6e75430bf55e55dd1a6b8e..13d84e23fa7dc8a5e562e8498c9142e2bcad696a 100755
bb0ded
--- a/ipatests/pytest_ipa/integration/tasks.py
bb0ded
+++ b/ipatests/pytest_ipa/integration/tasks.py
bb0ded
@@ -66,6 +66,7 @@ from .env_config import env_to_script
bb0ded
 from .host import Host
bb0ded
 from .firewall import Firewall
bb0ded
 from .resolver import ResolvedResolver
bb0ded
+from .fips import is_fips_enabled, enable_crypto_subpolicy
bb0ded
 
bb0ded
 logger = logging.getLogger(__name__)
bb0ded
 
bb0ded
@@ -362,6 +363,8 @@ def install_master(host, setup_dns=True, setup_kra=False, setup_adtrust=False,
bb0ded
     if setup_adtrust:
bb0ded
         args.append('--setup-adtrust')
bb0ded
         fw_services.append("freeipa-trust")
bb0ded
+        if is_fips_enabled(host):
bb0ded
+            enable_crypto_subpolicy(host, "AD-SUPPORT")
bb0ded
     if external_ca:
bb0ded
         args.append('--external-ca')
bb0ded
 
bb0ded
-- 
bb0ded
2.34.1
bb0ded