0 votes
by (180 points)

Hi

I am using Rebex tool in C#.NET application to FTP file from Windows system to Unix box.
My C# application executable in PROD environment is a daily scheduled job from windows task scheduler.
It picks up file from one window system and "Put" to another Unix box using put command using Rebex tool.

Same set up is there in Development environment as well. DEV is replica of PROD environment.
Till yesterday everything was working fine, but from today this daily exe job is throwing below .NET / Rebex exception-

Error -
Authentication prompt 'Enter your PASSWORD:' (pass 1) cannot be answered programatically. Use Authentication request event instead.
Rebex libraries abruptly stopped accepting programmatic password from yesterday.

Below is the code snippet
{
Rebex.Net.Sftp client = new Rebex.Net.Sftp();
client.Connect("myserver.domain.com");
client.Login(user, password); // Error is thrown at this line
MessageBox.Show(user + " is able to connect");
client.ChangeDirectory("DestinationpathofFTPserver");
client.PutFile(SourePath, "Filename.text");
client.Disconnect();
}
I am using below libraries -
Rebex.Common.dll 2.0.4444.0
Rebex.Ftp.dll 4.0.4444.0
Rebex.Networking.dll 3.0.4444.0
Rebex.Sftp.dll 3.0.4444.0

If anybody is aware , could you please let me know what could be the cause ? Same thing working fine in DEV Box. Not able to understand why suddenly PROD box started giving this error and denying programmatic password supplied.
Its very urgent, its a production issue I need to fix.

Quick help will be appreciated.

Regards
Sarang

Applies to: Rebex FTP/SSL

1 Answer

0 votes
by (144k points)
edited by

Update: Support for this variant of interactive password prompt has been added to Rebex SFTP 2016 R2.


Hi, the most likely cause is a configuration change at the server. Based on the exception, I guess that either the server switched to keyboard-interactive authentication, or its password prompt changed to include the "PASSWORD" word in uppercase, which is not detected and handled by Rebex SFTP client (unlike "password" in lowercase).

To determine why the observed behavior is different on DEV box and PROD box, please create communication logs (one at DEV, another at PROD) using Sftp object's LogWriter property and compare them (you can post them here or mail them to support@rebex.net for analysis).

The error itself indicates that the server requested a variant of keyboard-interactive authentication that the client was unable to answer without user interaction, most likely because of the upper-case "PASSWORD" prompt. If the "password" was lowercase, it would be detected as password prompt and answered automatically.

Solution

We will add support for uppercase "PASSWORD" prompts to the next release.

To fix the issue with your current release, register an AuthenticationRequest event handler that can answer this particular password prompt:

Rebex.Net.Sftp client = new Rebex.Net.Sftp();
client.Connect("myserver.domain.com");

// register authentication request event handler to answer the password prompt
client.AuthenticationRequest += (sender, e) =>
{
    if (e.Instructions == "Enter your PASSWORD:" && e.Items.Count == 1 && e.Items[0].IsSecret)
    {
        e.Items[0].Response = password;
    }
};

client.Login(user, password);
MessageBox.Show(user + " is able to connect");
client.ChangeDirectory("DestinationpathofFTPserver");
client.PutFile(SourePath, "Filename.text");
client.Disconnect();
...