590d18
From f0e3715b39ea2682f4ef689f5d5864e16117fb00 Mon Sep 17 00:00:00 2001
590d18
From: Jan Cholasta <jcholast@redhat.com>
590d18
Date: Thu, 27 Aug 2015 07:37:24 +0200
590d18
Subject: [PATCH] cert renewal: Automatically update KRA agent PEM file
590d18
590d18
https://fedorahosted.org/freeipa/ticket/5253
590d18
590d18
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
590d18
---
590d18
 install/restart_scripts/renew_ra_cert | 12 +++++++++++-
590d18
 1 file changed, 11 insertions(+), 1 deletion(-)
590d18
590d18
diff --git a/install/restart_scripts/renew_ra_cert b/install/restart_scripts/renew_ra_cert
590d18
index 1f8fcae6fa09033f7a5c6448e0bbef14a5f76844..93ffd4035723831f3955bcdf5a2082fd1ec5e22a 100644
590d18
--- a/install/restart_scripts/renew_ra_cert
590d18
+++ b/install/restart_scripts/renew_ra_cert
590d18
@@ -29,7 +29,7 @@ import traceback
590d18
 
590d18
 from ipapython import ipautil
590d18
 from ipalib import api
590d18
-from ipaserver.install import certs, cainstance
590d18
+from ipaserver.install import certs, cainstance, krainstance
590d18
 from ipaplatform import services
590d18
 from ipaplatform.paths import paths
590d18
 
590d18
@@ -60,6 +60,16 @@ def _main():
590d18
 
590d18
             # Load it into dogtag
590d18
             cainstance.update_people_entry(dercert)
590d18
+
590d18
+        kra = krainstance.KRAInstance(api.env.realm)
590d18
+        if kra.is_installed():
590d18
+            # export ipaCert with private key for client authentication
590d18
+            args = ["/usr/bin/pki",
590d18
+                    "-d", paths.HTTPD_ALIAS_DIR,
590d18
+                    "-C", paths.ALIAS_PWDFILE_TXT,
590d18
+                    "client-cert-show", "ipaCert",
590d18
+                    "--client-cert", paths.KRA_AGENT_PEM]
590d18
+            ipautil.run(args)
590d18
     finally:
590d18
         shutil.rmtree(tmpdir)
590d18
 
590d18
-- 
590d18
2.5.1
590d18