summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Plugins/SSHbase.py
diff options
context:
space:
mode:
authorSol Jerome <solj@ices.utexas.edu>2009-06-23 14:16:05 +0000
committerSol Jerome <solj@ices.utexas.edu>2009-06-23 14:16:05 +0000
commit542dafea6974627df8e327be7f80d9f7bf417892 (patch)
treea38705246c9255654bb616b3681b32748e3ff0ee /src/lib/Server/Plugins/SSHbase.py
parent7139c9cd7ea4a1d13323d4add72f87a0bd3f293f (diff)
downloadbcfg2-542dafea6974627df8e327be7f80d9f7bf417892.tar.gz
bcfg2-542dafea6974627df8e327be7f80d9f7bf417892.tar.bz2
bcfg2-542dafea6974627df8e327be7f80d9f7bf417892.zip
SSHBase: Make SSHBase aware of aliases
SSHBase is now aware of aliases listed in the clients.xml file. ClientMetadata now includes `addresses` which are a mapping from an alias to an (ip, name) tuple. The ip addresses can be specified either in clients.xml as an address attribute to the Alias or in DNS. Signed-off-by: Sol Jerome <solj@ices.utexas.edu> git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5295 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Plugins/SSHbase.py')
-rw-r--r--src/lib/Server/Plugins/SSHbase.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/lib/Server/Plugins/SSHbase.py b/src/lib/Server/Plugins/SSHbase.py
index 1485df626..242aaf580 100644
--- a/src/lib/Server/Plugins/SSHbase.py
+++ b/src/lib/Server/Plugins/SSHbase.py
@@ -28,7 +28,7 @@ class SSHbase(Bcfg2.Server.Plugin.Plugin,
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$'
__author__ = 'bcfg-dev@mcs.anl.gov'
@@ -143,6 +143,7 @@ class SSHbase(Bcfg2.Server.Plugin.Plugin,
def build_skn(self, entry, metadata):
'''This function builds builds a host specific known_hosts file'''
client = metadata.hostname
+ addresses = metadata.addresses
entry.text = self.skn
hostkeys = [keytmpl % client for keytmpl in self.pubkeys \
if (keytmpl % client) in self.entries]
@@ -150,6 +151,20 @@ class SSHbase(Bcfg2.Server.Plugin.Plugin,
for hostkey in hostkeys:
entry.text += "localhost,localhost.localdomain,127.0.0.1 %s" % (
self.entries[hostkey].data)
+ # add entries listed in clients.xml
+ for addr, (ip, host) in addresses.iteritems():
+ shortname = addr.split('.')[0]
+ fqdn = addr
+ if ip == None:
+ ipaddr = self.get_ipcache_entry(addr)[0]
+ else:
+ ipaddr = ip
+ for key in self.entries.keys():
+ if key.find('.pub.H_%s' % host) != -1:
+ entry.text += "%s,%s,%s %s" % (shortname,
+ fqdn,
+ ipaddr,
+ self.entries[key].data)
permdata = {'owner':'root', 'group':'root', 'perms':'0644'}
[entry.attrib.__setitem__(key, permdata[key]) for key in permdata]