Skip to content

Fix compatibility with paramiko >= 2.9.0 and older OpenSSH server versions - #1685

Merged
Kami merged 8 commits into
apache:trunkfrom
Kami:paramiko_2_9_compatibility
May 14, 2022
Merged

Kami merged 8 commits into
apache:trunkfrom
Kami:paramiko_2_9_compatibility

Conversation

@Kami

@Kami Kami commented May 6, 2022

Copy link
Copy Markdown
Member

This pull request updates paramiko SSH connection related code so it works with paramiko >= 2.9.0 and older OpenSSH server versions which don't support SHA-2 variants of the RSA key verification algorithm.

Background, Context

Paramiko v2.9.0 introduced a change which adds support and prefers SHA-2 variants of the RSA key verification algorithm (https://github.com/paramiko/paramiko/blob/2.9.0/sites/www/changelog.rst#changelog).

This change is backward incompatible and won't work it user tries to use paramiko >= 2.9.0 with older OpenSSH servers such as the default setup on Ubuntu 14.04.

Proposed Soluton

In this PR I introduced a change to fall back to the previous / old approach in case "authentication error" is throw when connecting to the server when running paramiko >= 2.9.0. Sadly there is no easy way to catch and retry only on more granular / specific exception.

This way the code works and supports older and newer versions of paramiko and OpenSSH servers.

Note on Security

For security reasons, if user knows they will only connect to new OpenSSH versions which support those variants + MSG_EXT_INFO extension, they are encouraged to disable this compatibility change by setting LIBCLOUD_PARAMIKO_SHA2_BACKWARD_COMPATIBILITY environment variable to false.

@codecov-commenter

codecov-commenter commented May 6, 2022 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 46.15385% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.25%. Comparing base (dd252cc) to head (2a58a1d).
⚠️ Report is 1226 commits behind head on trunk.

Files with missing lines Patch % Lines
libcloud/compute/ssh.py 46.15% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk    #1685      +/-   ##
==========================================
- Coverage   83.26%   83.25%   -0.00%     
==========================================
  Files         400      400              
  Lines       87321    87332      +11     
  Branches     9284     9285       +1     
==========================================
+ Hits        72701    72706       +5     
- Misses      11460    11466       +6     
  Partials     3160     3160              
Files with missing lines Coverage Δ
libcloud/compute/ssh.py 80.91% <46.15%> (-1.22%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Kami
Kami force-pushed the paramiko_2_9_compatibility branch from 50af355 to 29b0401 Compare May 11, 2022 18:51
@Kami
Kami merged commit 003040b into apache:trunk May 14, 2022
@Kami Kami added this to the v3.6.0 milestone Sep 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants