You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Team,
We are using Spring Integration to connect to Sftp and download file, Unfortunately we have to customize the SshClient due to Key Algorithms at server, we created custom client and configured server verifier to client and created Session factory. Unfortunately we are not able call below method as we are using custom client.
public void setAllowUnknownKeys(boolean allowUnknownKeys) {
Assert.state(this.isInnerClient, "An AcceptAllServerKeyVerifier must be configured on the externally provided SshClient instance");
this.allowUnknownKeys = allowUnknownKeys;
}
During session creation in below line we are again setting the Host Verifier to SSH client with out validating Internal / external client
Unfortunately the current GA code comes with a bug where we mutate an externally provided SshClient.
The version with the fix is going to be released in two weeks.
As a workaround I only see the way implement some custom SessionFactory<SftpClient.DirEntry> which is just fully based on an external SshClient.
Or you can use a 6.0.5-SNAPSHOT for now.
Closing this one as a duplicate of the mentioned one.
Hi Team,
We are using Spring Integration to connect to Sftp and download file, Unfortunately we have to customize the SshClient due to Key Algorithms at server, we created custom client and configured server verifier to client and created Session factory. Unfortunately we are not able call below method as we are using custom client.
public void setAllowUnknownKeys(boolean allowUnknownKeys) {
Assert.state(this.isInnerClient, "An
AcceptAllServerKeyVerifier
must be configured on the externally provided SshClient instance");this.allowUnknownKeys = allowUnknownKeys;
}
During session creation in below line we are again setting the Host Verifier to SSH client with out validating Internal / external client
spring-integration/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/session/DefaultSftpSessionFactory.java
Line 352 in e03d125
_private void doInitClient() throws IOException {
if (this.port <= 0) {
this.port = SshConstants.DEFAULT_PORT;
}
ServerKeyVerifier serverKeyVerifier = this.allowUnknownKeys ? AcceptAllServerKeyVerifier.INSTANCE : RejectAllServerKeyVerifier.INSTANCE;
if (this.knownHosts != null) {
serverKeyVerifier = new ResourceKnownHostsServerKeyVerifier(this.knownHosts);
}
this.sshClient.setServerKeyVerifier(serverKeyVerifier);
this.sshClient.setPasswordIdentityProvider(PasswordIdentityProvider.wrapPasswords(this.password));
}_
I believe below has to set only if it is innerClient true
this.sshClient.setServerKeyVerifier(serverKeyVerifier);
Please help to review and suggest.
The text was updated successfully, but these errors were encountered: