From 066f5b7c904208d0fd79862dfaa7166fff42fd30 Mon Sep 17 00:00:00 2001 From: Florence Blanc-Renaud Date: Tue, 24 Jan 2017 16:55:07 +0100 Subject: [PATCH] ipa-kra-install must create directory if it does not exist ipa-kra-install creates an admin cert file in /root/.dogtag/pki-tomcat/ca_admin.cert but does not check that the parent directory exists. This situation can happen when uninstall + restore has been run. The fix creates the directory if not present. https://fedorahosted.org/freeipa/ticket/6606 Reviewed-By: Christian Heimes --- ipaserver/install/krainstance.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ipaserver/install/krainstance.py b/ipaserver/install/krainstance.py index 95672ee5c..f16a1748f 100644 --- a/ipaserver/install/krainstance.py +++ b/ipaserver/install/krainstance.py @@ -259,6 +259,10 @@ class KRAInstance(DogtagInstance): else: # the admin cert file is needed for the first instance of KRA cert = DogtagInstance.get_admin_cert(self) + # First make sure that the directory exists + parentdir = os.path.dirname(paths.ADMIN_CERT_PATH) + if not os.path.exists(parentdir): + os.makedirs(parentdir) with open(paths.ADMIN_CERT_PATH, "w") as admin_path: admin_path.write(cert)