.Installing KRA fails if all KRA members are hidden replicas
The `ipa-kra-install` utility fails on a cluster where the Key Recovery Authority (KRA) is already present, if the first KRA instance is installed on a hidden replica. Consequently, you cannot add further KRA instances to the cluster.
To work around this problem, unhide the hidden replica that has the KRA role before you add new KRA instances. You can hide it again when `ipa-kra-install` completes successfully.
This bug is created as a clone of upstream ticket:
https://pagure.io/freeipa/issue/8240
### Issue
ipa-kra-install fails on a cluster with KRA already installed if all the KRA-enabled replica are hidden.
#### Steps to Reproduce
1. install master (DNS, CA)
2. install replica0 (DNS, CA) as hidden
3. install KRA on replica0 (so: on the hidden replica)
4. install KRA on master
#### Actual behavior
Lookup failed: Preferred host master.ipa.test does not provide KRA.
Failed to find an active KRA server!
#### Expected behavior
KRA successfully installed.
#### Version/Release/Distribution
Any up to at least 2020-3-24 IPA from git master.
#### Additional info:
- this is because ipa-kra-install does:
```
config.kra_host_name = find_providing_server(
'KRA', api.Backend.ldap2, [api.env.ca_host]
)
```
and masters.find_providing_servers() does:
```
def find_providing_servers(svcname, conn=None, preferred_hosts=(), api=api):
(...)
if ENABLED_SERVICE in cfgstrings:
servers.append(servername)
# use hidden services on preferred hosts
elif HIDDEN_SERVICE in cfgstrings and servername in preferred_hosts:
servers.append(servername)
```
e.g. in the absence of preferred_hosts, find_providing_servers() returns an empty list.
The workaround is therefore to set ca_host in default.conf to the hidden replica's FQDN right before ipa-kra-install, and remove that setting right after ipa-kra-install.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory (Moderate: idm:DL1 and idm:client security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHSA-2020:4670