Skip to content
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

[SFTP] [v6 Regression] upload fails with "Server key did not validate" #8782

Closed
mysteryboy2000 opened this issue Oct 31, 2023 · 2 comments
Closed
Labels
status: duplicate There is already an issue similar to this. The link to it should be present

Comments

@mysteryboy2000
Copy link

mysteryboy2000 commented Oct 31, 2023

In what version(s) of Spring Integration are you seeing this issue?

  • Integration core 6.1.3
  • Spring Boot 3.1.4

Describe the bug

below is the stack trace.

Caused by: org.springframework.messaging.MessagingException: Failed to execute on session
	at org.springframework.integration.file.remote.RemoteFileTemplate.execute(RemoteFileTemplate.java:461)
	at [MASKED].NfsRepository.uploadFiles(NfsRepository.java:39)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:751)
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:751)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:703)
	at [MASKED].NfsRepository$$SpringCGLIB$$0.uploadFiles(<generated>)

Caused by: org.springframework.integration.util.PoolItemNotAvailableException: Failed to obtain pooled item
	at org.springframework.integration.util.SimplePool.getItem(SimplePool.java:196)
	at org.springframework.integration.file.remote.session.CachingSessionFactory.getSession(CachingSessionFactory.java:134)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:237)
	at jdk.proxy3/jdk.proxy3.$Proxy147.getSession(Unknown Source)
	at org.springframework.integration.file.remote.RemoteFileTemplate.execute(RemoteFileTemplate.java:447)
	... 172 common frames omitted

Caused by: java.lang.IllegalStateException: failed to create SFTP Session
	at org.springframework.integration.sftp.session.DefaultSftpSessionFactory.getSession(DefaultSftpSessionFactory.java:297)
	at org.springframework.integration.sftp.session.DefaultSftpSessionFactory.getSession(DefaultSftpSessionFactory.java:75)
	at org.springframework.integration.file.remote.session.CachingSessionFactory$1.createForPool(CachingSessionFactory.java:85)
	at org.springframework.integration.file.remote.session.CachingSessionFactory$1.createForPool(CachingSessionFactory.java:82)
	at org.springframework.integration.util.SimplePool.doGetItem(SimplePool.java:206)
	at org.springframework.integration.util.SimplePool.getItem(SimplePool.java:187)
	... 181 common frames omitted

Caused by: org.apache.sshd.common.SshException: Server key did not validate
	at org.apache.sshd.common.future.AbstractSshFuture.verifyResult(AbstractSshFuture.java:127)
	at org.apache.sshd.client.future.DefaultAuthFuture.verify(DefaultAuthFuture.java:39)
	at org.apache.sshd.client.future.DefaultAuthFuture.verify(DefaultAuthFuture.java:32)
	at org.apache.sshd.common.future.VerifiableFuture.verify(VerifiableFuture.java:43)
	at org.apache.sshd.common.future.VerifiableFuture.verify(VerifiableFuture.java:68)
	at org.springframework.integration.sftp.session.DefaultSftpSessionFactory.initClientSession(DefaultSftpSessionFactory.java:324)
	at org.springframework.integration.sftp.session.DefaultSftpSessionFactory.getSession(DefaultSftpSessionFactory.java:287)
	... 186 common frames omitted

Caused by: org.apache.sshd.common.SshException: Server key did not validate
	at org.apache.sshd.client.session.AbstractClientSession.checkKeys(AbstractClientSession.java:629)
	at org.apache.sshd.common.session.helpers.AbstractSession.handleKexMessage(AbstractSession.java:726)
	at org.apache.sshd.common.session.helpers.AbstractSession.doHandleMessage(AbstractSession.java:590)
	at org.apache.sshd.common.session.helpers.AbstractSession.lambda$handleMessage$0(AbstractSession.java:522)
	at org.apache.sshd.common.util.threads.ThreadUtils.runAsInternal(ThreadUtils.java:68)
	at org.apache.sshd.common.session.helpers.AbstractSession.handleMessage(AbstractSession.java:521)
	at org.apache.sshd.common.session.helpers.AbstractSession.decode(AbstractSession.java:1639)
	at org.apache.sshd.common.session.helpers.AbstractSession.messageReceived(AbstractSession.java:482)
	at org.apache.sshd.common.session.helpers.AbstractSessionIoHandler.messageReceived(AbstractSessionIoHandler.java:64)
	at org.apache.sshd.common.io.nio2.Nio2Session.handleReadCycleCompletion(Nio2Session.java:407)
	at org.apache.sshd.common.io.nio2.Nio2Session$1.onCompleted(Nio2Session.java:380)
	at org.apache.sshd.common.io.nio2.Nio2Session$1.onCompleted(Nio2Session.java:375)
	at org.apache.sshd.common.io.nio2.Nio2CompletionHandler.lambda$completed$0(Nio2CompletionHandler.java:38)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
	at org.apache.sshd.common.io.nio2.Nio2CompletionHandler.completed(Nio2CompletionHandler.java:37)
	at java.base/sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:129)
	at java.base/sun.nio.ch.Invoker$2.run(Invoker.java:221)
	at java.base/sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:113)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)

To Reproduce

works on

  • spring-integration-sftp:6.0.2(integration core jar version5.5.15)
  • Spring Boot version : 2.7.4

the known_host looks like this
10.0.0.100 ssh-rsa AAAAB3NzaC1yc[MASKED]PrL4NHSOuaXYZj52Q==

Expected behavior

upload success.

A bit more
may be same issue like 8693

@mysteryboy2000 mysteryboy2000 added status: waiting-for-triage The issue need to be evaluated and its future decided type: bug labels Oct 31, 2023
@artembilan
Copy link
Member

Yes. It is indeed looks like the same issue.
Is it hard for you to add a known_host entry based on host name, but not an IP address?

@artembilan artembilan added status: waiting-for-reporter Needs a feedback from the reporter and removed status: waiting-for-triage The issue need to be evaluated and its future decided labels Oct 31, 2023
@artembilan
Copy link
Member

More discussion is here: #8693.
So, closing this one as duplication of that.

@artembilan artembilan closed this as not planned Won't fix, can't repro, duplicate, stale Nov 3, 2023
@artembilan artembilan added status: duplicate There is already an issue similar to this. The link to it should be present and removed status: waiting-for-reporter Needs a feedback from the reporter type: bug labels Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate There is already an issue similar to this. The link to it should be present
Projects
None yet
Development

No branches or pull requests

2 participants