Search code examples
mulemule4cloudhubmule-connector

CloudHub worker trying to connect to SFTP site which allows whitelisted IPs only


I have a Mule 4 application [App1] created on CloudHub. I tried to deploy the application's jar file onto CloudHub. This application has a Static IP [eg. 100.101.102.103] assigned to it in Runtime Manager. This IP address is whitelisted by customer to allow communication with their SFTP sites and APIs. My Mule application has APIs and some SFTP flows. When I try to deploy my mule application [App1], the deployment fails with below error:

Connectivity test failed for config 'SFTP_Config'. Application deployment will continue. Error was: Could not establish SFTP connection with host: 'sftp.hostname' at port: '22' - Error during login to '[email protected]'.

The SFTP Config is:

    <sftp:config name="SFTP_Config" doc:name="SFTP Config" doc:id="5d626288-5181-41d5-807d-2786ea4292d8" >
    <sftp:connection host="${sftp.host}" port="${sftp.port}" username="${secure::sftp.username}" password="${secure::sftp.password}" connectionTimeoutUnit="MINUTES" connectionTimeout="2" responseTimeoutUnit="MINUTES" responseTimeout="2" workingDir="${sftp.peoplePosition.directory}">
        <reconnection failsDeployment="false" >
            <reconnect frequency="${sftp.retryInterval}" count="${sftp.retryAttempts}" />
        </reconnection>
    </sftp:connection>
</sftp:config>

I also tried using failsDeployment="false" in the SFTP configuration as recommended in this KB article but it didn't work either.

The log shows:

[2023-02-16 05:59:00.754] ERROR   
org.mule.extension.sftp.internal.connection.SftpConnectionProvider 
[qtp1351434790-36]: Auth fail
com.jcraft.jsch.JSchException: Auth fail

[2023-02-16 05:59:00.824] WARN 
org.mule.runtime.core.internal.connection.
PoolingConnectionManagementStrategy 
[qtp1351434790-36]: Failed to create a connection while 
applying the pool initialization policy.
org.mule.runtime.api.connection.ConnectionException: 
Could not establish SFTP connection with host: 'sftphost' at port: '22' 
- Error during login to sftpuser@sftphost
at 
 org.mule.runtime.core.internal.connection.ErrorTypeHandler
ConnectionProviderWrapper.lambda$connect$0(ErrorTypeHandler
ConnectionProviderWrapper.java:70)
at java.util.Optional.map(Optional.java:215)

I have verified the SFTP credentials, they are working fine with Winscp.

Is there any way a CloudHub worker can complete the deployment successfully or validate the SFTP configuration using Static IP instead of it's own IP address?


Solution

  • After adding following to Runtime properties of the application, the application was getting deployed successfully:

    doTestConnectivity=False