f65af0
From 609ccb601843b97b25f2fde3c4981839822af503 Mon Sep 17 00:00:00 2001
979ee0
From: Christian Heimes <cheimes@redhat.com>
979ee0
Date: Tue, 17 Jul 2018 08:53:39 +0200
979ee0
Subject: [PATCH] Fix KRA replica installation from CA master
979ee0
979ee0
ipa-replica-install --kra-install can fail when the topology already has
979ee0
a KRA, but replica is installed from a master with just CA. In that
979ee0
case, Custodia may pick a machine that doesn't have the KRA auditing and
979ee0
signing certs in its NSSDB.
979ee0
979ee0
Example:
979ee0
 * master with CA
979ee0
 * replica1 with CA and KRA
979ee0
 * new replica gets installed from master
979ee0
979ee0
The replica installer now always picks a KRA peer.
979ee0
979ee0
The change fixes test scenario TestInstallWithCA1::()::test_replica2_ipa_dns_install
979ee0
979ee0
Fixes: https://pagure.io/freeipa/issue/7518
979ee0
See: https://pagure.io/freeipa/issue/7008
979ee0
Signed-off-by: Christian Heimes <cheimes@redhat.com>
979ee0
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
979ee0
---
979ee0
 ipaserver/install/server/replicainstall.py | 5 ++++-
979ee0
 1 file changed, 4 insertions(+), 1 deletion(-)
979ee0
979ee0
diff --git a/ipaserver/install/server/replicainstall.py b/ipaserver/install/server/replicainstall.py
f65af0
index 8826da232a90380084b0e4f3dca783125a5500da..e78a2b992fbd44b8ee3ccd8183ebd6e13dfd1749 100644
979ee0
--- a/ipaserver/install/server/replicainstall.py
979ee0
+++ b/ipaserver/install/server/replicainstall.py
f65af0
@@ -1486,7 +1486,10 @@ def install(installer):
979ee0
     otpd.create_instance('OTPD', config.host_name,
979ee0
                          ipautil.realm_to_suffix(config.realm_name))
979ee0
 
979ee0
-    if ca_enabled:
979ee0
+    if kra_enabled:
979ee0
+        # A KRA peer always provides a CA, too.
979ee0
+        mode = custodiainstance.CustodiaModes.KRA_PEER
979ee0
+    elif ca_enabled:
979ee0
         mode = custodiainstance.CustodiaModes.CA_PEER
979ee0
     else:
979ee0
         mode = custodiainstance.CustodiaModes.MASTER_PEER
979ee0
-- 
979ee0
2.17.1
979ee0