From 354d7297e8e0d97da22c0469ab96f30fdfc4a1ea Mon Sep 17 00:00:00 2001 From: Thomas Woerner Date: Thu, 2 Aug 2018 11:32:05 +0200 Subject: [PATCH] ipa_restore: Restore SELinux context of template_dir /var/log/dirsrv/slapd-X The template directory /var/log/dirsrv/slapd-X could be created with the wrong SELinux context. Related to: https://pagure.io/freeipa/issue/7662 Reviewed-By: Christian Heimes --- ipaserver/install/ipa_restore.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ipaserver/install/ipa_restore.py b/ipaserver/install/ipa_restore.py index 48b95ed18..1916d3063 100644 --- a/ipaserver/install/ipa_restore.py +++ b/ipaserver/install/ipa_restore.py @@ -607,10 +607,13 @@ class Restore(admintool.AdminTool): logger.info("Waiting for LDIF to finish") wait_for_task(conn, dn) else: + template_dir = paths.VAR_LOG_DIRSRV_INSTANCE_TEMPLATE % instance try: - os.makedirs(paths.VAR_LOG_DIRSRV_INSTANCE_TEMPLATE % instance) + os.makedirs(template_dir) except OSError as e: pass + # Restore SELinux context of template_dir + tasks.restore_context(template_dir) args = [paths.LDIF2DB, '-Z', instance,