diff --git a/client-py3/full/src/uds/forward.py b/client-py3/full/src/uds/forward.py index 973f0c35..63db879e 100644 --- a/client-py3/full/src/uds/forward.py +++ b/client-py3/full/src/uds/forward.py @@ -23,7 +23,7 @@ class CheckfingerPrints(paramiko.MissingHostKeyPolicy): def missing_host_key(self, client, hostname, key): if self.fingerPrints: remotefingerPrints = hexlify(key.get_fingerprint()).decode().lower() - if remotefingerPrints not in self.fingerPrints: + if remotefingerPrints not in self.fingerPrints.split(','): logger.error("Server {!r} has invalid fingerPrints. ({} vs {})".format(hostname, remotefingerPrints, self.fingerPrints)) raise paramiko.SSHException( "Server {!r} has invalid fingerPrints".format(hostname) @@ -136,14 +136,14 @@ class ForwardThread(threading.Thread): def run(self): if self.client is None: - self.client = paramiko.SSHClient() - self.client.useCount = 1 # Custom added variable, to keep track on when to close tunnel - self.client.load_system_host_keys() - self.client.set_missing_host_key_policy(CheckfingerPrints(self.fingerPrints)) - - logger.debug('Connecting to ssh host %s:%d ...', self.server, self.port) - try: + self.client = paramiko.SSHClient() + self.client.useCount = 1 # Custom added variable, to keep track on when to close tunnel + self.client.load_system_host_keys() + self.client.set_missing_host_key_policy(CheckfingerPrints(self.fingerPrints)) + + logger.debug('Connecting to ssh host %s:%d ...', self.server, self.port) + self.client.connect(self.server, self.port, username=self.username, password=self.password, timeout=5) except Exception: logger.exception('Exception connecting: ') diff --git a/client/full/src/uds/forward.py b/client/full/src/uds/forward.py index f05cfc7e..d171f977 100644 --- a/client/full/src/uds/forward.py +++ b/client/full/src/uds/forward.py @@ -28,7 +28,8 @@ class CheckfingerPrints(paramiko.MissingHostKeyPolicy): def missing_host_key(self, client, hostname, key): if self.fingerPrints: remotefingerPrints = hexlify(key.get_fingerprint()).decode().lower() - if remotefingerPrints not in self.fingerPrints: + logger.debug('Checking keys {} against {}'.format(remotefingerPrints, self.fingerPrints)) + if remotefingerPrints not in self.fingerPrints.split(','): logger.error("Server {!r} has invalid fingerPrints. ({} vs {})".format(hostname, remotefingerPrints, self.fingerPrints)) raise paramiko.SSHException( "Server {!r} has invalid fingerPrints".format(hostname)