summaryrefslogtreecommitdiffstats
path: root/ipaplatform/redhat/tasks.py
diff options
context:
space:
mode:
authorMartin Basti <mbasti@redhat.com>2016-03-16 09:04:42 +0100
committerMartin Basti <mbasti@redhat.com>2016-04-22 10:19:25 +0200
commit586fee293f42388510fa5436af19460bbe1fdec5 (patch)
tree777c156e49f181ce566468c6d7283a6feac95cac /ipaplatform/redhat/tasks.py
parent822186b2715f8a3ce2f48e873d7e1568d03f9f97 (diff)
downloadfreeipa-586fee293f42388510fa5436af19460bbe1fdec5.tar.gz
freeipa-586fee293f42388510fa5436af19460bbe1fdec5.tar.xz
freeipa-586fee293f42388510fa5436af19460bbe1fdec5.zip
Configure httpd service from installer instead of directly from RPM
File httpd.service was created by RPM, what causes that httpd service may fail due IPA specific configuration even if IPA wasn't installed or was uninstalled (without erasing RPMs). With this patch httpd service is configured by httpd.d/ipa.conf during IPA installation and this config is removed by uninstaller, so no residual http configuration related to IPA should stay there. https://fedorahosted.org/freeipa/ticket/5681 Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
Diffstat (limited to 'ipaplatform/redhat/tasks.py')
-rw-r--r--ipaplatform/redhat/tasks.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/ipaplatform/redhat/tasks.py b/ipaplatform/redhat/tasks.py
index 7c29b51e1..4be9a146e 100644
--- a/ipaplatform/redhat/tasks.py
+++ b/ipaplatform/redhat/tasks.py
@@ -460,5 +460,34 @@ class RedHatTaskNamespace(BaseTaskNamespace):
"""
return IPAVersion(version)
+ def configure_httpd_service_ipa_conf(self):
+ """Create systemd config for httpd service to work with IPA
+ """
+ if not os.path.exists(paths.SYSTEMD_SYSTEM_HTTPD_D_DIR):
+ os.mkdir(paths.SYSTEMD_SYSTEM_HTTPD_D_DIR, 0o755)
+
+ ipautil.copy_template_file(
+ os.path.join(ipautil.SHARE_DIR, 'ipa-httpd.conf.template'),
+ paths.SYSTEMD_SYSTEM_HTTPD_IPA_CONF,
+ dict(
+ KRB5CC_HTTPD=paths.KRB5CC_HTTPD,
+ KDCPROXY_CONFIG=paths.KDCPROXY_CONFIG,
+ IPA_HTTPD_KDCPROXY=paths.IPA_HTTPD_KDCPROXY,
+ POST='-{kdestroy} -A'.format(kdestroy=paths.KDESTROY)
+ )
+ )
+
+ os.chmod(paths.SYSTEMD_SYSTEM_HTTPD_IPA_CONF, 0o644)
+ self.restore_context(paths.SYSTEMD_SYSTEM_HTTPD_IPA_CONF)
+
+ def remove_httpd_service_ipa_conf(self):
+ """Remove systemd config for httpd service of IPA"""
+ try:
+ os.unlink(paths.SYSTEMD_SYSTEM_HTTPD_IPA_CONF)
+ except OSError as e:
+ root_logger.error(
+ 'Error removing %s: %s',
+ paths.SYSTEMD_SYSTEM_HTTPD_IPA_CONF, e
+ )
tasks = RedHatTaskNamespace()