From 3593e5362206fd9287e97fe2cee229a1117811ff Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Fri, 25 Oct 2019 10:20:35 -0400 Subject: [PATCH] Conditionally restart certmonger after client installation If certmonger is running prior to client installation then its IPA CA configuration will be incomplete and missing the CA chain. If a certificate is subsequently requested with -F to store the CA chain in a file or NSS db it may not be available yet. A conditional restart of certmonger will pick up the new IPA configuration and complete the IPA CA configuration in certmonger. A pure restart and service activation is not done since certmonger is not required unless --request-cert was passed ipa-client-install. https://pagure.io/freeipa/issue/8105 Reviewed-By: Christian Heimes Reviewed-By: Ade Lee --- ipaclient/install/client.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py index e2e2e8f5b..cc830f1ff 100644 --- a/ipaclient/install/client.py +++ b/ipaclient/install/client.py @@ -779,7 +779,16 @@ def configure_krb5_conf( def configure_certmonger( fstore, subject_base, cli_realm, hostname, options, ca_enabled): + cmonger = services.knownservices.certmonger if not options.request_cert: + # Conditionally restart certmonger to pick up the new IPA + # configuration. + try: + cmonger.try_restart() + except Exception as e: + logger.error( + "Failed to conditionally restart the %s daemon: %s", + cmonger.service_name, str(e)) return if not ca_enabled: @@ -794,7 +803,6 @@ def configure_certmonger( # which principal name to use when requesting certs. certmonger.add_principal_to_cas(principal) - cmonger = services.knownservices.certmonger try: cmonger.enable() cmonger.start()