We have our SSHD sources, which we are not allowed to offer, but I could 
reproduce this even in a Visual C++ debug session.
The code is not so easy to understand and I'm not a SSH expert, but It seems 
like sometimes the client "forgets" to intiate key re-exchange during connect, 
but uses some new key by itself. So the server key is not really initialized, 
for example by calling openssh like this (depending on the key type):
        RSA_new,
        BN_new,
which leads to the above server message sent to the client.


On Friday 18 March 2011 12:02:00 René Krell wrote:
> We have something similar in SSH connections with Jsch versions up to
> 0.1.44 to FreeSSHD (even latest versions). Accidentally the connection
> breaks with "SSH_MSG_DISCONNECT: Could not use server's key":
> 
> Stacktrace: com.jcraft.jsch.JSchException: SSH_MSG_DISCONNECT: 9 Could not
> use server's key. Please contact server administrator to generate new key.
> at com.jcraft.jsch.Session.read(Session.java:899)
>       at com.jcraft.jsch.Session.connect(Session.java:294)
> ...
> 
> Sometimes it is possible to reconnect immediately and the connection is
> successful. This happens in an unpredictable way, on some test systems
> more, on some less, on some I've never heard about it, mostly using JRE
> 1.5.0_22 or 1.6.0_21. Just using some Jsch example application seems not
> to be sufficient to reproduce it. Our real-life scenario makes repeating
> connections and stresses the system quiet a lot.
> 
> This might be similar to your issue.
> 
> René
> 
> On Friday 18 March 2011 11:32:20 Gustav Karlsson wrote:
> > Hi,
> > 
> > We are experiencing an issue when using Jsch to connect to a SFTP-server.
> > It seems like the sessions are not properly closed or cleared, resulting
> > in a rejection from the SFTP server after 20 connects+disconnects.
> > 
> >   1.  Execute commands connect, cd, ls and disconnect on SFTP-server 20
> > 
> > times. (We disconnect both the channel and the session) 2.  The next
> > connect results in an exception. (connection through command-line sftp
> > now returns an error "ssh_exchange_identification: Connection closed by
> > remote host") 3.  Wait ~30 min and connects will again be accepted.
> > 
> > Has anyone experienced a similar issue and/or know the cause? Connecting
> > 20+ times using the command-line SFTP-client does not result in this
> > problem.
> > 
> > Regards,
> > Gustav Karlsson

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to