Loading

SFTP Connector | Version 2.0.0 and above doesn't work with Identity File in .ppk format

Date de publication: Mar 2, 2024
Résolution

SYMPTOM

You have a mule application that uses the SFTP connector 2.0.0 version and above (Apache mina library is used) and the authentication is the "PUBLIC_KEY" method using Identity File in .ppk format. The app fails with the below warning if the preferredAuthenticationMethods="#[['PUBLIC_KEY']]"

org.mule.runtime.api.connection.ConnectionException: Could not establish SFTP connection with host: '<host>' at port: '<port>' - No more authentication methods available
Caused by: org.mule.extension.sftp.internal.exception.SftpConnectionException: Could not establish SFTP connection with host: '<host>' at port: '<port>' - No more authentication methods available
Caused by: org.mule.runtime.extension.api.exception.ModuleException: org.apache.sshd.common.SshException: No more authentication methods available
Caused by: org.apache.sshd.common.SshException: No more authentication methods available

And fails with the below error if nothing is specified in the "preferredAuthenticationMethods".

Error was: Could not establish SFTP connection with host: '' at port: '22' - [ssh-connection]: Failed to get operation result within specified timeout: 10000 msec
org.mule.runtime.api.connection.ConnectionException: Could not establish SFTP connection with host: '' at port: '22' - [ssh-connection]: Failed to get operation result within specified timeout: 10000 msec
Caused by: org.mule.extension.sftp.internal.exception.SftpConnectionException: Could not establish SFTP connection with host: '' at port: '22' - [ssh-connection]: Failed to get operation result within specified timeout: 10000 msec
Caused by: org.mule.runtime.extension.api.exception.ModuleException: org.apache.sshd.common.SshException: [ssh-connection]: Failed to get operation result within specified timeout: 10000 msec
Caused by: org.apache.sshd.common.SshException: [ssh-connection]: Failed to get operation result within specified timeout: 10000 msec

Below is the configuration used.

<sftp:config name="SFTP_Config" doc:name="SFTP Config" doc:id="34cf9b32-d3de-4171-b6e9-36dc0b25e7c0" >
<sftp:connection host="${host}" username="${user}" identityFile="${app.home}/${file-ppk}" passphrase="${pwd}" port="${port}" workingDir="${root-folder}" preferredAuthenticationMethods="#[['PUBLIC_KEY']]">
</sftp:connection>
</sftp:config>

CAUSE

This is due to the limitation with the Apache mina library which doesn't work with the .ppk file format. Our connector documentation also mentions that ssh-keygen’s OpenSSH PKI format is not accepted.
https://docs.mulesoft.com/sftp-connector/latest/sftp-documentation#config_connection

An identity file location for a PKI private key.
ssh-keygen’s OpenSSH PKI format is not accepted. You can use argument "-m PEM".

SOLUTION

Convert the .ppk file to .pem using the below steps and use the .pem file to work with the SFTP connector 2.0.0 version and above.
1. open puttygen
2. Load ->.ppk file
3. conversions -> Export OpenSSH Key -> save the file to .pem
Download PuTTYgen:
If you don't have PuTTYgen installed, you can download it as part of the PuTTY suite from the official website: PuTTY Download Page
https://www.putty.org/

Open PuTTYgen:

Run PuTTYgen.
Click on the "Load" button.
Load the .ppk Private Key:

In the file dialog, select the option to display files with all extensions.
Locate and select your .ppk private key file.
Click "Open."
Convert and Save as PEM:

Once the .ppk file is loaded, click on the "Conversions" menu.
Choose "Export OpenSSH Key."
Save the file with a .pem extension.

 
Numéro d’article de la base de connaissances

001117275

 
Chargement
Salesforce Help | Article