|
|
531784 |
From eb377fed539e44194fb1ad822c0d4c6e9ea38d03 Mon Sep 17 00:00:00 2001
|
|
|
531784 |
From: Rob Crittenden <rcritten@redhat.com>
|
|
|
531784 |
Date: Tue, 11 May 2021 13:26:00 -0400
|
|
|
531784 |
Subject: [PATCH] Filter out the pki healthcheck sources if IPA CA is not
|
|
|
531784 |
installed
|
|
|
531784 |
|
|
|
531784 |
The pki checks spew the error "Invalid PKI instance: pki-tomcat" so
|
|
|
531784 |
we need to suppress them in the IPA CA-less installation case.
|
|
|
531784 |
|
|
|
531784 |
So if the IPA CA is not configured then don't register the
|
|
|
531784 |
pki sources.
|
|
|
531784 |
|
|
|
531784 |
A side-effect is that to user the sources will not be listed at
|
|
|
531784 |
all in this case.
|
|
|
531784 |
|
|
|
531784 |
This should not affect pki-healthcheck and it will continue to
|
|
|
531784 |
return errors in the unconfigured case.
|
|
|
531784 |
|
|
|
531784 |
https://github.com/freeipa/freeipa-healthcheck/issues/201
|
|
|
531784 |
|
|
|
531784 |
Signed-off-by: Rob Crittenden <rcritten@redhat.com>
|
|
|
531784 |
---
|
|
|
531784 |
src/ipahealthcheck/core/core.py | 13 +++++++++++++
|
|
|
531784 |
src/ipahealthcheck/ipa/plugin.py | 4 ++++
|
|
|
531784 |
2 files changed, 17 insertions(+)
|
|
|
531784 |
|
|
|
531784 |
diff --git a/src/ipahealthcheck/core/core.py b/src/ipahealthcheck/core/core.py
|
|
|
531784 |
index eaa2d9c..a6b4fe8 100644
|
|
|
531784 |
--- a/src/ipahealthcheck/core/core.py
|
|
|
531784 |
+++ b/src/ipahealthcheck/core/core.py
|
|
|
531784 |
@@ -281,6 +281,13 @@ class RunChecks:
|
|
|
531784 |
if rval is not None:
|
|
|
531784 |
return rval
|
|
|
531784 |
|
|
|
531784 |
+ # If we have IPA configured without a CA then we want to skip
|
|
|
531784 |
+ # the pkihealthcheck plugins otherwise they will generated a
|
|
|
531784 |
+ # lot of false positives. The IPA plugins are loaded first so
|
|
|
531784 |
+ # which should set ca_configured in its registry to True or
|
|
|
531784 |
+ # False. We will skip the pkihealthcheck plugins only if
|
|
|
531784 |
+ # ca_configured is False which means that it was set by IPA.
|
|
|
531784 |
+ ca_configured = False
|
|
|
531784 |
for name, registry in find_registries(self.entry_points).items():
|
|
|
531784 |
try:
|
|
|
531784 |
registry.initialize(framework, config, options)
|
|
|
531784 |
@@ -292,6 +299,12 @@ class RunChecks:
|
|
|
531784 |
except Exception as e:
|
|
|
531784 |
logger.error("Unable to initialize %s: %s" % (name, e))
|
|
|
531784 |
continue
|
|
|
531784 |
+ if hasattr(registry, 'ca_configured'):
|
|
|
531784 |
+ ca_configured = registry.ca_configured
|
|
|
531784 |
+ for name, registry in find_registries(self.entry_points).items():
|
|
|
531784 |
+ if 'pkihealthcheck' in name and ca_configured is False:
|
|
|
531784 |
+ logger.debug('IPA CA is not configured, skipping %s', name)
|
|
|
531784 |
+ continue
|
|
|
531784 |
for plugin in find_plugins(name, registry):
|
|
|
531784 |
plugins.append(plugin)
|
|
|
531784 |
|
|
|
531784 |
diff --git a/src/ipahealthcheck/ipa/plugin.py b/src/ipahealthcheck/ipa/plugin.py
|
|
|
531784 |
index 67d93e5..debb1bb 100644
|
|
|
531784 |
--- a/src/ipahealthcheck/ipa/plugin.py
|
|
|
531784 |
+++ b/src/ipahealthcheck/ipa/plugin.py
|
|
|
531784 |
@@ -35,6 +35,7 @@ class IPARegistry(Registry):
|
|
|
531784 |
super(IPARegistry, self).__init__()
|
|
|
531784 |
self.trust_agent = False
|
|
|
531784 |
self.trust_controller = False
|
|
|
531784 |
+ self.ca_configured = False
|
|
|
531784 |
|
|
|
531784 |
def initialize(self, framework, config, options=None):
|
|
|
531784 |
super(IPARegistry, self).initialize(framework, config)
|
|
|
531784 |
@@ -58,6 +59,9 @@ class IPARegistry(Registry):
|
|
|
531784 |
logging.debug('Failed to connect to LDAP: %s', e)
|
|
|
531784 |
return
|
|
|
531784 |
|
|
|
531784 |
+ ca = cainstance.CAInstance(api.env.realm, host_name=api.env.host)
|
|
|
531784 |
+ self.ca_configured = ca.is_configured()
|
|
|
531784 |
+
|
|
|
531784 |
# This package is pulled in when the trust package is installed
|
|
|
531784 |
# and is required to lookup trust users. If this is not installed
|
|
|
531784 |
# then it can be inferred that trust is not enabled.
|
|
|
531784 |
--
|
|
|
531784 |
2.31.1
|
|
|
531784 |
|