mirror of
https://github.com/xcat2/confluent.git
synced 2025-08-26 13:10:38 +00:00
Hook the custom keyhandler policy
This actually uses the previously commited class, with one fix for the structure of the key as passed into the callback.
This commit is contained in:
@@ -34,7 +34,7 @@ class HostKeyHandler(paramiko.client.MissingHostKeyPolicy):
|
||||
self.node = node
|
||||
|
||||
def missing_host_key(self, client, hostname, key):
|
||||
fingerprint = 'sha512$' + hashlib.sha512(key).hexdigest()
|
||||
fingerprint = 'sha512$' + hashlib.sha512(key.asbytes()).hexdigest()
|
||||
cfg = self.cfm.get_node_attributes(
|
||||
self.node, ('pubkeys.ssh', 'pubkeys.addpolicy'))
|
||||
if 'pubkeys.ssh' not in cfg[self.node]:
|
||||
@@ -89,7 +89,8 @@ class SshShell(conapi.Console):
|
||||
|
||||
def logon(self):
|
||||
self.ssh = paramiko.SSHClient()
|
||||
self.ssh.set_missing_host_key_policy(paramiko.client.AutoAddPolicy())
|
||||
self.ssh.set_missing_host_key_policy(
|
||||
HostKeyHandler(self.nodeconfig, self.node))
|
||||
try:
|
||||
self.ssh.connect(self.node, username=self.username,
|
||||
password=self.password, allow_agent=False,
|
||||
|
Reference in New Issue
Block a user