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
FTP: Refactoring on SSH (jsch -> sshj) (previously "Secure FTP connection intermittently fails") #373
Conversation
@argast According to #197 you worked on key based authentication for the sFTP integration. As explained in #365 we've had to change the ssh library we relied on. I've adapted the code but now the |
@juanjovazquez in
Tests pass. In Maybe it's enough? Bare in mind my knowledge is quite limited :) |
Yes, this option was added because test key was in less secure des format which required additional ssh option to authenticate with it. |
@juanjovazquez actually I've made mistake I have the same error...I'll try to play around with it tomorrow. |
7f2732c
to
ec26561
Compare
ec26561
to
b5eb7f6
Compare
case identity: KeyFileSftpIdentity => | ||
ftpClient.addIdentity(identity.privateKey, identity.publicKey.orNull, identity.password.orNull) | ||
} | ||
// ssh connection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: maybe we could do without these comments
handler.get(name) | ||
val remoteFile = handler.open(name, Set(OpenMode.READ).asJava) | ||
val is = new remoteFile.RemoteFileInputStream() | ||
if (is != null) is else throw new IOException(s"$name: No such file or directory") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be
Option(is).getOrElse(throw new IOException(s"$name: No such file or directory"))
val remoteFile = | ||
handler.open(name, openModes.asJava) | ||
val os = new remoteFile.RemoteFileOutputStream() | ||
if (os != null) os else throw new IOException(s"Could not write to $name") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as above
import OpenMode._ | ||
val openModes = Set(WRITE, CREAT) ++ (if (append) Set(APPEND) else Set()) | ||
val remoteFile = | ||
handler.open(name, openModes.asJava) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting: this could be put on the line above
b5eb7f6
to
50ef97b
Compare
@svezfaz Your requests have been applied. Thanks!. |
What is the status of this PR? Is this now a complete replacement for the problematic approach or is there still work to do around host checking? |
@raboof IMHO this PR is ready for merging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look reasonable, did some testing myself, appears to work.
The sshj library is used now instead of jsch for ssh handling. Both main and test code have been accordingly updated. The original and motivating issue regarding intermittent cryptography-related failures is no longer observed (at least for the time being).
closes #365