diff --git a/src/SSHLibrary/client.py b/src/SSHLibrary/client.py index 74c97e864..0f074b8b9 100644 --- a/src/SSHLibrary/client.py +++ b/src/SSHLibrary/client.py @@ -182,7 +182,7 @@ def close(self): pass def login(self, username=None, password=None, allow_agent=False, look_for_keys=False, delay=None, proxy_cmd=None, - read_config=False, jumphost_connection=None, keep_alive_interval='0 seconds'): + read_config=False, jumphost_connection=None, keep_alive_interval='0 seconds', disabled_algorithms=None): """Logs into the remote host using password authentication. This method reads the output from the remote host after logging in, @@ -224,7 +224,7 @@ def login(self, username=None, password=None, allow_agent=False, look_for_keys=F password = self._encode(password) try: self._login(username, password, allow_agent, look_for_keys, proxy_cmd, read_config, - jumphost_connection, keep_alive_interval) + jumphost_connection, keep_alive_interval, disabled_algorithms) except SSHClientException: self.client.close() raise SSHClientException(f"Authentication failed for user '{self._decode(username)}'.") @@ -249,7 +249,8 @@ def _read_login_output(self, delay): def login_with_public_key(self, username, keyfile, password, allow_agent=False, look_for_keys=False, delay=None, proxy_cmd=None, - jumphost_connection=None, read_config=False, keep_alive_interval='0 seconds'): + jumphost_connection=None, read_config=False, keep_alive_interval='0 seconds', + disabled_algorithms=None): """Logs into the remote host using the public key authentication. This method reads the output from the remote host after logging in, @@ -295,7 +296,8 @@ def login_with_public_key(self, username, keyfile, password, allow_agent=False, self._login_with_public_key(username, keyfile, password, allow_agent, look_for_keys, proxy_cmd, jumphost_connection, - read_config, keep_alive_interval) + read_config, keep_alive_interval, + disabled_algorithms) except SSHClientException: self.client.close() raise SSHClientException(f"Login with public key failed for user '{self._decode(username)}'.") @@ -836,7 +838,7 @@ def _get_jumphost_tunnel(self, jumphost_connection): return jumphost_transport.open_channel("direct-tcpip", dest_addr, jump_addr) def _login(self, username, password, allow_agent=False, look_for_keys=False, proxy_cmd=None, - read_config=False, jumphost_connection=None, keep_alive_interval=None): + read_config=False, jumphost_connection=None, keep_alive_interval=None, disabled_algorithms=None): if read_config: hostname = self.config.host self.config.host, username, self.config.port, proxy_cmd = \ @@ -857,7 +859,8 @@ def _login(self, username, password, allow_agent=False, look_for_keys=False, pro self.client.connect(self.config.host, self.config.port, username, password, look_for_keys=look_for_keys, allow_agent=allow_agent, - timeout=float(self.config.timeout), sock=sock_tunnel) + timeout=float(self.config.timeout), sock=sock_tunnel, + disabled_algorithms=disabled_algorithms) except paramiko.SSHException: pass transport = self.client.get_transport() @@ -868,7 +871,8 @@ def _login(self, username, password, allow_agent=False, look_for_keys=False, pro self.client.connect(self.config.host, self.config.port, username, password, look_for_keys=look_for_keys, allow_agent=allow_agent, - timeout=float(self.config.timeout), sock=sock_tunnel) + timeout=float(self.config.timeout), sock=sock_tunnel, + disabled_algorithms=disabled_algorithms) transport = self.client.get_transport() transport.set_keepalive(keep_alive_interval) except paramiko.AuthenticationException: @@ -886,7 +890,7 @@ def _login(self, username, password, allow_agent=False, look_for_keys=False, pro raise SSHClientException def _login_with_public_key(self, username, key_file, password, allow_agent, look_for_keys, proxy_cmd=None, - jumphost_connection=None, read_config=False, keep_alive_interval=None): + jumphost_connection=None, read_config=False, keep_alive_interval=None, disabled_algorithms=None): if read_config: hostname = self.config.host self.config.host, username, self.config.port, key_file, proxy_cmd = \ @@ -915,7 +919,8 @@ def _login_with_public_key(self, username, key_file, password, allow_agent, look allow_agent=allow_agent, look_for_keys=look_for_keys, timeout=float(self.config.timeout), - sock=sock_tunnel) + sock=sock_tunnel, + disabled_algorithms=disabled_algorithms) transport = self.client.get_transport() transport.set_keepalive(keep_alive_interval) except paramiko.AuthenticationException: