EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Changepassword function

Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages
#30542
Posted: 08/29/2014 20:58:02
by Prabhu Sundaram (Basic support level)
Joined: 08/29/2014
Posts: 3

We are using SecureBlackBox (Java version) for transferring files to external vendor through SFTP, over extranet.
But my vendor has mandated to use SSH for changing password. My vendor will give us a temporary password, the first time.
I understand that there is a change password function in the Java version as well. But we are not clear on how to use this. We have been searching for the user manuals, but unfortunately we are unable to get this at this moment.
Could you please help me with any sample code for this?
Thanks.
#30543
Posted: 08/30/2014 01:53:20
by Ken Ivanov (EldoS Corp.)

Hello Prabhu,

Thank you for contacting us.

To ask the server to change your password during an SSH/SFTP handshake, please adjust the following settings of the SSH-capable component (e.g. TElSimpleSFTPClient):

1. Set RequestPasswordChange property to true.

2. Handle the OnPasswordChangeRequest event to intercept the server's password change request and pass a new password over.

Note that before connecting you must assign a correct existing (old) password to the component's Password property.

Ken
#30566
Posted: 09/01/2014 09:29:57
by Prabhu Sundaram (Basic support level)
Joined: 08/29/2014
Posts: 3

Hi Ken,

Thanks for your quick reply. We will try what you have mentioned and revert if there are questions.

But by any chance could you share a sample code itself? That would be very helpful.

Regards,
Prabhu
#30584
Posted: 09/02/2014 12:34:58
by Ken Ivanov (EldoS Corp.)

Hi Prabhu,

I am afraid there's no such sample available, sorry. Requesting the password change is however fairly straightforward. Basically, you are (1) configuring the client to actually request the password change:

Code
client.setRequestPasswordChange(true);
client.setOnPasswordChangeRequest(new TSSHPasswordChangeRequestEvent(onPassChangeReq));


and (2) implementing the change in the OnPasswordChangeRequest event handler:

Code
   TSSHPasswordChangeRequestEvent.Callback onPassChangeReq = new TSSHPasswordChangeRequestEvent.Callback() {
      
      public bool tsshPasswordChangeRequestEventCallback(TObject sender, String prompt, TSBString newpassword) {
         newpassword.value = "newpassword";
                        return true;
      }
   };


Hope this helps.

Ken
#30591
Posted: 09/04/2014 04:59:18
by Prabhu Sundaram (Basic support level)
Joined: 08/29/2014
Posts: 3

Hi Ken,

Thanks for your reply. We took your inputs and wrote the following code.


--------------------------------------------------
sftpClient.SetAddress(this.sftpHostname);
sftpClient.SetPort(this.sftpPort);
sftpClient.SetUsername(this.sftpClientUsername);
sftpClient.SetPassword(this.sftpClientPassword);
sftpClient.SetOnKeyValidate(new TSSHKeyValidateEvent(onKeyValidate));

sftpClient.SetRequestPasswordChange(true);
sftpClient.SetOnPasswordChangeRequest(new TSSHPasswordChangeRequestEvent(onPassChangeReq));


--------------------------------------------------

static TSSHPasswordChangeRequestEvent.Callback onPassChangeReq = new TSSHPasswordChangeRequestEvent.Callback() {
@Override
public boolean TSSHPasswordChangeRequestEventCallback(TObject sender,
String prompt, TSBString newpassword) {

newpassword.Value = sftpClientNewPassword;// "newpassword";

System.out.println("New Password is :" + sftpClientNewPassword);
System.out.println("Password has been changed successfuly");

return true;
}
};


--------------------------------------------
sftpClient.Open();

-----------------------------------
But we are getting the following error in the Output log file:

ERROR sftpclient.SecureBlackboxSimpleClient.openConnection(SecureBlackboxSimpleClient.java:160) - Server software identified itself as: OpenSSH_5.0
SecureBlackbox.Base.EElSocketError: Connection timed out (error code is 10060)

Can you please help resolving this?


BTW we used the command "ssh <userid>@<IP Address> changepass" in OpenSSH and we were able to successfully change the password! But I am authorized to use only ELDOS.
#30602
Posted: 09/04/2014 17:28:20
by Ken Ivanov (EldoS Corp.)

Hi Prabhu,

Error 10060 is indeed a timeout error and is typically returned if connection to the server is too slow.

Could you please do a couple of checks for us to help us localize the issue:

1) Ensure that the socket timeout is set to some large value, e.g. 60000 (1 minute).

2) Try to connect to the server and check which events of the following do fire (please ignore the 10060 error on this stage):
- OnKeyValidate,
- OnAuthenticationStart,
- OnAuthenticationSuccess,
- OnAuthenticationFailed,
- OnError.

3) Comment out the password change request setup (i.e. bring the component to a 'normal' configuration) and try to connect to the server again. Which of the above events do fire now?

Thanks in advance,

Ken
Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.

Reply

Statistics

Topic viewed 927 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!