mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-11 00:31:56 -06:00
Add SSH service to platform-specific services.
Add method for getting configuration directory path of a service, so that a different SSH configuration directory can be specified on different platforms. https://fedorahosted.org/freeipa/ticket/754
This commit is contained in:
parent
ca3f304110
commit
e5c0750806
@ -21,8 +21,9 @@ from ipalib.plugable import MagicDict
|
||||
# Canonical names of services as IPA wants to see them. As we need to have *some* naming,
|
||||
# set them as in Red Hat distributions. Actual implementation should make them available
|
||||
# through knownservices.<name> and take care of remapping internally, if needed
|
||||
wellknownservices = ['certmonger', 'dirsrv', 'httpd', 'ipa', 'krb5kdc', 'messagebus',
|
||||
'nslcd', 'nscd', 'ntpd', 'portmap', 'rpcbind', 'kadmin']
|
||||
wellknownservices = ['certmonger', 'dirsrv', 'httpd', 'ipa', 'krb5kdc',
|
||||
'messagebus', 'nslcd', 'nscd', 'ntpd', 'portmap',
|
||||
'rpcbind', 'kadmin', 'sshd']
|
||||
|
||||
class AuthConfig(object):
|
||||
"""
|
||||
@ -141,6 +142,9 @@ class PlatformService(object):
|
||||
def remove(self, instance_name=""):
|
||||
return
|
||||
|
||||
def get_config_dir(self, instance_name=""):
|
||||
return
|
||||
|
||||
class KnownServices(MagicDict):
|
||||
"""
|
||||
KnownServices is an abstract class factory that should give out instances of well-known
|
||||
|
@ -100,12 +100,18 @@ class Fedora16IPAService(Fedora16Service):
|
||||
super(Fedora16IPAService, self).enable(instance_name)
|
||||
self.restart(instance_name)
|
||||
|
||||
class Fedora16SSHService(Fedora16Service):
|
||||
def get_config_dir(self, instance_name=""):
|
||||
return '/etc/ssh'
|
||||
|
||||
# Redirect directory server service through special sub-class due to its special handling of instances
|
||||
def f16_service(name):
|
||||
if name == 'dirsrv':
|
||||
return Fedora16DirectoryService(name)
|
||||
if name == 'ipa':
|
||||
return Fedora16IPAService(name)
|
||||
if name == 'sshd':
|
||||
return Fedora16SSHService(name)
|
||||
return Fedora16Service(name)
|
||||
|
||||
class Fedora16Services(base.KnownServices):
|
||||
|
@ -82,6 +82,10 @@ class RedHatService(base.PlatformService):
|
||||
def remove(self, instance_name=""):
|
||||
ipautil.run(["/sbin/chkconfig", "--del", self.service_name])
|
||||
|
||||
class RedHatSSHService(RedHatService):
|
||||
def get_config_dir(self, instance_name=""):
|
||||
return '/etc/ssh'
|
||||
|
||||
class RedHatAuthConfig(base.AuthConfig):
|
||||
"""
|
||||
AuthConfig class implements system-independent interface to configure
|
||||
@ -109,16 +113,21 @@ class RedHatAuthConfig(base.AuthConfig):
|
||||
args = self.__build_args()
|
||||
ipautil.run(["/usr/sbin/authconfig"]+args)
|
||||
|
||||
def redhat_service(name):
|
||||
if name == 'sshd':
|
||||
return RedHatSSHService(name)
|
||||
return RedHatService(name)
|
||||
|
||||
class RedHatServices(base.KnownServices):
|
||||
def __init__(self):
|
||||
services = dict()
|
||||
for s in base.wellknownservices:
|
||||
services[s] = RedHatService(s)
|
||||
services[s] = redhat_service(s)
|
||||
# Call base class constructor. This will lock services to read-only
|
||||
super(RedHatServices, self).__init__(services)
|
||||
|
||||
authconfig = RedHatAuthConfig
|
||||
service = RedHatService
|
||||
service = redhat_service
|
||||
knownservices = RedHatServices()
|
||||
|
||||
def restore_context(filepath):
|
||||
|
Loading…
Reference in New Issue
Block a user