Commit 545149a2 authored by Michal Horejsek's avatar Michal Horejsek

Support also other keys (not only RSA)

parent e391999d
......@@ -42,8 +42,10 @@ class ProxySSHFactory(factory.SSHFactory):
"""
def __init__(self, cmd_args):
self.publicKeys = {b'ssh-rsa': keys.Key.fromString(data=cmd_args.public_key)}
self.privateKeys = {b'ssh-rsa': keys.Key.fromString(data=cmd_args.private_key)}
public_key = keys.Key.fromString(data=cmd_args.public_key)
private_key = keys.Key.fromString(data=cmd_args.private_key)
self.publicKeys = {public_key.sshType(): public_key}
self.privateKeys = {private_key.sshType(): private_key}
self.services = {
b'ssh-userauth': userauth.SSHUserAuthServer,
b'ssh-connection': connection.SSHConnection,
......
......@@ -15,7 +15,7 @@ def read_key(filename, default):
if not filename:
return default
try:
return open(filename).read()
return open(filename, 'rb').read()
except Exception as exc:
raise usage.UsageError('Problem to read the key {}: {}'.format(filename, exc))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment