【发布时间】:2019-04-04 14:14:17
【问题描述】:
我们将 Spring Batch Admin 用于连接到不同远程 SFTP 服务器的不同作业。我们有两个 SBA,所以我实际上已经将这项工作从旧版本转移到了新版本。
所有作业都在 Jcraft 中使用 JSch,我已将此版本从 0.1.42 升级到 0.1.54。除了这个最新的工作之外,所有工作都运行良好,它们连接起来没有任何问题。
在这份工作中,我遇到了连接超时,我不明白为什么。
另一个(大)问题是我无法从我自己的计算机上进行本地故障排除,我什至无法从我的计算机上通过 WinSCP 登录到这个远程 SFTP 帐户来验证它自己的连接。 SFTP 服务器的所有者说他们可以在他们的防火墙中看到我的连接,但看不到我的连接,也没有连接到他们的 SFTP。唯一在他们的 SFTP 服务器上看到成功连接的人,所以他们看不到为什么我无法连接,因为我的连接失败了。
我在 Java 8 和 Java 7 中都添加了新策略。 我仍然无法完成我的工作。我在 StackOverflow 和 Google 上进行了搜索,但没有找到任何解决方案。 我在新旧作业中都使用 Springframework 集成 sftp Session 和 DefaultSftpSessionFactory 版本 2.0.3。我们使用 Java 7 和 Tomcat 8,并在 Tomcat 中添加了“-Dhttps.protocols=TLSv1.1,TLSv1.2”
这是 Jsch 版本为 0.1.54 的新作业连接到 SFTP 服务器时的日志
com.jcraft.jsch (log:52) - Connecting to XX.XXX.XX.XX port 22
com.jcraft.jsch (log:52) - Connection established
com.jcraft.jsch (log:52) - Remote version string: SSH-2.0-1.86 FRES
com.jcraft.jsch (log:52) - Local version string: SSH-2.0-JSCH-0.1.54
com.jcraft.jsch (log:52) - CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
com.jcraft.jsch (log:52) - CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
com.jcraft.jsch (log:52) - diffie-hellman-group14-sha1 is not available.
com.jcraft.jsch (log:52) - CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
com.jcraft.jsch (log:52) - SSH_MSG_KEXINIT sent
com.jcraft.jsch (log:52) - SSH_MSG_KEXINIT received
com.jcraft.jsch (log:52) - kex: server: diffie-hellman-group14-sha256,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
com.jcraft.jsch (log:52) - kex: server: ssh-rsa
com.jcraft.jsch (log:52) - kex: server: aes256-cbc,aes256-ctr,3des-cbc
com.jcraft.jsch (log:52) - kex: server: aes256-cbc,aes256-ctr,3des-cbc
com.jcraft.jsch (log:52) - kex: server: hmac-sha2-256,hmac-sha1,hmac-md5,hmac-sha1-96,hmac-md5-96
com.jcraft.jsch (log:52) - kex: server: hmac-sha2-256,hmac-sha1,hmac-md5,hmac-sha1-96,hmac-md5-96
com.jcraft.jsch (log:52) - kex: server: zlib,none
com.jcraft.jsch (log:52) - kex: server: zlib,none
com.jcraft.jsch (log:52) - kex: server:
com.jcraft.jsch (log:52) - kex: server:
com.jcraft.jsch (log:52) - kex: client: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
com.jcraft.jsch (log:52) - kex: client: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
com.jcraft.jsch (log:52) - kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc
com.jcraft.jsch (log:52) - kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc
com.jcraft.jsch (log:52) - kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
com.jcraft.jsch (log:52) - kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
com.jcraft.jsch (log:52) - kex: client: none
com.jcraft.jsch (log:52) - kex: client: none
com.jcraft.jsch (log:52) - kex: client:
com.jcraft.jsch (log:52) - kex: client:
com.jcraft.jsch (log:52) - kex: server->client 3des-cbc hmac-md5 none
com.jcraft.jsch (log:52) - kex: client->server 3des-cbc hmac-md5 none
com.jcraft.jsch (log:52) - SSH_MSG_KEX_DH_GEX_REQUEST(1024<1024<1024) sent
com.jcraft.jsch (log:52) - expecting SSH_MSG_KEX_DH_GEX_GROUP
com.jcraft.jsch (log:52) - Disconnecting from XX.XXX.XX.XX port 22
Jsch 版本为 0.1.42 的旧版本作业连接到 SFTP 服务器时的日志
com.jcraft.jsch (log:52) - Connecting to XX.XXX.XX.XX port 22
com.jcraft.jsch (log:52) - Connection established
com.jcraft.jsch (log:52) - Remote version string: SSH-2.0-1.86 FRES
com.jcraft.jsch (log:52) - Local version string: SSH-2.0-JSCH-0.1.42
com.jcraft.jsch (log:52) - CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
com.jcraft.jsch (log:52) - SSH_MSG_KEXINIT sent
com.jcraft.jsch (log:52) - SSH_MSG_KEXINIT received
com.jcraft.jsch (log:52) - kex: server->client 3des-cbc hmac-md5 none
com.jcraft.jsch (log:52) - kex: client->server 3des-cbc hmac-md5 none
com.jcraft.jsch (log:52) - SSH_MSG_KEXDH_INIT sent
com.jcraft.jsch (log:52) - expecting SSH_MSG_KEXDH_REPLY
com.jcraft.jsch (log:52) - ssh_rsa_verify: signature true
com.jcraft.jsch (log:52) - Host 'XX.XXX.XX.XX' is known and mathces the RSA host key
com.jcraft.jsch (log:52) - SSH_MSG_NEWKEYS sent
com.jcraft.jsch (log:52) - SSH_MSG_NEWKEYS received
com.jcraft.jsch (log:52) - SSH_MSG_SERVICE_REQUEST sent
com.jcraft.jsch (log:52) - SSH_MSG_SERVICE_ACCEPT received
com.jcraft.jsch (log:52) - Authentications that can continue: keyboard-interactive,password
com.jcraft.jsch (log:52) - Next authentication method: keyboard-interactive
com.jcraft.jsch (log:52) - Authentications that can continue: password
com.jcraft.jsch (log:52) - Next authentication method: password
com.jcraft.jsch (log:52) - Authentication succeeded (password).
job.FtpFileFetcher (downloadFile:62) - Listing remote directory: .
job.FtpFileFetcher (downloadFile:64) - Found 2 entries in: .,
job.FtpFileFetcher (filterEntries:139) - file: file_20190218221932.xml attributes: -rw-rw-rw- 0 0 3369 Mon Feb 18 22:19:33 CET 2019
job.FtpFileFetcher (filterEntries:139) - file: file_20190219214922.xml attributes: -rw-rw-rw- 0 0 3369 Tue Feb 19 21:49:22 CET 2019
job.FtpFileFetcher (downloadFile:66) - Found 2 files in: ., matching pattern: file.\d{14}.xml
job.FtpFileFetcher (downloadFile:71) - Fetching matching file file_20190219214922.xml to local directory K:/files
job.FtpFileFetcher (executeDownload:104) - Downloading remote file ./file_20190219214922.xml to K:\files\file_20190219214922.xml
com.jcraft.jsch (log:52) - Disconnecting from XX.XXX.XX.XX port 22
我看到了区别,但我不明白哪里出了问题,我希望这里有人可以帮助我。 如果您需要查看更多内容,请询问 谢谢
【问题讨论】:
-
“我在他们的防火墙中的连接,但没有超出,也没有连接到他们的 SFTP” -- 他们的 SSH/SFTP 服务器已经响应(
Remote version string: SSH-2.0-1.86 FRES+SSH_MSG_KEXINIT received) -- 所以这不可能是真的 + 即使这是真的,他们的防火墙不允许进一步连接到他们的 SSH/SFTP 服务器也不是你的问题。 -
我联系了他们,他们现在说他们不会记录不成功的尝试,我觉得这有点奇怪。为什么你只想记录成功的尝试...?
标签: java sftp jsch spring-integration-sftp