Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling of SSH Protocol Banner timeout in PyEZ #1271

Open
chidanandpujar opened this issue Oct 9, 2023 · 2 comments
Open

Handling of SSH Protocol Banner timeout in PyEZ #1271

chidanandpujar opened this issue Oct 9, 2023 · 2 comments

Comments

@chidanandpujar
Copy link
Collaborator

chidanandpujar commented Oct 9, 2023

Handling of SSH Protocol Banner timeout in PyEZ

banner_timeout value has fixed value of 15 seconds as per paramiko, we will check if there is any option from paramik to change the default values .
              [paramiko/paramiko/transport.py at main · paramiko/paramiko (github.com)](https://github.com/paramiko/paramiko/blob/main/paramiko/transport.py#L517)
 
# how long (seconds) to wait for the SSH banner
                 self.banner_timeout = 15
@apurvaraghu
Copy link
Collaborator

As per the current version of Paramiko, we can pass 'banner_timeout' variable with required value while calling the connect method.

An example for the same is as below:

client = SSHClient()
client.connect('ssh.example.com', banner_timeout=200)

Totally there are 3 options available for timeout:
• banner_timeout - an optional timeout (in seconds) to wait for the SSH banner to be presented.
• timeout - an optional timeout (in seconds) for the TCP connect
• auth_timeout - an optional timeout (in seconds) to wait for an authentication response.

Link that references to these parameters in the paramiko cllient.py code:
https://github.com/paramiko/paramiko/blob/51eb55debf2ebfe56f38378005439a029a48225f/paramiko/client.py#L225-L235

@chidanandpujar
Copy link
Collaborator Author

chidanandpujar commented Sep 3, 2024

ncclient manger.connect method does not support the option to pass banner_timeout .

(Pdb) 
TypeError: connect() got an unexpected keyword argument 'banner_timeout'
> /root/pyez_release_272_py39/venv/lib/python3.9/site-packages/ncclient-0.6.15-py3.9.egg/ncclient/manager.py(187)connect()
-> return connect_ssh(*args, **kwds)
(Pdb) 
--Return--
> /root/pyez_release_272_py39/venv/lib/python3.9/site-packages/ncclient-0.6.15-py3.9.egg/ncclient/manager.py(187)connect()->None
-> return connect_ssh(*args, **kwds)
(Pdb) 
TypeError: connect() got an unexpected keyword argument 'banner_timeout'
> /root/pyez_release_272_py39/venv/lib/python3.9/site-packages/junos_eznc-2.7.1+9.ga64698b2.dirty-py3.9.egg/jnpr/junos/device.py(1376)open()
-> self._conn = netconf_ssh.connect(
(Pdb) 
> /root/pyez_release_272_py39/venv/lib/python3.9/site-packages/junos_eznc-2.7.1+9.ga64698b2.dirty-py3.9.egg/jnpr/junos/device.py(1396)open()
-> except NcErrors.AuthenticationError as err:

as of now, paramiko SSHClient() supports the banner_timeout .
paramiko.SSHClient() is used only in start_shell and scp modules, we will check whether we can support banner_timeout for these modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants