SteveS
SteveS

Reputation: 1030

How do I stop the Mule SFTP Connector from prompting for Kerberos Username?

I am attempting to upload a file using SFTP. I have an identity file set up and referenced correctly. When my flow gets to the SFTP it pauses execution and prompts for Kerberos username and Kerberos password. I do not need to enter anything for these and just pressing enter will allow execution to continue and will correctly upload my file. Doing research on this, it appears to be a Java1.7 bug and is referenced here: https://www.mulesoft.org/jira/browse/MULE-6864. In that Jira task they mention "Setting "PreferredAuthentications" property to "publickey,password,keyboard-interactive" in the SftpClient solves the problem." So where do I set this property? It isn't part of the connector. I tried adding it as an attribute directly in the XML but that didn't work either.

I am developing in Anypoint Studio July 2014, deploying to Mule 3.5.0EE.

Upvotes: 1

Views: 2563

Answers (2)

dlb
dlb

Reputation: 357

The preferred authorization method can be added to a connector, but not the endpoint, such as:

<sftp:connector name="sftpConnector" validateConnections="true"
                doc:name="mySftp" keepFileOnError="true" 
                preferredAuthenticationMethods="publickey,password,keyboard-interactive">
</sftp:connector>

Then reference the connector in your SFTP endpoint.

This however is not an available option in the connector until Mule 3.5, so a solution such as Steve's must be used if an earlier version is in use. It is not set via the GUI, rather should be put directly into the XML.

Upvotes: 3

SteveS
SteveS

Reputation: 1030

The answer was in the same Jira entry listed above. I needed to create a java class to do the configuration. Just add the following class to your project:

package com.mycompany.utils;

import org.apache.log4j.Logger;
import org.mule.api.MuleEventContext;
import org.mule.api.lifecycle.Callable;

import com.jcraft.jsch.JSch;



public class SftpFix implements Callable{
    private static final Logger LOG = Logger.getLogger("com.mycompany");
    static
    { // A bug fix for MULE-6864, where Java 7 causes an issue SSH'ing to a Linux box with Kerberos enabled. 
        LOG.info("Applying patch to JSch for MULE-6864"); 
        JSch.setConfig("PreferredAuthentications", "publickey,password,keyboard-interactive"); 
    } 

    @Override
    public Object onCall(MuleEventContext eventContext){
        return eventContext.getMessage().getPayload();
    }

}

Upvotes: 0

Related Questions