[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Authentication method


Hi guys.
Here is the verbose log generated by following code with
SSH_OPTIONS_LOG_VERBOSITY set to SSH_LOG_FUNCTIONS:

  int verbosity = SSH_LOG_FUNCTIONS;

  node.session = ssh_new ();

  if (node.session == NULL)
    return (NULL);

  ssh_options_set (node.session, SSH_OPTIONS_HOST, p_auth->host);
  ssh_options_set (node.session, SSH_OPTIONS_USER, p_auth->user);
  ssh_options_set (node.session, SSH_OPTIONS_PORT, &p_auth->port);
  ssh_options_set (node.session, SSH_OPTIONS_TIMEOUT, &prefs.ssh_timeout);
  ssh_options_set (node.session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity);

  rc = ssh_connect (node.session);

  printf ("calling ssh_userauth_none()...\n");
  ssh_userauth_none (node.session, NULL);

  printf ("calling ssh_userauth_list()...\n");
  node.auth_methods = ssh_userauth_list (node.session, NULL);

  printf ("returned value: %d\n", node.auth_methods);

I notice that ssh_userauth_list() does not write any message.
Could my problem be generated by a too short timeout value (2 seconds)?

-- LOG: -----------------------------
[2014/07/13 11:07:39.215006, 1] ssh_connect:  libssh 0.6.3 (c) 2003-2014
Aris Adamantiadis, Andreas Schneider, and libssh contributors. Distributed
under the LGPL, please refer to COPYING file for information about your
rights, using threading threads_noop
[2014/07/13 11:07:39.215050, 3] getai:  host 10.104.101.21 matches an IP
address
[2014/07/13 11:07:39.215141, 2] ssh_socket_connect:  Nonblocking connection
socket: 15
[2014/07/13 11:07:39.215165, 2] ssh_connect:  Socket connecting, now
waiting for the callbacks to work
[2014/07/13 11:07:39.215182, 3] ssh_connect:  ssh_connect: Actual timeout :
2000
[2014/07/13 11:07:39.249256, 3] ssh_socket_pollcallback:  Received POLLOUT
in connecting state
[2014/07/13 11:07:39.249350, 1] socket_callback_connected:  Socket
connection callback: 1 (0)
[2014/07/13 11:07:39.418040, 3] callback_receive_banner:  Received banner:
SSH-2.0-OpenSSH_5.1p1 Debian-5
[2014/07/13 11:07:39.418127, 1] ssh_client_connection_callback:  SSH server
banner: SSH-2.0-OpenSSH_5.1p1 Debian-5
[2014/07/13 11:07:39.418204, 1] ssh_analyze_banner:  Analyzing banner:
SSH-2.0-OpenSSH_5.1p1 Debian-5
[2014/07/13 11:07:39.418238, 1] ssh_analyze_banner:  We are talking to an
OpenSSH client version: 5.1 (50100)
[2014/07/13 11:07:39.418266, 3] ssh_socket_unbuffered_write:  Enabling
POLLOUT for socket
[2014/07/13 11:07:39.462543, 3] ssh_packet_socket_callback:  packet: read
type 20 [len=780,padding=10,comp=769,payload=769]
[2014/07/13 11:07:39.462626, 3] ssh_packet_process:  Dispatching handler
for packet type 20
[2014/07/13 11:07:39.462680, 4] ssh_list_kex:  kex algos:
diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
[2014/07/13 11:07:39.462751, 4] ssh_list_kex:  server host key algo:
ssh-rsa,ssh-dss
[2014/07/13 11:07:39.462764, 4] ssh_list_kex:  encryption client->server:
aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,
rijndael-cbc@xxxxxxxxxxxxxx,aes128-ctr,aes192-ctr,aes256-ctr
[2014/07/13 11:07:39.462781, 4] ssh_list_kex:  encryption server->client:
aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,
rijndael-cbc@xxxxxxxxxxxxxx,aes128-ctr,aes192-ctr,aes256-ctr
[2014/07/13 11:07:39.462797, 4] ssh_list_kex:  mac algo client->server:
hmac-md5,hmac-sha1,umac-64@xxxxxxxxxxx,hmac-ripemd160,
hmac-ripemd160@xxxxxxxxxxx,hmac-sha1-96,hmac-md5-96
[2014/07/13 11:07:39.462815, 4] ssh_list_kex:  mac algo server->client:
hmac-md5,hmac-sha1,umac-64@xxxxxxxxxxx,hmac-ripemd160,
hmac-ripemd160@xxxxxxxxxxx,hmac-sha1-96,hmac-md5-96
[2014/07/13 11:07:39.462831, 4] ssh_list_kex:  compression algo
client->server: none,zlib@xxxxxxxxxxx
[2014/07/13 11:07:39.462845, 4] ssh_list_kex:  compression algo
server->client: none,zlib@xxxxxxxxxxx
[2014/07/13 11:07:39.462859, 4] ssh_list_kex:  languages client->server:
[2014/07/13 11:07:39.462873, 4] ssh_list_kex:  languages server->client:
[2014/07/13 11:07:39.462969, 3] match_hashed_host:  Matching a hashed host:
10.104.101.21 match=0
[2014/07/13 11:07:39.463031, 3] match_hashed_host:  Matching a hashed host:
[10.104.101.21]:22 match=0
[2014/07/13 11:07:39.463084, 3] match_hashed_host:  Matching a hashed host:
10.104.101.21 match=0
[2014/07/13 11:07:39.463132, 3] match_hashed_host:  Matching a hashed host:
[10.104.101.21]:22 match=0
[2014/07/13 11:07:39.463156, 3] match_hashed_host:  Matching a hashed host:
10.104.101.21 match=0
[2014/07/13 11:07:39.463178, 3] match_hashed_host:  Matching a hashed host:
[10.104.101.21]:22 match=0
[2014/07/13 11:07:39.463202, 3] match_hashed_host:  Matching a hashed host:
10.104.101.21 match=0
[2014/07/13 11:07:39.463224, 3] match_hashed_host:  Matching a hashed host:
[10.104.101.21]:22 match=0
[2014/07/13 11:07:39.463250, 3] match_hashed_host:  Matching a hashed host:
10.104.101.21 match=0
[2014/07/13 11:07:39.463273, 3] match_hashed_host:  Matching a hashed host:
[10.104.101.21]:22 match=0
[2014/07/13 11:07:39.463295, 3] match_hashed_host:  Matching a hashed host:
10.104.101.21 match=0
[2014/07/13 11:07:39.463318, 3] match_hashed_host:  Matching a hashed host:
[10.104.101.21]:22 match=0
[2014/07/13 11:07:39.463341, 3] match_hashed_host:  Matching a hashed host:
10.104.101.21 match=0
[2014/07/13 11:07:39.463363, 3] match_hashed_host:  Matching a hashed host:
[10.104.101.21]:22 match=0
[2014/07/13 11:07:39.463386, 3] match_hashed_host:  Matching a hashed host:
10.104.101.21 match=0
[2014/07/13 11:07:39.463419, 3] match_hashed_host:  Matching a hashed host:
[10.104.101.21]:22 match=0
[2014/07/13 11:07:39.463447, 3] match_hashed_host:  Matching a hashed host:
10.104.101.21 match=0
[2014/07/13 11:07:39.463475, 3] match_hashed_host:  Matching a hashed host:
[10.104.101.21]:22 match=0
[2014/07/13 11:07:39.463496, 3] match_hashed_host:  Matching a hashed host:
10.104.101.21 match=0
[2014/07/13 11:07:39.463522, 3] match_hashed_host:  Matching a hashed host:
[10.104.101.21]:22 match=0
[2014/07/13 11:07:39.463542, 3] match_hashed_host:  Matching a hashed host:
10.104.101.21 match=0
[2014/07/13 11:07:39.463559, 3] match_hashed_host:  Matching a hashed host:
[10.104.101.21]:22 match=0
[2014/07/13 11:07:39.463577, 3] match_hashed_host:  Matching a hashed host:
10.104.101.21 match=0
[2014/07/13 11:07:39.463594, 3] match_hashed_host:  Matching a hashed host:
[10.104.101.21]:22 match=0
[2014/07/13 11:07:39.463612, 3] match_hashed_host:  Matching a hashed host:
10.104.101.21 match=0
[2014/07/13 11:07:39.463626, 3] match_hashed_host:  Matching a hashed host:
[10.104.101.21]:22 match=0
[2014/07/13 11:07:39.463641, 3] match_hashed_host:  Matching a hashed host:
10.104.101.21 match=0
[2014/07/13 11:07:39.463656, 3] match_hashed_host:  Matching a hashed host:
[10.104.101.21]:22 match=0
[2014/07/13 11:07:39.463672, 3] match_hashed_host:  Matching a hashed host:
10.104.101.21 match=0
[2014/07/13 11:07:39.463686, 3] match_hashed_host:  Matching a hashed host:
[10.104.101.21]:22 match=0
[2014/07/13 11:07:39.463701, 3] match_hashed_host:  Matching a hashed host:
10.104.101.21 match=0
[2014/07/13 11:07:39.463715, 3] match_hashed_host:  Matching a hashed host:
[10.104.101.21]:22 match=0
[2014/07/13 11:07:39.463731, 3] match_hashed_host:  Matching a hashed host:
10.104.101.21 match=0
[2014/07/13 11:07:39.463745, 3] match_hashed_host:  Matching a hashed host:
[10.104.101.21]:22 match=0
[2014/07/13 11:07:39.463760, 3] match_hashed_host:  Matching a hashed host:
10.104.101.21 match=0
[2014/07/13 11:07:39.463775, 3] match_hashed_host:  Matching a hashed host:
[10.104.101.21]:22 match=0
[2014/07/13 11:07:39.463790, 3] match_hashed_host:  Matching a hashed host:
10.104.101.21 match=0
[2014/07/13 11:07:39.463805, 3] match_hashed_host:  Matching a hashed host:
[10.104.101.21]:22 match=0
[2014/07/13 11:07:39.463820, 3] match_hashed_host:  Matching a hashed host:
10.104.101.21 match=0
[2014/07/13 11:07:39.463834, 3] match_hashed_host:  Matching a hashed host:
[10.104.101.21]:22 match=0
[2014/07/13 11:07:39.463851, 3] match_hashed_host:  Matching a hashed host:
10.104.101.21 match=0
[2014/07/13 11:07:39.463865, 3] match_hashed_host:  Matching a hashed host:
[10.104.101.21]:22 match=0
[2014/07/13 11:07:39.463880, 3] match_hashed_host:  Matching a hashed host:
10.104.101.21 match=0
[2014/07/13 11:07:39.463895, 3] match_hashed_host:  Matching a hashed host:
[10.104.101.21]:22 match=0
[2014/07/13 11:07:39.463910, 3] match_hashed_host:  Matching a hashed host:
10.104.101.21 match=0
[2014/07/13 11:07:39.463924, 3] match_hashed_host:  Matching a hashed host:
[10.104.101.21]:22 match=0
[2014/07/13 11:07:39.463976, 4] ssh_list_kex:  kex algos:
curve25519-sha256@xxxxxxxxxx
,ecdh-sha2-nistp256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
[2014/07/13 11:07:39.463989, 4] ssh_list_kex:  server host key algo:
ecdsa-sha2-nistp256,ssh-rsa,ssh-dss
[2014/07/13 11:07:39.464008, 4] ssh_list_kex:  encryption client->server:
aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,blowfish-cbc,3des-cbc,des-cbc-ssh1
[2014/07/13 11:07:39.464017, 4] ssh_list_kex:  encryption server->client:
aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,blowfish-cbc,3des-cbc,des-cbc-ssh1
[2014/07/13 11:07:39.464027, 4] ssh_list_kex:  mac algo client->server:
hmac-sha1
[2014/07/13 11:07:39.464036, 4] ssh_list_kex:  mac algo server->client:
hmac-sha1
[2014/07/13 11:07:39.464045, 4] ssh_list_kex:  compression algo
client->server: none
[2014/07/13 11:07:39.464054, 4] ssh_list_kex:  compression algo
server->client: none
[2014/07/13 11:07:39.464063, 4] ssh_list_kex:  languages client->server:
[2014/07/13 11:07:39.464071, 4] ssh_list_kex:  languages server->client:
[2014/07/13 11:07:39.464101, 3] ssh_socket_unbuffered_write:  Enabling
POLLOUT for socket
[2014/07/13 11:07:39.464123, 3] packet_send2:  packet: wrote
[len=436,padding=10,comp=425,payload=425]
[2014/07/13 11:07:39.464475, 3] packet_send2:  packet: wrote
[len=268,padding=5,comp=262,payload=262]
[2014/07/13 11:07:39.464494, 3] ssh_socket_unbuffered_write:  Enabling
POLLOUT for socket
[2014/07/13 11:07:39.825566, 3] ssh_packet_socket_callback:  packet: read
type 31 [len=828,padding=10,comp=817,payload=817]
[2014/07/13 11:07:39.825650, 3] ssh_packet_process:  Dispatching handler
for packet type 31
[2014/07/13 11:07:39.825728, 2] ssh_packet_dh_reply:  Received
SSH_KEXDH_REPLY
[2014/07/13 11:07:39.826669, 3] ssh_socket_unbuffered_write:  Enabling
POLLOUT for socket
[2014/07/13 11:07:39.826717, 3] packet_send2:  packet: wrote
[len=12,padding=10,comp=1,payload=1]
[2014/07/13 11:07:39.826753, 2] ssh_client_dh_reply:  SSH_MSG_NEWKEYS sent
[2014/07/13 11:07:39.826812, 3] ssh_packet_socket_callback:  Processing 16
bytes left in socket buffer
[2014/07/13 11:07:39.826850, 3] ssh_packet_socket_callback:  packet: read
type 21 [len=12,padding=10,comp=1,payload=1]
[2014/07/13 11:07:39.826887, 3] ssh_packet_process:  Dispatching handler
for packet type 21
[2014/07/13 11:07:39.826923, 2] ssh_packet_newkeys:  Received
SSH_MSG_NEWKEYS
[2014/07/13 11:07:39.827006, 3] crypt_set_algorithms2:  Set output
algorithm to aes256-ctr
[2014/07/13 11:07:39.827045, 3] crypt_set_algorithms2:  Set input algorithm
to aes256-ctr
[2014/07/13 11:07:39.827150, 4] ssh_pki_signature_verify_blob:  Going to
verify a ssh-rsa type signature
[2014/07/13 11:07:39.827354, 2] ssh_packet_newkeys:  Signature verified and
valid
[2014/07/13 11:07:39.827399, 3] ssh_connect:  ssh_connect: Actual state : 7
calling ssh_userauth_none()...
[2014/07/13 11:07:39.830043, 3] packet_send2:  packet: wrote
[len=28,padding=10,comp=17,payload=17]
[2014/07/13 11:07:39.830137, 3] ssh_service_request:  Sent
SSH_MSG_SERVICE_REQUEST (service ssh-userauth)
[2014/07/13 11:07:39.830187, 3] ssh_socket_unbuffered_write:  Enabling
POLLOUT for socket
[2014/07/13 11:07:39.910069, 3] ssh_packet_socket_callback:  packet: read
type 6 [len=28,padding=10,comp=17,payload=17]
[2014/07/13 11:07:39.910150, 3] ssh_packet_process:  Dispatching handler
for packet type 6
[2014/07/13 11:07:39.910223, 3] ssh_packet_service_accept:  Received
SSH_MSG_SERVICE_ACCEPT
[2014/07/13 11:07:39.910311, 3] ssh_socket_unbuffered_write:  Enabling
POLLOUT for socket
[2014/07/13 11:07:39.910362, 3] packet_send2:  packet: wrote
[len=44,padding=8,comp=35,payload=35]
calling ssh_userauth_list()...
returned value: 0



2014-07-12 21:43 GMT+02:00 Aris Adamantiadis <aris@xxxxxxxxxxxx>:

> Hi Fabio,
>
> This looks correct. Could you provide us the verbose log so we can see
> what the server is sending back?
> Thanks,
>
> Aris
>
> Le 12/07/14 10:28, Fabio Leone a écrit :
> > Hi.
> > I'm using libssh version 0.6.3.
> > When logging in on some servers ssh_userauth_list() returns zero (I
> > call ssh_userauth_none before).
> > What is the right way to access the server in that case?
> >
> > This is a snippet of my code:
> >
> >   ssh_userauth_none (node.session, NULL);
> >   node.auth_methods = ssh_userauth_list (node.session, NULL);
> >
> >   if (node.auth_methods & SSH_AUTH_METHOD_PASSWORD)
> >     {
> >       ...
> >     }
> >   else if (node.auth_methods & SSH_AUTH_METHOD_INTERACTIVE)
> >     {
> >       ...
> >     }
> >   else if ...
> >      ...
> >   else
> >     {
> >       sprintf (p_auth->error_s, "Unknown authentication method for
> > server %s\n", p_auth->host);
> >       ...
> >     }
>
>
>

Follow-Ups:
Re: Authentication methodFabio Leone <fab.leo@xxxxxxxxx>
References:
Authentication methodFabio Leone <fab.leo@xxxxxxxxx>
Re: Authentication methodAris Adamantiadis <aris@xxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org