<div dir="ltr"><div><div><div>Hi,<br></div>It seems like OTP-11363 breaks keyboard-interactive authentication by introducing the ssh_message module.<br><br></div>The following messages will always be decoded as #ssh_msg_userauth_pk_ok{}<br>
<br>SSH2_MSG_USERAUTH_PK_OK<br>SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ<br>SSH2_MSG_USERAUTH_INFO_REQUEST<br><br></div><div>Which, when the server has keyboard-interactive as a preferred authentication method results in an error like the one shown below.<br>
<br></div><div>Attached is the patch I used as a workaround. It's probably not the best solution. Really, the decode should be aware of what messages are expected from the current state of the connection.<br><br></div>
<div>Regards,<br> Simon<br><br></div><div>Error:<br>4> catch ssh:shell("localhost", 22, [{user, "x123"}, {password,"x123"}, {user_dir, "/tmp/simon/xxhd"}]).                            <br>
{error,"Internal error"}<br>5> <br>=ERROR REPORT==== 14-Jan-2014::16:15:04 ===<br>Erlang ssh connection handler failed with reason: function_clause <br>, Stacktace: [{ssh_connection_handler,userauth,<br>                  [{ssh_msg_userauth_pk_ok,<<>>,<br>
                       <<0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,9,80,97,115,115,119,<br>                         111,114,100,58,0>>},<br>                   {state,client,undefined,<0.32.0>,"x123",<br>                       {connection,[],28690,[],0,undefined,undefined,<br>
                           undefined,<br>                           [{user_pid,<0.32.0>},<br>                            {host,"localhost"},<br>                            {idle_time,infinity},<br>                            {user_dir,"/tmp/simon/xxhd"},<br>
                            {password,"x123"},<br>                            {user,"x123"}],<br>                           undefined,undefined,undefined,undefined},<br>                       0,infinity,tcp,gen_tcp,tcp_closed,<br>
                       {ssh,client,<br>                           {"localhost",{{127,0,0,1},22}},<br>                           {2,0},<br>                           {2,0},<br>                           "SSH-2.0-Erlang","SSH-2.0-OpenSSH_5.6",<br>
...<br>                           undefined,"x123","ssh-connection",false,<br>                           "publickey,keyboard-interactive,password",<br>                           ["publickey","keyboard-interactive"],<br>
                           [],<br>                           ["ssh-rsa","ssh-dss"],<br>                           false},<br>                       #Port<0.1188>,<<>>,<<>>,undefined,<br>
                       {ssh_msg_kexinit,<br>                           <<176,81,33,95,58,180,129,224,145,127,117,133,160,<br>                             53,16,241>>,<br>                           ["diffie-hellman-group1-sha1"],<br>
                           ["ssh-rsa","ssh-dss"],<br>                           ["aes128-cbc","3des-cbc"],<br>                           ["aes128-cbc","3des-cbc"],<br>
                           ["hmac-sha1"],<br>                           ["hmac-sha1"],<br>                           ["none","zlib"],<br>                           ["none","zlib"],<br>
                           [],[],false,0},<br>                       false,undefined,undefined,undefined,<br>                       [{user_pid,<0.32.0>},<br>                        {host,"localhost"},<br>                        {idle_time,infinity},<br>
                        {user_dir,"/tmp/simon/xxhd"},<br>                        {password,"x123"},<br>                        {user,"x123"}]}],<br>                  [{file,"ssh_connection_handler.erl"},{line,393}]},<br>
              {ssh_connection_handler,event,3,<br>                  [{file,"ssh_connection_handler.erl"},{line,1126}]},<br>              {gen_fsm,handle_msg,7,[{file,"gen_fsm.erl"},{line,505}]},<br>              {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}] <br>
please report this to <a href="mailto:erlang-bugs@erlang.org">erlang-bugs@erlang.org</a> <br><br></div><div><br><br></div><div><br></div><br></div>