Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SFTP Source Connector: Missing identity file #215

Open
geofflhenderson opened this issue Aug 30, 2024 · 0 comments
Open

SFTP Source Connector: Missing identity file #215

geofflhenderson opened this issue Aug 30, 2024 · 0 comments

Comments

@geofflhenderson
Copy link

Hi @jcustenborder,

I hope I am posting this in the correct place. I am using the following SFTP Source connector class: com.github.jcustenborder.kafka.connect.spooldir.SftpCsvSourceConnector

The connector is configured as follows (only the sftp setting, I omitted the rest):

{
"name": "CCS_DataCDR-Source-Sftp",
"config": {
"connector.class": "com.github.jcustenborder.kafka.connect.spooldir.SftpCsvSourceConnector",
"tasks.max": "1",
"sftp.host": "mysftphost",
"sftp.port": 30022,
"sftp.username": "myuser",
"sftp.identity": "/home/myuser/.ssh/myprivatekeyfile",
}
}

The public key that matches /home/myuser/.ssh/myprivatekeyfile is in the authorized_keys file on my SFTP server.

I can successfully SFTP from my VM (Redhat) as follows, without being prompted for a password:

sftp -P 30022 -i /home/myuser/.ssh/myprivatekeyfile myuser@mysftphost

However, when trying from the connector (running on the same Redhat VM) I observe the following logs in /var/log/kafka/connect-distributed.log:

org.apache.kafka.connect.errors.ConnectException: Can not get connection to SFTP:
at com.github.jcustenborder.kafka.connect.spooldir.SftpConnection.init(SftpConnection.java:146)
at com.github.jcustenborder.kafka.connect.spooldir.SftpConnection.(SftpConnection.java:75)
at com.github.jcustenborder.kafka.connect.spooldir.SftpCsvSourceConnectorConfig.getSftpConnection(SftpCsvSourceConnectorConfig.java:180)
at com.github.jcustenborder.kafka.connect.spooldir.SftpCsvSourceTask.fileActions(SftpCsvSourceTask.java:43)
at com.github.jcustenborder.kafka.connect.spooldir.AbstractSourceTask.checkDirectory(AbstractSourceTask.java:95)
at com.github.jcustenborder.kafka.connect.spooldir.AbstractSourceTask.start(AbstractSourceTask.java:127)
at com.github.jcustenborder.kafka.connect.spooldir.SpoolDirSourceTask.start(SpoolDirSourceTask.java:45)
at com.github.jcustenborder.kafka.connect.spooldir.SpoolDirCsvSourceTask.start(SpoolDirCsvSourceTask.java:127)
at com.github.jcustenborder.kafka.connect.spooldir.SftpCsvSourceTask.start(SftpCsvSourceTask.java:29)
at org.apache.kafka.connect.runtime.WorkerSourceTask.execute(WorkerSourceTask.java:219)
at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:185)
at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:235)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)
Caused by: com.jcraft.jsch.JSchException: Auth fail
at com.jcraft.jsch.Session.connect(Session.java:519)
at com.jcraft.jsch.Session.connect(Session.java:183)
at com.github.jcustenborder.kafka.connect.spooldir.SftpConnection.init(SftpConnection.java:140)
... 16 more

Any idea what the issue may be ?

The kafka-connect process is running as user cp-kafka-connect group confluent. I made sure the .ssh directory with my private key is owned by the same user/group with 700 permissions, and the private key also has the same ownership with 600 permissions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant