Archive Index
This month's Index
|
Subject: Re: Login failure with libssh2-1.2.2 and SuSE Enterprise 10 Linux
Re: Login failure with libssh2-1.2.2 and SuSE Enterprise 10 Linux
From: Dave McCaldon <davem_at_intersystems.com>
Date: Mon, 14 Dec 2009 19:37:45 -0500
On Dec 14, 2009, at 6:41 PM, Daniel Stenberg wrote:
> On Mon, 14 Dec 2009, Dave McCaldon wrote:
If you run regular ssh with -v, you'll see it try different methods:
debug1: Authentications that can continue: publickey,keyboard-interactive
According to the RFC4252 the server is supposed to respond as follows (for a rejection):
5.1. Responses to Authentication Requests
If the server rejects the authentication request, it MUST respond
byte SSH_MSG_USERAUTH_FAILURE
Looking back at the libssh2 trace, I can see the server responding with:
=> libssh2_transport_read() plain (36 bytes)
However, with the current API there's no way to communicate back to the application that there are additional authentication methods available. I suppose that I could enhance my previous patch to return LIBSSH2_ERROR_AUTHORIZATION_FAILED if there are no items in the "authentications that can continue" field, otherwise return a new error LIBSSH2_ERROR_AUTHORIZATION_FAILED_TRY_OTHER_METHODS which could give an indication to the application that it can try a different authentication method (although not which ones might work).
>> The application code isn't designed to be "driven" by a user, so keyboard-interactive didn't seem the right function to use. The question is, is this just a sshd configuration problem? Or should I be using libssh2_userauth_keyboard_interactive_ex() and then writing a callback function that simply returns the password as supplied by the app?
It looks like the key difference between password and keyboard-interactive is that with password you send a username and password and either get logged in, or rejected (once and for all). However, keyboard-interactive requires that the client send the username first, followed by the server responding with 0 or more challenge-response requests.
From a program point of view, keyboard-interactive is a bit more subtle, if you look at the SSH_MSG_USERAUTH_INFO_REQUEST structure that the server responds with, you can see that there is no field named "password". In fact when you log in, the "Password:" prompt is from the server -- it could just as easily be "Mother's maiden name:".
3.2. Information Requests
...
The SSH_MSG_USERAUTH_INFO_REQUEST message is defined as follows:
byte SSH_MSG_USERAUTH_INFO_REQUEST
The response back to the server looks like:
3.4. Information Responses
After obtaining the requested information from the user, the client
The format of the SSH_MSG_USERAUTH_INFO_RESPONSE message is as
byte SSH_MSG_USERAUTH_INFO_RESPONSE
So I'm going to conclude that this is in fact a server configuration issue -- it needs to allow the "password" authentication method in order to be properly driven by the application.
Of course now I need to look at supporting keyboard-interactive in the app (perhaps a dictionary of challenge/response values) because I'm sure I'll get some push back on this.
Thanks!
_______________________________________________
|