aker-gateway / Aker

SSH bastion/jump host/jumpserver
Other
568 stars 81 forks source link

EOFError #12

Closed supertylerc closed 6 years ago

supertylerc commented 7 years ago

Hi.

Sometimes, an EOFError is raised on embedded devices or devices for which the SSH implementation cannot be fixed by the end user. Right now, I have a local patch that fixes this by catching the exception and closing the transport and socket but not bubbling the error up. It looks like this:

try:
    self._start_session(transport)
except EOFError as e:
    logging.error('Received EOFError.  Assuming bad SSH implementation.')
    logging.error('Stack trace: {}'.format(e))
    self._session.close_session()
    if transport:
        transport.close()
    self._socket.close()
except Exception as e:
    logging.error(e)
    self._session.close_session()
    if transport:
        transport.close()
    self._socket.close()
    raise e

Would you accept a pull request for this? It should probably ultimately be refactored to be less ugly and repeated less.

Thanks!

anazmy commented 7 years ago

Thanks, please do, I'm desperately looking for contributions :-)