Keyboard interactive authentication - WeOnlyDo Discussion board

Keyboard interactive authentication (wodSSH / wodSSH.NET)

by S Krupashankar, Monday, April 11, 2016, 14:17 (2931 days ago)

Is there a sample available for keyboard interactive authentication? I am specifically looking for a scenario where the user would be able to connect to a SSH Server with the login and password entered by the user as a response to the server.

I tried something along the lines of this, but the LoginChallengeEvent does not get called and instead, the disconnect event is fired:

client = new WeOnlyDo.Client.SSH();
            client.LicenseKey = "<mykey>";
            client.Hostname = "<an IP>";
            client.Blocking = true;
            client.Protocol = SSH.SupportedProtocols.SSHAuto;
            client.DataReceivedEvent += SSH_DataReceivedEvent;
            client.Authentication = SSH.Authentications.KeyboardInteractive;
            client.Login = "labuser";
            client.DebugFile = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\sshauthenticationtest.txt";
           
            //client.Password = "Password1";
            client.LoginChallengeEvent += Client_LoginChallengeEvent;
            client.PromptReceivedEvent += Client_PromptReceivedEvent;
            client.StateChangedEvent += Client_StateChangedEvent;
            client.DisconnectedEvent += Client_DisconnectedEvent;client.FingerPrintType = SSH.SupportedMACs.MD5;
            client.FingerPrintEvent += Client_FingerPrintEvent;
            client.CryptoInformationEvent += Client_CryptoInformationEvent;
            client.Port = 22;
            client.TerminalType = "xterm";
            //client.Authentication = SSH.Authentications.None;
            client.Connect();   

The connect event throws up an error, like this:

{"Authentication with the server failed."}

It works in other authentication modes if the username and passwords are set programatically.


Complete thread: