I’m getting error when try to connect a SFTP.
connect->getConnection: Handshake failed: no matching key exchange algorithm
The server work with key exchange. To solve this problema at sftp client I have configured ssh_config with:
KexAlgorithms +diffie-hellman-group1-sha1
Ciphers +aes128-cbc
How can I do this at n8n SFTP node?
n8n version: 0.194.0
Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker install.
The node doesn’t currently offer any configuration options beyond the ones listed on the credentials screen I am afraid. However, the library used by this node would be this one which appears to support these configuration settings:
One of the connect options provided by the ssh2 module is algorithm , which is an object that allows you to explicitly set the key exchange, ciphers, hmac and compression algorithms as well as server host key used to establish the initial secure connection.
So, I believe this should technically be possible. I shall convert your question into a feature request allowing you and other users to vote on having this implemented in the future.
Thank you @jesse.souza. Just for clarification: I wasn’t suggesting you do that yourself (though I am sure a PR adding such a feature would be very welcome), just sharing some background around this missing feature.
Hi @jesse.souza I had a similar issue and resolved it by hard-coding the algorithm I needed and rebuilding n8n
// packages/nodes-base/nodes/Ftp/Ftp.node.ts
// appears twice:
...
password: credentials.password as string,
privateKey: credentials.privateKey as string | undefined,
passphrase: credentials.passphrase as string | undefined,
algorithms: {
kex: ["diffie-hellman-group1-sha1"],
cipher: ["aes128-cbc"]
}
@MutedJam IMHO I think SFTP is a common entry-point for a lot of first time n8n users. This connection error is frustrating and I can imagine many users give up on n8n quickly.
My client is in healthcare and they were given an SFTP endpoint by a big-name service. OSX and FileZilla etc supported the key exchange out of the box but n8n did not.
As for a PR, I am no ssh expert and unsure as to how this should be done?
Hey @Jon , it’s a server provided to us by a sales rep team. I did some googling and after running some commands this is the info I got:
Syncplify.me Server! v5.1.24.564 SSH-2/SFTP Service Ready
SSH-2.0-Syncplify_Me_Server
SFTP protocol version 3
no matching key exchange method found. Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1,diffie-hellman-group14-sha1
Just tried it, I get “ERROR: read ECONNRESET”. Which I think is the same issue as if I ssh through terminal on my local machine I get the “no matching key exchange method found.” message.
I think I spotted the support ticket from you as well on this one, While hardcoding seems like the quick win it isn’t the best approach so we will need to think of the best way around that. Maybe by presenting a default list that follows current best practices then allowing them to be changed if needed which will potentially help with compliance as well.
Give me a few days and I will see what I can come up with.
I was going to create a Github issue for this, then found this thread. This has been a thorn on our side as well. I’m just replying to be notified of the changes and hopefully give you one more reason to work on this
I faced the same problem today too. Will hard-code and re-build to work around, but I don’t see why there can’t be a drop down field on the credentials page to select the appropriate kex/cipher algo
This is one of those issues that is on my personal todo list, I have been thinking about just using a text field for now to get this one done quickly. At the moment though this is in our backlog of tasks to complete but I am planning on pulling it out during one of our bug bashing sessions.
Why not add some extra options to the SSH node so one can pass extra parameters like:
“-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null”
We have this issue when automating hosts that continually change identity but not their account passwords