summaryrefslogtreecommitdiffstats
path: root/ipapython
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2012-01-23 10:01:41 -0500
committerRob Crittenden <rcritten@redhat.com>2012-02-13 22:24:24 -0500
commitf2d3f916808fbfcf2ea35c6aa7a9eeca1ed5f492 (patch)
treef149640194b5ee5117385235860b3b2245416c31 /ipapython
parent36eefa2f6be80589e64dd10c8b6da307f773d006 (diff)
downloadfreeipa.git-f2d3f916808fbfcf2ea35c6aa7a9eeca1ed5f492.tar.gz
freeipa.git-f2d3f916808fbfcf2ea35c6aa7a9eeca1ed5f492.tar.xz
freeipa.git-f2d3f916808fbfcf2ea35c6aa7a9eeca1ed5f492.zip
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
Diffstat (limited to 'ipapython')
-rw-r--r--ipapython/platform/base.py8
-rw-r--r--ipapython/platform/fedora16.py6
-rw-r--r--ipapython/platform/redhat.py13
3 files changed, 23 insertions, 4 deletions
diff --git a/ipapython/platform/base.py b/ipapython/platform/base.py
index 99189a10..d177cc82 100644
--- a/ipapython/platform/base.py
+++ b/ipapython/platform/base.py
@@ -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
diff --git a/ipapython/platform/fedora16.py b/ipapython/platform/fedora16.py
index 369a1778..2d0ede99 100644
--- a/ipapython/platform/fedora16.py
+++ b/ipapython/platform/fedora16.py
@@ -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):
diff --git a/ipapython/platform/redhat.py b/ipapython/platform/redhat.py
index d99a9174..aee8bcc3 100644
--- a/ipapython/platform/redhat.py
+++ b/ipapython/platform/redhat.py
@@ -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):