Keyboard interactive authentication (wodSSH / wodSSH.NET)

by S Krupashankar @, (3308 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:
[inlinecode]
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();

[/inlinecode]

The connect event throws up an error, like this:
[code]{"Authentication with the server failed."}[/code]

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

locked

Keyboard interactive authentication

by Jasmine, (3308 days ago) @ S Krupashankar

Hi.

Does Client_LoginChallengeEvent ever fire?

Jasmine.

locked

Keyboard interactive authentication

by S Krupashankar @, (3307 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?

locked

Keyboard interactive authentication

by Jasmine, (3307 days ago) @ S Krupashankar

Hi.

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

Jasmine.

locked

Keyboard interactive authentication

by S Krupashankar @, (3307 days ago) @ Jasmine

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

locked

Keyboard interactive authentication

by Jasmine, (3307 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.

locked

Keyboard interactive authentication

by S Krupashankar @, (3306 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.

locked