Skip to content

Intermittent "Incompatible ssh peer (no acceptable kex algorithm)" since upgrading from 2.11 to 3.x #2252

Open

Description

@shorton3

Hello, since upgrading from paramiko 2.11.0 to 3.0.0 (and now 3.2.0), we have had an -intermittent- issue with connecting to Juniper Junos network devices:

File "/opt/python3-virtualenv/lib64/python3.9/site-packages/paramiko/client.py", line 420, in connect
t.start_client(timeout=timeout)
File "/opt/python3-virtualenv/lib64/python3.9/site-packages/paramiko/transport.py", line 703, in start_client
raise e
File "/opt/python3-virtualenv/lib64/python3.9/site-packages/paramiko/transport.py", line 2136, in run
self._handler_table[ptype](self, m)
File "/opt/python3-virtualenv/lib64/python3.9/site-packages/paramiko/transport.py", line 2256, in _negotiate_keys
self._parse_kex_init(m)
File "/opt/python3-virtualenv/lib64/python3.9/site-packages/paramiko/transport.py", line 2449, in _parse_kex_init
raise IncompatiblePeer(
paramiko.ssh_exception.IncompatiblePeer: Incompatible ssh peer (no acceptable kex algorithm)

  • restarting our paramiko application immediately resolves the problem, but it keeps popping up several random times each day: some connections work to some devices and some do not, and there appears to be no pattern to which devices and when.

  • as mentioned here, we tried setting preferred_kex and disabled_algorithms, but neither solved the issue

From the Juniper network device, we see:
sshd[96499]: Unable to negotiate with x.x.x.x port 10562: no matching key exchange method found. Their offer:
diffie-hellman-group14-sha1,
diffie-hellman-group-exchange-sha1,
diffie-hellman-group-exchange-sha256,
diffie-hellman-group1-sha1,
ext-info-c

although that same device is configured with the following kex:
[email protected]
ecdh-sha2-nistp256
ecdh-sha2-nistp384
ecdh-sha2-nistp521
diffie-hellman-group16-sha512
diffie-hellman-group-exchange-sha256
diffie-hellman-group14-sha256
diffie-hellman-group-exchange-sha1
diffie-hellman-group14-sha1
diffie-hellman-group1-sha1

Anyone know what could be causing this please?

Activity

  1. stephan1373 commented on Jun 9, 2023

    @stephan1373

    Small update:

    • we made a mistake with the disabled_algorithms option; we have now correctly disabled [email protected] and are retesting now (I will comment again with test results on Monday, 6/12/23)
    • Local version/idstring: SSH-2.0-paramiko_3.2.0
    • Remote version/idstring: SSH-2.0-OpenSSH_7.5

    I have attached log output from same client/server devices - one that worked, one that did not (same day, similar times):
    incompatibleSshPeer_curve25519-sha256_example1.txt
    working_curve25519-sha256_example1.txt

    The approximate time we noticed this error: towards the beginning of the 2nd quarter 2023.

  2. stephan1373 commented on Jun 13, 2023

    @stephan1373

    I had promised to update this issue with our continued observations. So far: this issue has not resurfaced since Friday, June 9th 2023 (as of: 6/13/2023 3:00 PM CST) - with the disabled_algorithms change Stephen mentioned, above.

  3. bskinn commented on Jun 14, 2023

    @bskinn
    Contributor

    Thanks for the report and the updates, @stephan1373.

    If it continues to behave well for a week or so, that probably warrants closing the ticket as resolved?


    Also, be aware that bitprophet is working on fully overhauled key/auth machinery (see #387 and #23, at least), work which is now partially complete. Please check out the experimental new features described in the 3.2.0 paramiko CHANGELOG (including the new OpenSSHAuthStrategy implementation in Fabric 3.1.0).

    Once the new machinery is fully tested and proved out, it will replace the current, painfully hacky disabled_algorithms approach, and you will need to migrate. If you have the bandwidth to test the new experimental features, we would greatly appreciate any investigation you might be able to do and report back here.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions