paramiko / paramiko/paramiko

Timeout when connecting to Solaris host regardless of timeout kwarg in SSH.connect()

Open
#1,629 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
9.9k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Description

Currently attempting to initiate a connection with a Solaris host, which I know I can connect to with SSH normally using OpenSSH on Mac, however attempting to connect with paramiko is timing out with the following:

  File "/Users/USER/PycharmProjects/PROJECT/src/Remote_Executor.py", line 38, in __init__
    self.client.connect(hostname=hostname, port=port, username=username, password=password, timeout=99999)
  File "/usr/local/lib/python3.7/site-packages/paramiko-2.7.1-py3.7.egg/paramiko/client.py", line 406, in connect
    t.start_client(timeout=timeout)
  File "/usr/local/lib/python3.7/site-packages/paramiko-2.7.1-py3.7.egg/paramiko/transport.py", line 660, in start_client
    raise e
  File "/usr/local/lib/python3.7/site-packages/paramiko-2.7.1-py3.7.egg/paramiko/transport.py", line 2055, in run
    ptype, m = self.packetizer.read_message()
  File "/usr/local/lib/python3.7/site-packages/paramiko-2.7.1-py3.7.egg/paramiko/packet.py", line 459, in read_message
    header = self.read_all(self.__block_size_in, check_rekey=True)
  File "/usr/local/lib/python3.7/site-packages/paramiko-2.7.1-py3.7.egg/paramiko/packet.py", line 299, in read_all
    raise EOFError()
EOFError

I am currently initiating the connection in a class like so:

class SSH(_RePyError):
    def __init__(self, username, hostname, password='', sudopass='', sudo=False, port=22, animation=None):
        self.username: str = username
        self.hostname: str = hostname
        self.password: str = password
        self.sudopass: str = sudopass
        self.sudo: bool = sudo
        self.port: int = port
        self.password_auth: bool = False

        self.hostkeys = paramiko.HostKeys()
        self.client = paramiko.SSHClient()
        self.client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        self.client.load_system_host_keys()

        if not self.hostkeys.lookup(hostname):
            if not password:
                animation.error(f'No hostkey detected, input password for {username}@{hostname}')
                password = getpass()
                animation.start('Identifying ...')

        if self.password:
            self.password_auth = True

            self.client.connect(hostname=hostname, port=port, username=username, password=password)
        else:
            self.client.connect(hostname=hostname, port=port, username=username)

If I set timeout = 9999999 in the self.client.connect() I am still receiving that EOFError after ~10 seconds.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Solaris connection using SSHClient.connect(), then trace the reported path through Transport.start_client() and packet.py's read_all(). Compare the Paramiko behavior with the successful OpenSSH connection; done means the EOFError and timeout behavior are explained and verified for the reported case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.