From ddc74a543f53d4197e990def51628f961af5b8cd Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Thu, 19 Nov 2009 05:25:25 +0000 Subject: POSIX: Remove support for old-style posix entries This commit forces the user to specify entries on the server side while still maintaining compatibility with old clients via the POSIXCompat plugin. Signed-off-by: Sol Jerome git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5582 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Server/Plugins/SSHbase.py | 48 ++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 21 deletions(-) (limited to 'src/lib/Server/Plugins/SSHbase.py') diff --git a/src/lib/Server/Plugins/SSHbase.py b/src/lib/Server/Plugins/SSHbase.py index a3690a05a..9739b9801 100644 --- a/src/lib/Server/Plugins/SSHbase.py +++ b/src/lib/Server/Plugins/SSHbase.py @@ -13,22 +13,23 @@ class SSHbase(Bcfg2.Server.Plugin.Plugin, Bcfg2.Server.Plugin.Generator, Bcfg2.Server.Plugin.DirectoryBacked, Bcfg2.Server.Plugin.PullTarget): - '''The sshbase generator manages ssh host keys (both v1 and v2) - for hosts. It also manages the ssh_known_hosts file. It can - integrate host keys from other management domains and similarly - export its keys. The repository contains files in the following - formats: - - ssh_host_key.H_(hostname) -> the v1 host private key for - (hostname) - ssh_host_key.pub.H_(hostname) -> the v1 host public key - for (hostname) - ssh_host_(dr)sa_key.H_(hostname) -> the v2 ssh host - private key for (hostname) - ssh_host_(dr)sa_key.pub.H_(hostname) -> the v2 ssh host - public key for (hostname) - ssh_known_hosts -> the current known hosts file. this - is regenerated each time a new key is generated. + ''' + The sshbase generator manages ssh host keys (both v1 and v2) + for hosts. It also manages the ssh_known_hosts file. It can + integrate host keys from other management domains and similarly + export its keys. The repository contains files in the following + formats: + + ssh_host_key.H_(hostname) -> the v1 host private key for + (hostname) + ssh_host_key.pub.H_(hostname) -> the v1 host public key + for (hostname) + ssh_host_(dr)sa_key.H_(hostname) -> the v2 ssh host + private key for (hostname) + ssh_host_(dr)sa_key.pub.H_(hostname) -> the v2 ssh host + public key for (hostname) + ssh_known_hosts -> the current known hosts file. this + is regenerated each time a new key is generated. ''' name = 'SSHbase' __version__ = '$Id$' @@ -54,7 +55,7 @@ class SSHbase(Bcfg2.Server.Plugin.Plugin, % (self.data)) self.logger.error(ioerr) raise Bcfg2.Server.Plugin.PluginInitError - self.Entries = {'ConfigFile': + self.Entries = {'Path': {'/etc/ssh/ssh_known_hosts': self.build_skn, '/etc/ssh/ssh_host_dsa_key': self.build_hk, '/etc/ssh/ssh_host_rsa_key': self.build_hk, @@ -122,7 +123,7 @@ class SSHbase(Bcfg2.Server.Plugin.Plugin, def HandlesEntry(self, entry, _): '''Handle key entries dynamically''' - return entry.tag == 'ConfigFile' and \ + return entry.tag == 'Path' and \ ([fpat for fpat in self.keypatterns if entry.get('name').endswith(fpat)] or entry.get('name').endswith('ssh_known_hosts')) @@ -168,7 +169,10 @@ class SSHbase(Bcfg2.Server.Plugin.Plugin, for hostkey in hostkeys: entry.text += "localhost,localhost.localdomain,127.0.0.1 %s" % ( self.entries[hostkey].data) - permdata = {'owner':'root', 'group':'root', 'perms':'0644'} + permdata = {'owner':'root', + 'group':'root', + 'type':'file', + 'perms':'0644'} [entry.attrib.__setitem__(key, permdata[key]) for key in permdata] def build_hk(self, entry, metadata): @@ -181,8 +185,10 @@ class SSHbase(Bcfg2.Server.Plugin.Plugin, self.logger.error("%s still not registered" % filename) raise Bcfg2.Server.Plugin.PluginExecutionError keydata = self.entries[filename].data - permdata = {'owner':'root', 'group':'root'} - permdata['perms'] = '0600' + permdata = {'owner':'root', + 'group':'root', + 'type':'file', + 'perms':'0600'} if entry.get('name')[-4:] == '.pub': permdata['perms'] = '0644' [entry.attrib.__setitem__(key, permdata[key]) for key in permdata] -- cgit v1.2.3-1-g7c22