Keyboard interactive authentication - WeOnlyDo Discussion board

Keyboard interactive authentication (wodSSH / wodSSH.NET)

by S Krupashankar, Monday, April 11, 2016, 14:17 (3148 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.

Keyboard interactive authentication

by Jasmine, Monday, April 11, 2016, 14:23 (3148 days ago) @ S Krupashankar

Hi.

Does Client_LoginChallengeEvent ever fire?

Jasmine.

Keyboard interactive authentication

by S Krupashankar, Tuesday, April 12, 2016, 13:38 (3147 days ago) @ Jasmine

Hi.

Does Client_LoginChallengeEvent ever fire?

Jasmine.

No, the event does not fire at all. I tried to Args.Accept = true in FingerPrintEvent and in the CryptoInformationEvent event. Am I perhaps just missing to set some properties?

Keyboard interactive authentication

by Jasmine, Tuesday, April 12, 2016, 15:33 (3147 days ago) @ S Krupashankar

Hi.

Could it be that server doesn't even support keyboard interactive authentication? Perhaps it just uses password authentication?

Jasmine.

Keyboard interactive authentication

by S Krupashankar, Tuesday, April 12, 2016, 18:17 (3147 days ago) @ Jasmine

I initially thought so, then checked with puTTY. puTTY asks for the credentials against the same server.

Keyboard interactive authentication

by Jasmine, Tuesday, April 12, 2016, 21:07 (3147 days ago) @ S Krupashankar

Hi.

How does Putty ask? As first thing after login that needs to be entered? Just typical 'password' prompt, or some other text is shown? Putty always asks for password if I'm correct, before it initiates connection.

Jasmine.

Keyboard interactive authentication

by S Krupashankar, Wednesday, April 13, 2016, 10:52 (3146 days ago) @ Jasmine

Hi.

How does Putty ask? As first thing after login that needs to be entered? Just typical 'password' prompt, or some other text is shown? Putty always asks for password if I'm correct, before it initiates connection.

Jasmine.


puTTY asks like this after I give the IP address and hit OK, in the terminal window:

"login as: "

And after I give the username, it says:

"user@host's password:"

and then it connects as usual with the welcome message from the SSH server. Since the prompts are inside the terminal window, I thought the messages are based on the server's response. I, though, see your point that this prompt is something within puTTY before a connection with the server is established.