Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 319415 - SSH Session doesn't handle expired password properly
Summary: SSH Session doesn't handle expired password properly
Status: RESOLVED NOT_ECLIPSE
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Team (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform Team Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-09 13:46 EDT by Samuel Wu CLA
Modified: 2011-09-08 10:52 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Samuel Wu CLA 2010-07-09 13:46:04 EDT
Build Identifier: 3.6.0 GA

We are using the jcraft SSH client to connect the the zLinux system with the password authentication.
In the case the the user password is expired, we expect the user to be prompted for the new password, which will be handled by the userInfo we provide. Our userInfo is an instance of UIKeyboardInteractive. But promptKeyboardInteractive() of our userInfo was not called. And the session appears to be an active one which it is not.
It was found that the return code command somehow was SSH_MSG_USERAUTH_SUCCESS instead of SSH_MSG_USERAUTH_PASSWD_CHANGEREQ.
Please advise.

Reproducible: Always
Comment 1 Prakash Rangaraj CLA 2010-07-29 04:54:53 EDT
I assume SSH is contributed by CVS. If not, please reassign.
Comment 2 Tomasz Zarna CLA 2011-06-27 10:05:21 EDT
3.6 is using com.jcraft.jsch in version 1.41. Could you try doing the same thing with JSch 1.44, which is available on Orbit[1]?

[1] http://wiki.eclipse.org/Orbit/FAQ#How_do_I_work_with_a_bundle_in_Orbit.3F
Comment 3 Atsuhiko Yamanaka CLA 2011-07-13 14:56:49 EDT
I think this is a duplicate of Bug 109043.
Comment 4 Samuel Wu CLA 2011-07-15 10:32:52 EDT
Tested with JSch 1.44 and ran into the same problem.

Here is what was found with the Logger class provided in bug 320665.
1. When using keyboard-interactive authentication, the expired password was detected and the user was prompted for new password

2. When using password authentication, the session was connected and the user was brought to the session console and asked for changing password from there. Since our application does really open a command shell, we need the SSH client to handle it for us as in the interactive authentication.

3. The following messages are genereated by Logger.
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: Authentications that can continue: password
INFO: Next authentication method: password
INFO: Authentication succeeded (password).
Password change requested. Choose a new password.
WARNING: Your password has expired.
You must change your password now and login again!
Changing password for tpftvt4.
Old Password:
Comment 5 Szymon Brandys CLA 2011-07-21 03:35:35 EDT
Atsuhiko, any suggestions? Could it be fixed in the next release?
Comment 6 Atsuhiko Yamanaka CLA 2011-07-21 13:17:05 EDT
(In reply to comment #4)
> 2. When using password authentication, the session was connected and the user
> was brought to the session console and asked for changing password from there.
> Since our application does really open a command shell, we need the SSH client
> to handle it for us as in the interactive authentication.

As explained in Bug 109043, the reason for the prompt for changing password
is that it has been run with pty.  The one of problems is that the remotely
execed command "cvs server" will be run without pty, and the prompt must not
be given.  Of course, it will be possible to run "cvs server" with pty,
but it may change its behavior and may break the functionality of r.e.t.cvs.core
plug-in.
Comment 7 Samuel Wu CLA 2011-07-21 14:10:31 EDT
Well, our usage of SSH client doesn't involve cvs and I think the SSH client should be more general.
Comment 8 Atsuhiko Yamanaka CLA 2011-07-22 06:08:28 EDT
(In reply to comment #7)
> Well, our usage of SSH client doesn't involve cvs and I think the SSH client
> should be more general.

In that case, the process for changing password will be done
over I/O streams from remotely executed command, 
and it is difficult to find if messages from input-stream is for
changing password or not.

In fact, the following message,

  Password change requested. Choose a new password.
  WARNING: Your password has expired.
  You must change your password now and login again!
  Changing password for tpftvt4.
  Old Password:

depends on the implementation of sshd and there is no normal definition.

IMHO, this bugzilla entry should be marked as WONTFIX,
and users should be recommended to use keyboard-interactive or
publickey auth method.
Comment 9 Samuel Wu CLA 2011-07-22 09:12:40 EDT
I still hope this can be fixed in the SSH client for the following reasons. 
1. It may not be an easy fix. But if the problem is passed over to the user of the SSH client, the user needs to handle exactly the same situation. 
2. The user of SSH client can only fix the problem for himself while the fix in the SSH client will benifit all the users
3. The owner of SSH client knows much more than the user abut this SSH client and it would be relatively easier to come up with a better fix.
Comment 10 Szymon Brandys CLA 2011-07-27 07:18:51 EDT
(In reply to comment #9)
Samuel, couldn't you just switch to use keyboard-interactive?
Comment 11 Samuel Wu CLA 2011-07-27 08:55:34 EDT
We actually need support to both interactive and password authentication. Some customers choose to turn off interactive/password authentication for some reason.
Comment 12 Szymon Brandys CLA 2011-07-27 11:37:34 EDT
From an offline discussion with Samuel it looks like the workaround is to use Putty which handles this case correctly. I think it would be nice to handle it seamlessly in Eclipse. What do you think Atsuhiko?
Comment 13 Samuel Wu CLA 2011-07-27 13:18:47 EDT
We just found out that keyboard-interactive authentication is not supported on zOS (see bug 320665).
Comment 14 Szymon Brandys CLA 2011-07-28 04:29:47 EDT
(In reply to comment #13)
> We just found out that keyboard-interactive authentication is not supported on
> zOS (see bug 320665).

So it is even more important now to have the password authentication handled properly.
Comment 15 Atsuhiko Yamanaka CLA 2011-07-29 12:19:51 EDT
(In reply to comment #12)
> From an offline discussion with Samuel it looks like the workaround is to use
> Putty which handles this case correctly. I think it would be nice to handle it
> seamlessly in Eclipse. What do you think Atsuhiko?

I don't think that it is possible to support such a case efficiently
without disturbing behaviors for usual cases. As I had written, the problem
is that password reset process will be done on I/O stream of executed command.
Comment 16 Szymon Brandys CLA 2011-08-10 05:54:37 EDT
(In reply to comment #15)
> (In reply to comment #12)
> > From an offline discussion with Samuel it looks like the workaround is to use
> > Putty which handles this case correctly. I think it would be nice to handle it
> > seamlessly in Eclipse. What do you think Atsuhiko?
> 
> I don't think that it is possible to support such a case efficiently
> without disturbing behaviors for usual cases. As I had written, the problem
> is that password reset process will be done on I/O stream of executed command.

How do other clients e.g. Putty handle it then? Do you know? And what did you mean by "without disturbing behaviors for usual cases"?

(In reply to comment #8)
> In fact, the following message,
> 
>   Password change requested. Choose a new password.
>   WARNING: Your password has expired.
>   You must change your password now and login again!
>   Changing password for tpftvt4.
>   Old Password:
> 
> depends on the implementation of sshd and there is no normal definition.

Maybe we could handle the most popular cases and just give users a way to define messages that should be treated as requests for password change?
Comment 17 Atsuhiko Yamanaka CLA 2011-08-11 02:39:40 EDT
(In reply to comment #16)
> How do other clients e.g. Putty handle it then? Do you know? 

Putty is a terminal emulator, and terminal emulators can handle it.
You may know that terminal emulator plug-ins like "Target Management"[1] 
and our JCTerm[2] will handle it successfully.

>                                                              And what did you
> mean by "without disturbing behaviors for usual cases"?

It will be possible to write code for such a rare case, but it will cause the 
problem for the normal or usual case.
I have worried that we have not shared the consensus what is the problem.
If the consensus has been shared, it is trivial what kind of code should be 
written.

> (In reply to comment #8) 
> Maybe we could handle the most popular cases and just give users a way to
> define messages that should be treated as requests for password change?

Do you mean add a preference page for it?
Frankly to say, I'll not write code for this bugzilla entry,
but if you write it, I may be able to support you.


[1] http://eclipse.org/tm/
[2] http://www.jcraft.com/eclipse-jcterm/
Comment 18 Szymon Brandys CLA 2011-08-12 04:03:30 EDT
(In reply to comment #17)
> (In reply to comment #16)
> > How do other clients e.g. Putty handle it then? Do you know? 
> 
> Putty is a terminal emulator, and terminal emulators can handle it.
> You may know that terminal emulator plug-ins like "Target Management"[1] 
> and our JCTerm[2] will handle it successfully.

Correct me if I am wrong, but even if I use JCTerm or TM Terminal I have to know first that my password expired. Samuel got SSH_MSG_USERAUTH_SUCCESS. Despite it the session was inactive, so he tried Putty and then he realized where the problem was.

I guess he would expect at least some kind of notification that the password expired. Then he could change it using JCTerm, TM Terminal or even Putty.
Comment 19 Atsuhiko Yamanaka CLA 2011-08-12 04:16:32 EDT
(In reply to comment #18)
> Correct me if I am wrong, but even if I use JCTerm or TM Terminal I have to
> know first that my password expired. Samuel got SSH_MSG_USERAUTH_SUCCESS.
> Despite it the session was inactive, so he tried Putty and then he realized
> where the problem was.
> 
> I guess he would expect at least some kind of notification that the password
> expired. Then he could change it using JCTerm, TM Terminal or even Putty.

The session is 'active'.  After 'successful' login, password re-setting
prompt will appear on the terminal emulator instead of the shell prompt.
I hope you to try one of them by yourself.
Comment 20 Szymon Brandys CLA 2011-08-12 07:16:41 EDT
(In reply to comment #19)
> > I guess he would expect at least some kind of notification that the password
> > expired. Then he could change it using JCTerm, TM Terminal or even Putty.
> 
> The session is 'active'.  After 'successful' login, password re-setting
> prompt will appear on the terminal emulator instead of the shell prompt.
> I hope you to try one of them by yourself.

I should have been more precise. These are Samuel's steps:
1. His client tries to connect to a ssh server using jsch.
2. There is no notification about expired password.
3. Now he opens a terminal (Putty, but he could use JCTerm or TM Terminal) and there he sees the password change prompt.

My point was, it would be nice, if during 1) jsch could log a warning or show a prompt saying that the password expired. Then the user could just open a terminal and change the password there.
Comment 21 Atsuhiko Yamanaka CLA 2011-08-12 09:30:37 EDT
(In reply to comment #20)
> (In reply to comment #19)
> > > I guess he would expect at least some kind of notification that the password
> > > expired. Then he could change it using JCTerm, TM Terminal or even Putty.
> > 
> > The session is 'active'.  After 'successful' login, password re-setting
> > prompt will appear on the terminal emulator instead of the shell prompt.
> > I hope you to try one of them by yourself.
> 
> I should have been more precise. These are Samuel's steps:
> 1. His client tries to connect to a ssh server using jsch.
> 2. There is no notification about expired password.
> 3. Now he opens a terminal (Putty, but he could use JCTerm or TM Terminal) and
> there he sees the password change prompt.

Your previous question is the following,

(In reply to comment #16)
> How do other clients e.g. Putty handle it then? Do you know? 

So, I have just introduced that other clients in Eclipse plug-ins will
handle it successfully.

> My point was, it would be nice, if during 1) jsch could log a warning or show a
> prompt saying that the password expired. Then the user could just open a
> terminal and change the password there.

As I have written several times, sshd will drop the connections immediately
in processing remote exec request without pty for that case.
This is the problem of the remote sshd, and ssh clients have nothing to do for it.
Comment 22 Szymon Brandys CLA 2011-09-08 10:52:30 EDT
This issue should be addressed either by the client using Jsch library or sshd on zOs by adding the keyboard-interactive mode. In both cases this is not Eclipse. Thanks Atsuhiko for shedding light on it.