|
|
21de49 |
From 977a01a67318a9b0ce01f7803b1126a310bf4140 Mon Sep 17 00:00:00 2001
|
|
|
21de49 |
From: Florence Blanc-Renaud <flo@redhat.com>
|
|
|
21de49 |
Date: Fri, 30 Nov 2018 15:49:20 +0100
|
|
|
21de49 |
Subject: [PATCH] PKINIT: fix ipa-pkinit-manage enable|disable
|
|
|
21de49 |
|
|
|
21de49 |
The command ipa-pkinit-manage enable|disable is reporting
|
|
|
21de49 |
success even though the PKINIT cert is not re-issued.
|
|
|
21de49 |
The command triggers the request of a new certificate
|
|
|
21de49 |
(signed by IPA CA when state=enable, selfsigned when disabled),
|
|
|
21de49 |
but as the cert file is still present, certmonger does not create
|
|
|
21de49 |
a new request and the existing certificate is kept.
|
|
|
21de49 |
|
|
|
21de49 |
The fix consists in deleting the cert and key file before calling
|
|
|
21de49 |
certmonger to request a new cert.
|
|
|
21de49 |
|
|
|
21de49 |
There was also an issue in the is_pkinit_enabled() function:
|
|
|
21de49 |
if no tracking request was found for the PKINIT cert,
|
|
|
21de49 |
is_pkinit_enabled() was returning True while it should not.
|
|
|
21de49 |
|
|
|
21de49 |
Fixes https://pagure.io/freeipa/issue/7200
|
|
|
21de49 |
|
|
|
21de49 |
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
|
|
|
21de49 |
Reviewed-By: Christian Heimes <cheimes@redhat.com>
|
|
|
21de49 |
---
|
|
|
21de49 |
ipaserver/install/ipa_pkinit_manage.py | 2 ++
|
|
|
21de49 |
ipaserver/install/krbinstance.py | 9 ++++++---
|
|
|
21de49 |
2 files changed, 8 insertions(+), 3 deletions(-)
|
|
|
21de49 |
|
|
|
21de49 |
diff --git a/ipaserver/install/ipa_pkinit_manage.py b/ipaserver/install/ipa_pkinit_manage.py
|
|
|
21de49 |
index 4a79bba5d1b636827a7a031965b49cf7b34c6330..86bd1baf00178a629864b210ca9f4786668149df 100644
|
|
|
21de49 |
--- a/ipaserver/install/ipa_pkinit_manage.py
|
|
|
21de49 |
+++ b/ipaserver/install/ipa_pkinit_manage.py
|
|
|
21de49 |
@@ -72,6 +72,8 @@ class PKINITManage(AdminTool):
|
|
|
21de49 |
if ca_enabled:
|
|
|
21de49 |
logger.warning(
|
|
|
21de49 |
"Failed to stop tracking certificates: %s", e)
|
|
|
21de49 |
+ # remove the cert and key
|
|
|
21de49 |
+ krb.delete_pkinit_cert()
|
|
|
21de49 |
|
|
|
21de49 |
krb.enable_ssl()
|
|
|
21de49 |
|
|
|
21de49 |
diff --git a/ipaserver/install/krbinstance.py b/ipaserver/install/krbinstance.py
|
|
|
21de49 |
index a3079bd6304a41116f9aa5e78b6c6c71d72d7aa6..6221f3f61338308afb406e23d62566b12d8c131d 100644
|
|
|
21de49 |
--- a/ipaserver/install/krbinstance.py
|
|
|
21de49 |
+++ b/ipaserver/install/krbinstance.py
|
|
|
21de49 |
@@ -77,7 +77,7 @@ def is_pkinit_enabled():
|
|
|
21de49 |
if os.path.exists(paths.KDC_CERT):
|
|
|
21de49 |
pkinit_request_ca = get_pkinit_request_ca()
|
|
|
21de49 |
|
|
|
21de49 |
- if pkinit_request_ca != "SelfSign":
|
|
|
21de49 |
+ if pkinit_request_ca and pkinit_request_ca != "SelfSign":
|
|
|
21de49 |
return True
|
|
|
21de49 |
|
|
|
21de49 |
return False
|
|
|
21de49 |
@@ -591,6 +591,10 @@ class KrbInstance(service.Service):
|
|
|
21de49 |
def stop_tracking_certs(self):
|
|
|
21de49 |
certmonger.stop_tracking(certfile=paths.KDC_CERT)
|
|
|
21de49 |
|
|
|
21de49 |
+ def delete_pkinit_cert(self):
|
|
|
21de49 |
+ installutils.remove_file(paths.KDC_CERT)
|
|
|
21de49 |
+ installutils.remove_file(paths.KDC_KEY)
|
|
|
21de49 |
+
|
|
|
21de49 |
def uninstall(self):
|
|
|
21de49 |
if self.is_configured():
|
|
|
21de49 |
self.print_msg("Unconfiguring %s" % self.service_name)
|
|
|
21de49 |
@@ -616,8 +620,7 @@ class KrbInstance(service.Service):
|
|
|
21de49 |
# stop tracking and remove certificates
|
|
|
21de49 |
self.stop_tracking_certs()
|
|
|
21de49 |
installutils.remove_file(paths.CACERT_PEM)
|
|
|
21de49 |
- installutils.remove_file(paths.KDC_CERT)
|
|
|
21de49 |
- installutils.remove_file(paths.KDC_KEY)
|
|
|
21de49 |
+ self.delete_pkinit_cert()
|
|
|
21de49 |
|
|
|
21de49 |
if running:
|
|
|
21de49 |
self.restart()
|
|
|
21de49 |
--
|
|
|
21de49 |
2.17.2
|
|
|
21de49 |
|