2016-05-17 58 views
7

新しいJSch 0.1.53 libraryをダウンロードし、JSch(sftp)のダウンロードタスクが機能しなくなりました。このリリースでは、session.connect()関数がエラーSession.connect: java.io.IOException: End of IO Stream Readを投げるときに失敗します。JSch 0.1.53 session.connect()が "IOストリームの読み取りの終了"をスローする

私の古いjsch.jar(2011-10-06)は、同じホストに対してうまく動作しますか、おそらく私は新しい設定の小道具を紛失していますか?

Session session=null; 
ChannelSftp channel=null; 
try { 
    JSch.setLogger(SSHUtil.createJschLogger()); 

    JSch jsch=new JSch(); 
    session=jsch.getSession("myuser", "11.22.33.44", 22); 
    session.setConfig("StrictHostKeyChecking", "no"); 
    session.setPassword("mypwd"); 
    session.connect(2000); // <-- FAILS HERE 
    channel = (ChannelSftp)session.openChannel("sftp"); 
    channel.connect(2000); 
    ... 

これは、何が起こっているかを示す広範なJSchログです。

INFO : Connecting to 11.22.33.44 port 22 
INFO : Connection established 
INFO : Remote version string: SSH-2.0-OpenSSH_6.6.1 
INFO : Local version string: SSH-2.0-JSCH-0.1.53 
INFO : CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256 
INFO : aes256-ctr is not available. 
INFO : aes192-ctr is not available. 
INFO : aes256-cbc is not available. 
INFO : aes192-cbc is not available. 
INFO : CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521 
INFO : diffie-hellman-group14-sha1 is not available. 
INFO : ecdh-sha2-nistp256 is not available. 
INFO : ecdh-sha2-nistp384 is not available. 
INFO : ecdh-sha2-nistp521 is not available. 
INFO : CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521 
INFO : ecdsa-sha2-nistp256 is not available. 
INFO : ecdsa-sha2-nistp384 is not available. 
INFO : ecdsa-sha2-nistp521 is not available. 
INFO : SSH_MSG_KEXINIT sent 
INFO : SSH_MSG_KEXINIT received 
INFO : kex: server: [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 
INFO : kex: server: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ssh-ed25519 
INFO : kex: server: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,[email protected],[email protected],[email protected],aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] 
INFO : kex: server: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,[email protected],[email protected],[email protected],aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] 
INFO : kex: server: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-sha1,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 
INFO : kex: server: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-sha1,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 
INFO : kex: server: none,[email protected] 
INFO : kex: server: none,[email protected] 
INFO : kex: server: 
INFO : kex: server: 
INFO : kex: client: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1 
INFO : kex: client: ssh-rsa,ssh-dss 
INFO : kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc 
INFO : kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc 
INFO : kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96 
INFO : kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96 
INFO : kex: client: none 
INFO : kex: client: none 
INFO : kex: client: 
INFO : kex: client: 
INFO : kex: server->client aes128-ctr hmac-md5 none 
INFO : kex: client->server aes128-ctr hmac-md5 none 
INFO : SSH_MSG_KEX_DH_GEX_REQUEST(1024<1024<1024) sent 
INFO : expecting SSH_MSG_KEX_DH_GEX_GROUP 
INFO : Disconnecting from 11.22.33.44 port 22 
Exception in thread "main" com.jcraft.jsch.JSchException: Session.connect: java.io.IOException: End of IO Stream Read 
     at com.jcraft.jsch.Session.connect(Session.java:558) 
     at com.jcraft.jsch.Session.connect(Session.java:183) 
     at my.test.DownloadSFTP.main(DownloadSFTP.java:37) 
Caused by: java.io.IOException: End of IO Stream Read 
     at com.jcraft.jsch.IO.getByte(IO.java:84) 
     at com.jcraft.jsch.Session.read(Session.java:918) 
     at com.jcraft.jsch.Session.connect(Session.java:323) 

私は、これはログです、また、ダウンロードタスクは正常に動作し、非常に古いJsch.jar(2011-10-06)を持っています。私がアップグレードしたい理由は、この非常に遅いファイルの転送です。新しいリリースは私が読んだことをより良くするはずです。

INFO : Connecting to 11.22.33.44 port 22 
INFO : Connection established 
INFO : Remote version string: SSH-2.0-OpenSSH_6.6.1 
INFO : Local version string: SSH-2.0-JSCH-0.1.44 
INFO : CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256 
INFO : aes256-ctr is not available. 
INFO : aes192-ctr is not available. 
INFO : aes256-cbc is not available. 
INFO : aes192-cbc is not available. 
INFO : arcfour256 is not available. 
INFO : SSH_MSG_KEXINIT sent 
INFO : SSH_MSG_KEXINIT received 
INFO : kex: server->client aes128-ctr hmac-md5 none 
INFO : kex: client->server aes128-ctr hmac-md5 none 
INFO : SSH_MSG_KEXDH_INIT sent 
INFO : expecting SSH_MSG_KEXDH_REPLY 
INFO : ssh_rsa_verify: signature true 
WARN : Permanently added '11.22.33.44' (RSA) to the list of known hosts. 
INFO : SSH_MSG_NEWKEYS sent 
INFO : SSH_MSG_NEWKEYS received 
INFO : SSH_MSG_SERVICE_REQUEST sent 
INFO : SSH_MSG_SERVICE_ACCEPT received 
INFO : Authentications that can continue: publickey,keyboard-interactive,password 
INFO : Next authentication method: publickey 
INFO : Authentications that can continue: keyboard-interactive,password 
INFO : Next authentication method: keyboard-interactive 
INFO : Authentication succeeded (keyboard-interactive). 
INFO : Disconnecting from 11.22.33.44 port 22 
INFO : Caught an exception, leaving main loop due to socket closed 

EDIT 私はMaven repositoryにリリースをバックステップするためのアイデアを持っていたし、実際にそれが正常に動作していない、この非常に新しいリリースです。以前のjsch-0.1.52.jarリリースは正常に動作します。私は図書館の開発者に連絡しようとします。

これは、動作中の0.1.52リリースのログです。サーバはJSCHがそれを使用しようとするので、あまりにもサポートするために主張して何

INFO : Connecting to 11.22.33.44 port 22 
INFO : Connection established 
INFO : Remote version string: SSH-2.0-OpenSSH_6.6.1 
INFO : Local version string: SSH-2.0-JSCH-0.1.52 
INFO : CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256 
INFO : aes256-ctr is not available. 
INFO : aes192-ctr is not available. 
INFO : aes256-cbc is not available. 
INFO : aes192-cbc is not available. 
INFO : CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521 
INFO : diffie-hellman-group14-sha1 is not available. 
INFO : ecdh-sha2-nistp256 is not available. 
INFO : ecdh-sha2-nistp384 is not available. 
INFO : ecdh-sha2-nistp521 is not available. 
INFO : CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521 
INFO : ecdsa-sha2-nistp256 is not available. 
INFO : ecdsa-sha2-nistp384 is not available. 
INFO : ecdsa-sha2-nistp521 is not available. 
INFO : SSH_MSG_KEXINIT sent 
INFO : SSH_MSG_KEXINIT received 
INFO : kex: server: [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 
INFO : kex: server: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ssh-ed25519 
INFO : kex: server: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,[email protected],[email protected],[email protected]nssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] 
INFO : kex: server: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,[email protected],[email protected],[email protected],aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected] 
INFO : kex: server: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-sha1,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 
INFO : kex: server: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-sha1,[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96 
INFO : kex: server: none,[email protected] 
INFO : kex: server: none,[email protected] 
INFO : kex: server: 
INFO : kex: server: 
INFO : kex: client: diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256 
INFO : kex: client: ssh-rsa,ssh-dss 
INFO : kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc 
INFO : kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc 
INFO : kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96 
INFO : kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96 
INFO : kex: client: none 
INFO : kex: client: none 
INFO : kex: client: 
INFO : kex: client: 
INFO : kex: server->client aes128-ctr hmac-md5 none 
INFO : kex: client->server aes128-ctr hmac-md5 none 
INFO : SSH_MSG_KEXDH_INIT sent 
INFO : expecting SSH_MSG_KEXDH_REPLY 
INFO : ssh_rsa_verify: signature true 
WARN : Permanently added '11.22.33.44' (RSA) to the list of known hosts. 
INFO : SSH_MSG_NEWKEYS sent 
INFO : SSH_MSG_NEWKEYS received 
INFO : SSH_MSG_SERVICE_REQUEST sent 
INFO : SSH_MSG_SERVICE_ACCEPT received 
INFO : Authentications that can continue: publickey,keyboard-interactive,password 
INFO : Next authentication method: publickey 
INFO : Authentications that can continue: keyboard-interactive,password 
INFO : Next authentication method: keyboard-interactive 
INFO : Authentication succeeded (keyboard-interactive). 
+0

にこれを追加します。サーバーログは何を表していますか? –

+0

良い点、0.1.52ログを追加、新しい(失敗した)リリースは0.1.53.jarファイルです。ログダンプは、最初にライブラリバージョンを出力します。 – Whome

+0

'StrictHostKeyChecking = no'を使用しないで、そうすることでMITM攻撃に対する保護が失われています。 –

答えて

8

JSCH 0.1.53サポート(および好む)diffie-hellman-group-exchange-sha256 KEX、。

何らかの理由で、サーバーが後で接続を解除します。私はちょうど0.1.54にJSCHのバージョンを変更して解決してしまった同じ問題を抱えていた

session.setConfig("kex", "diffie-hellman-group1-sha1"); 
+0

それはやっても、私は古い0.44ライブラリよりもはるかに高速にファイルをダウンロードする0.53を確認することができます。 – Whome

+0

JSchがJetBrains PyCharm IDEのコンテキストで使用されているときに、この "kex"値を設定する必要はありますか?私は信じている同じ問題にぶち当たっていますが、特定のCentOS 7サーバーのみで実行しています。可能であれば、この回避策をテストしたいと思います。 –

+0

@ MarkEdington追加の質問がある場合は、それを聞いてください。これはQ&Aサイトであり、ディスカッションフォーラムではありません。 –

4

:何JSCH 0.1.52が好むdiffie-hellman-group1-sha1 KEXを使用するようにJSCHを強制する、という回避策

はおそらく、サーバーによって切断され得ているあなたのpom.xml

<dependency> 
    <groupId>com.jcraft</groupId> 
    <artifactId>jsch</artifactId> 
    <version>0.1.54</version> 
</dependency> 
+0

私は0.1.54バージョンでも同じ問題に直面しています。( "IOストリームの終わり読み取り") –

+0

より高いバージョンでチェックしてください。 @sharathchandra –

関連する問題