Skip to content

GH-3572: Migrate SFTP from jsch to sshd-sftp #3892

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

Merged
merged 3 commits into from
Sep 27, 2022

Conversation

artembilan
Copy link
Member

Fixes #3572

  • Rework SFTP module from the JSch API to more modern sshd-sftp
  • Migrate generics of most API from ChannelSftp.LsEntry to the SftpClient.DirEntry
  • Rework DefaultSftpSessionFactory to deal with an SshClient and create SftpClient wrapped to the SftpSession
  • Implement a ResourceKnownHostsServerKeyVerifier to load known-hosts from any possible resource
  • Implement an expected SftpSession.list() with just file name to take or pattern matching
  • Remove some unused tests and their config
  • Remove tests for custom UserInfo since we don't provide any custom out-of-the-box
  • Test a new ResourceKnownHostsServerKeyVerifier against default known-hosts file

@artembilan
Copy link
Member Author

This is huge breaking change for SFTP module, but it is still justified with today's trends.
Plus JSch is really obsoleted and abandoned library.

Copy link
Contributor

@garyrussell garyrussell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one minor doc change and a question/comment.

this.comparator = comparator;
@SuppressWarnings("unchecked")
public void setComparator(@Nullable Comparator<? extends F> comparator) {
this.comparator = (Comparator<F>) comparator;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not change the field (and FileUtils) too? (Instead of casting here).

@@ -10,6 +10,12 @@ The SFTP protocol requires a secure channel, such as SSH, and visibility to a cl
Spring Integration supports sending and receiving files over SFTP by providing three client side endpoints: inbound channel adapter, outbound channel adapter, and outbound gateway.
It also provides convenient namespace configuration to define these client components.

NOTE: Starting with version 6.0, an outdated JCraft JSch client has been replaced with modern https://mina.apache.org/sshd-project/index.html[Apache MINA SSHD] framework.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NOTE: Starting with version 6.0, an outdated JCraft JSch client has been replaced with modern https://mina.apache.org/sshd-project/index.html[Apache MINA SSHD] framework.
NOTE: Starting with version 6.0, the outdated JCraft JSch client has been replaced with the https://mina.apache.org/sshd-project/index.html[Apache MINA SSHD] framework.

@garyrussell
Copy link
Contributor

Please rebase to address what's new conflct.

Fixes spring-projects#3572

* Rework SFTP module from the JSch API to more modern `sshd-sftp`
* Migrate generics of most API from `ChannelSftp.LsEntry` to the `SftpClient.DirEntry`
* Rework `DefaultSftpSessionFactory` to deal with an `SshClient` and create `SftpClient`
wrapped to the `SftpSession`
* Implement a `ResourceKnownHostsServerKeyVerifier` to load `known-hosts` from any possible resource
* Implement an expected `SftpSession.list()` with just file name to take or pattern matching
* Remove some unused tests and their config
* Remove tests for custom `UserInfo` since we don't provide any custom out-of-the-box
* Test a new `ResourceKnownHostsServerKeyVerifier` against default `known-hosts` file
@garyrussell garyrussell merged commit 4aa2f91 into spring-projects:main Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sftp lacks support for ssh-ed25519 due to unmaintained library
2 participants