|
|
e3ffab |
From 13fec89bb4a2ddfda7d1ad0da18c6c4be77373d6 Mon Sep 17 00:00:00 2001
|
|
|
e3ffab |
From: Jan Cholasta <jcholast@redhat.com>
|
|
|
e3ffab |
Date: Tue, 20 Jan 2015 09:38:43 +0000
|
|
|
e3ffab |
Subject: [PATCH] Do not assume certmonger is running in httpinstance
|
|
|
e3ffab |
|
|
|
e3ffab |
https://fedorahosted.org/freeipa/ticket/4835
|
|
|
e3ffab |
|
|
|
e3ffab |
Reviewed-By: David Kupka <dkupka@redhat.com>
|
|
|
e3ffab |
---
|
|
|
e3ffab |
ipaserver/install/httpinstance.py | 48 +++++++++++++++++++++++----------------
|
|
|
e3ffab |
1 file changed, 29 insertions(+), 19 deletions(-)
|
|
|
e3ffab |
|
|
|
e3ffab |
diff --git a/ipaserver/install/httpinstance.py b/ipaserver/install/httpinstance.py
|
|
|
e3ffab |
index 2fb315b6b822343860a9c31b016d6a0a22388488..cda85ab02b8054748e671935fcfbc3993257c53e 100644
|
|
|
e3ffab |
--- a/ipaserver/install/httpinstance.py
|
|
|
e3ffab |
+++ b/ipaserver/install/httpinstance.py
|
|
|
e3ffab |
@@ -39,6 +39,7 @@ from ipaserver.install import sysupgrade
|
|
|
e3ffab |
from ipalib import api
|
|
|
e3ffab |
from ipaplatform.tasks import tasks
|
|
|
e3ffab |
from ipaplatform.paths import paths
|
|
|
e3ffab |
+from ipaplatform import services
|
|
|
e3ffab |
|
|
|
e3ffab |
|
|
|
e3ffab |
SELINUX_BOOLEAN_SETTINGS = dict(
|
|
|
e3ffab |
@@ -228,25 +229,34 @@ class HTTPInstance(service.Service):
|
|
|
e3ffab |
print "Adding Include conf.d/ipa-rewrite to %s failed." % paths.HTTPD_NSS_CONF
|
|
|
e3ffab |
|
|
|
e3ffab |
def configure_certmonger_renewal_guard(self):
|
|
|
e3ffab |
- bus = dbus.SystemBus()
|
|
|
e3ffab |
- obj = bus.get_object('org.fedorahosted.certmonger',
|
|
|
e3ffab |
- '/org/fedorahosted/certmonger')
|
|
|
e3ffab |
- iface = dbus.Interface(obj, 'org.fedorahosted.certmonger')
|
|
|
e3ffab |
- path = iface.find_ca_by_nickname('IPA')
|
|
|
e3ffab |
- if path:
|
|
|
e3ffab |
- ca_obj = bus.get_object('org.fedorahosted.certmonger', path)
|
|
|
e3ffab |
- ca_iface = dbus.Interface(ca_obj,
|
|
|
e3ffab |
- 'org.freedesktop.DBus.Properties')
|
|
|
e3ffab |
- helper = ca_iface.Get('org.fedorahosted.certmonger.ca',
|
|
|
e3ffab |
- 'external-helper')
|
|
|
e3ffab |
- if helper:
|
|
|
e3ffab |
- args = shlex.split(helper)
|
|
|
e3ffab |
- if args[0] != paths.IPA_SERVER_GUARD:
|
|
|
e3ffab |
- self.backup_state('certmonger_ipa_helper', helper)
|
|
|
e3ffab |
- args = [paths.IPA_SERVER_GUARD] + args
|
|
|
e3ffab |
- helper = ' '.join(pipes.quote(a) for a in args)
|
|
|
e3ffab |
- ca_iface.Set('org.fedorahosted.certmonger.ca',
|
|
|
e3ffab |
- 'external-helper', helper)
|
|
|
e3ffab |
+ certmonger = services.knownservices.certmonger
|
|
|
e3ffab |
+ certmonger_stopped = not certmonger.is_running()
|
|
|
e3ffab |
+
|
|
|
e3ffab |
+ if certmonger_stopped:
|
|
|
e3ffab |
+ certmonger.start()
|
|
|
e3ffab |
+ try:
|
|
|
e3ffab |
+ bus = dbus.SystemBus()
|
|
|
e3ffab |
+ obj = bus.get_object('org.fedorahosted.certmonger',
|
|
|
e3ffab |
+ '/org/fedorahosted/certmonger')
|
|
|
e3ffab |
+ iface = dbus.Interface(obj, 'org.fedorahosted.certmonger')
|
|
|
e3ffab |
+ path = iface.find_ca_by_nickname('IPA')
|
|
|
e3ffab |
+ if path:
|
|
|
e3ffab |
+ ca_obj = bus.get_object('org.fedorahosted.certmonger', path)
|
|
|
e3ffab |
+ ca_iface = dbus.Interface(ca_obj,
|
|
|
e3ffab |
+ 'org.freedesktop.DBus.Properties')
|
|
|
e3ffab |
+ helper = ca_iface.Get('org.fedorahosted.certmonger.ca',
|
|
|
e3ffab |
+ 'external-helper')
|
|
|
e3ffab |
+ if helper:
|
|
|
e3ffab |
+ args = shlex.split(helper)
|
|
|
e3ffab |
+ if args[0] != paths.IPA_SERVER_GUARD:
|
|
|
e3ffab |
+ self.backup_state('certmonger_ipa_helper', helper)
|
|
|
e3ffab |
+ args = [paths.IPA_SERVER_GUARD] + args
|
|
|
e3ffab |
+ helper = ' '.join(pipes.quote(a) for a in args)
|
|
|
e3ffab |
+ ca_iface.Set('org.fedorahosted.certmonger.ca',
|
|
|
e3ffab |
+ 'external-helper', helper)
|
|
|
e3ffab |
+ finally:
|
|
|
e3ffab |
+ if certmonger_stopped:
|
|
|
e3ffab |
+ certmonger.stop()
|
|
|
e3ffab |
|
|
|
e3ffab |
def __setup_ssl(self):
|
|
|
e3ffab |
fqdn = self.fqdn
|
|
|
e3ffab |
--
|
|
|
e3ffab |
2.1.0
|
|
|
e3ffab |
|