Implement SSH keepalives, default 30-second interval, for NETCONF over SSH sessions.#668
Implement SSH keepalives, default 30-second interval, for NETCONF over SSH sessions.#668stacywsmith wants to merge 6 commits into
Conversation
…ONF over SSH sessions. Without SSH keepalives, a NAT or stateful firewall along the network path between the PyEZ host and the target Junos device, may timeout an inactive TCP flow and cause the NETCONF over SSH session to hang. Sending SSH keepalives avoids this situation. The default value is 30 seconds. Setting this parameter to a value of 0 disables SSH keepalives. Note: This is a different situation than Issue Juniper#663 in which the target Junos device is timing out the NETCONF over SSH session due to a configured idle-timeout on the system login class.
|
There should be a check to make sure that this value in the ssh config file is not overridden. |
| ssh_config=self._sshconf_lkup(), | ||
| device_params={'name': 'junos', 'local': False}) | ||
|
|
||
| self._conn._session.transport.set_keepalive( |
There was a problem hiding this comment.
line 910 we are setting it to None for on-box if condition. So on on-box are not reaching line 924, hence converting None to int at line 1024 will throw exception.
vnitinv
left a comment
There was a problem hiding this comment.
Got 1 comment to be addressed.
|
Can one of the admins verify this patch? |
spidercensus
left a comment
There was a problem hiding this comment.
According to the docs for the Transport module:
| set_keepalive(self, interval)
| Turn on/off keepalive packets (default is off). If this is set, after
| interval seconds without sending any data over the connection, a
| "keepalive" packet will be sent (and ignored by the remote host). This
| can be useful to keep connections alive over a NAT, for example.
|
| :param int interval:
| seconds to wait before sending a keepalive packet (or
| 0 to disable keepalives).
So this means that at line 910 we should be setting keepalives to 0 by default, not None.
| self._hostname = 'localhost' | ||
| self._ssh_private_key_file = None | ||
| self._ssh_config = None | ||
| self._ssh_keepalives = None |
There was a problem hiding this comment.
Setting this to None does not make sense. This value is initialized to zero in the underlying module.
Help on method set_keepalive in module paramiko.transport:
set_keepalive(self, interval) method of paramiko.transport.Transport instance
Turn on/off keepalive packets (default is off). If this is set, after
interval seconds without sending any data over the connection, a
"keepalive" packet will be sent (and ignored by the remote host). This
can be useful to keep connections alive over a NAT, for example.
:param int interval:
seconds to wait before sending a keepalive packet (or
0 to disable keepalives).
There was a problem hiding this comment.
None is set for on-box python, where it won't use ssh connection. So this should be OK
Without SSH keepalives, a NAT or stateful firewall along the network
path between the PyEZ host and the target Junos device,
may timeout an inactive TCP flow and cause the NETCONF over SSH
session to hang. Sending SSH keepalives avoids this situation. The
default value is 30 seconds. Setting this parameter to a value of 0
disables SSH keepalives.
Note: This is a different situation than Issue #663 in which the
target Junos device is timing out the NETCONF over SSH session
due to a configured idle-timeout on the system login class.