Manage ipa-otpd.socket by IPA

Adds a new simple service called OtpdInstance, that manages
ipa-otpd.socket service. Added to server/replica installer
and ipa-upgradeconfig script.

https://fedorahosted.org/freeipa/ticket/3680
This commit is contained in:
Tomas Babej
2013-06-06 18:16:59 +02:00
committed by Martin Kosek
parent bcf8ab24d5
commit b2c378dcc8
6 changed files with 68 additions and 22 deletions
+6
View File
@@ -35,6 +35,7 @@ from ipapython import ipautil
from ipaserver.install import dsinstance, installutils, krbinstance, service from ipaserver.install import dsinstance, installutils, krbinstance, service
from ipaserver.install import bindinstance, httpinstance, ntpinstance, certs from ipaserver.install import bindinstance, httpinstance, ntpinstance, certs
from ipaserver.install import memcacheinstance from ipaserver.install import memcacheinstance
from ipaserver.install import otpdinstance
from ipaserver.install.replication import replica_conn_check, ReplicationManager from ipaserver.install.replication import replica_conn_check, ReplicationManager
from ipaserver.install.installutils import (HostnameLocalhost, resolve_host, from ipaserver.install.installutils import (HostnameLocalhost, resolve_host,
ReplicaConfig, expand_replica_info, read_replica_info ,get_host_name, ReplicaConfig, expand_replica_info, read_replica_info ,get_host_name,
@@ -667,6 +668,11 @@ def main():
krb = install_krb(config, setup_pkinit=options.setup_pkinit) krb = install_krb(config, setup_pkinit=options.setup_pkinit)
http = install_http(config, auto_redirect=options.ui_redirect) http = install_http(config, auto_redirect=options.ui_redirect)
otpd = otpdinstance.OtpdInstance()
otpd.create_instance('OTPD', config.host_name, config.dirman_password,
ipautil.realm_to_suffix(config.realm_name))
if CA: if CA:
CA.configure_certmonger_renewal() CA.configure_certmonger_renewal()
CA.import_ra_cert(dir + "/ra.p12") CA.import_ra_cert(dir + "/ra.p12")
+9 -3
View File
@@ -49,6 +49,7 @@ from ipaserver.install import ntpinstance
from ipaserver.install import certs from ipaserver.install import certs
from ipaserver.install import cainstance from ipaserver.install import cainstance
from ipaserver.install import memcacheinstance from ipaserver.install import memcacheinstance
from ipaserver.install import otpdinstance
from ipaserver.install import sysupgrade from ipaserver.install import sysupgrade
from ipaserver.install import service, installutils from ipaserver.install import service, installutils
@@ -513,6 +514,7 @@ def uninstall():
krbinstance.KrbInstance(fstore).uninstall() krbinstance.KrbInstance(fstore).uninstall()
dsinstance.DsInstance(fstore=fstore).uninstall() dsinstance.DsInstance(fstore=fstore).uninstall()
memcacheinstance.MemcacheInstance().uninstall() memcacheinstance.MemcacheInstance().uninstall()
otpdinstance.OtpdInstance().uninstall()
ipaservices.restore_network_configuration(fstore, sstore) ipaservices.restore_network_configuration(fstore, sstore)
fstore.restore_all_files() fstore.restore_all_files()
try: try:
@@ -1092,11 +1094,15 @@ def main():
# generated # generated
ds.add_cert_to_service() ds.add_cert_to_service()
# Create a HTTP instance
memcache = memcacheinstance.MemcacheInstance() memcache = memcacheinstance.MemcacheInstance()
memcache.create_instance('MEMCACHE', host_name, dm_password, ipautil.realm_to_suffix(realm_name)) memcache.create_instance('MEMCACHE', host_name, dm_password,
ipautil.realm_to_suffix(realm_name))
otpd = otpdinstance.OtpdInstance()
otpd.create_instance('OTPD', host_name, dm_password,
ipautil.realm_to_suffix(realm_name))
# Create a HTTP instance
http = httpinstance.HTTPInstance(fstore) http = httpinstance.HTTPInstance(fstore)
if options.http_pkcs12: if options.http_pkcs12:
http.create_instance( http.create_instance(
+18 -11
View File
@@ -48,6 +48,7 @@ from ipaserver.install import bindinstance
from ipaserver.install import service from ipaserver.install import service
from ipaserver.install import cainstance from ipaserver.install import cainstance
from ipaserver.install import certs from ipaserver.install import certs
from ipaserver.install import otpdinstance
from ipaserver.install import sysupgrade from ipaserver.install import sysupgrade
@@ -925,17 +926,23 @@ def main():
uninstall_selfsign(ds, http) uninstall_selfsign(ds, http)
memcache = memcacheinstance.MemcacheInstance() simple_service_list = (
memcache.ldapi = True (memcacheinstance.MemcacheInstance(), 'MEMCACHE'),
memcache.realm = api.env.realm (otpdinstance.OtpdInstance(), 'OTPD'),
try: )
if not memcache.is_configured():
# 389-ds needs to be running to create the memcache instance for service, ldap_name in simple_service_list:
# because we record the new service in cn=masters. service.ldapi = True
ds.start() try:
memcache.create_instance('MEMCACHE', fqdn, None, ipautil.realm_to_suffix(api.env.realm)) if not service.is_configured():
except ipalib.errors.DuplicateEntry: # 389-ds needs to be running to create the memcache instance
pass # because we record the new service in cn=masters.
ds.start()
service.create_instance(ldap_name, fqdn, None,
ipautil.realm_to_suffix(api.env.realm),
realm=api.env.realm)
except ipalib.errors.DuplicateEntry:
pass
cleanup_kdc(fstore) cleanup_kdc(fstore)
setup_firefox_extension(fstore) setup_firefox_extension(fstore)
+1
View File
@@ -53,6 +53,7 @@ system_units['pki_cad'] = system_units['pki-cad']
# Our PKI instance is pki-tomcatd@pki-tomcat.service # Our PKI instance is pki-tomcatd@pki-tomcat.service
system_units['pki-tomcatd'] = 'pki-tomcatd@pki-tomcat.service' system_units['pki-tomcatd'] = 'pki-tomcatd@pki-tomcat.service'
system_units['pki_tomcatd'] = system_units['pki-tomcatd'] system_units['pki_tomcatd'] = system_units['pki-tomcatd']
system_units['ipa-otpd'] = 'ipa-otpd.socket'
class Fedora16Service(systemd.SystemdService): class Fedora16Service(systemd.SystemdService):
def __init__(self, service_name): def __init__(self, service_name):
+25
View File
@@ -0,0 +1,25 @@
# Authors: Tomas Babej <tbabej@redhat.com>
#
# Copyright (C) 2013 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import service
class OtpdInstance(service.SimpleServiceInstance):
def __init__(self):
service.SimpleServiceInstance.__init__(self, "ipa-otpd")
+9 -8
View File
@@ -40,14 +40,15 @@ DISABLED = 3
# The service name as stored in cn=masters,cn=ipa,cn=etc. In the tuple # The service name as stored in cn=masters,cn=ipa,cn=etc. In the tuple
# the first value is the *nix service name, the second the start order. # the first value is the *nix service name, the second the start order.
SERVICE_LIST = { SERVICE_LIST = {
'KDC':('krb5kdc', 10), 'KDC': ('krb5kdc', 10),
'KPASSWD':('kadmin', 20), 'KPASSWD': ('kadmin', 20),
'DNS':('named', 30), 'DNS': ('named', 30),
'MEMCACHE':('ipa_memcached', 39), 'MEMCACHE': ('ipa_memcached', 39),
'HTTP':('httpd', 40), 'HTTP': ('httpd', 40),
'CA':('%sd' % dogtag.configured_constants().PKI_INSTANCE_NAME, 50), 'CA': ('%sd' % dogtag.configured_constants().PKI_INSTANCE_NAME, 50),
'ADTRUST':('smb', 60), 'ADTRUST': ('smb', 60),
'EXTID':('winbind', 70) 'EXTID': ('winbind', 70),
'OTPD': ('ipa-otpd', 80),
} }
def print_msg(message, output_fd=sys.stdout): def print_msg(message, output_fd=sys.stdout):