I am using this library for connecting to SFTP server with PEM, PPK files with private key authentication. When using some PPK files, the library started to throw following fs error:
AssertionError [ERR_ASSERTION]: config.privateKey does not exist at given fs path
at new AssertionError (internal/assert/assertion_error.js:467:5)
at NodeSSH.connect (/var/task/node_modules/node-ssh/lib/cjs/index.js:147:31)
}
Cause
As per documentation, I got to know that the library accepts the primary key as a file path or raw content. I am passing the row content so this error shouldn't come at all. After quick google search and looking into the validation/assertion code, I found following issue (check the code)
The code check if config has privateKey.
If it exists then it checks whether it includes BEGIN + KEY OR PuTTY-User-Key-File-2 . If none of them exists in the content then it assumes that provided string is a file path and try to read the file using fs and it eventually throws above mentioned error.
I checked PPK files that I am using and it has PuTTY-User-Key-File-3. This implies that it is new version of PuTTY.
Are there any plans to add support of PuTTY 3 or are there any workarounds for this issue? I am directly getting the content of file from S3 so it won't be possible to copy the content of the private file into local system and then passing the path to library.
Hey Team, thanks for the great library 🎉 .
Context
I am using this library for connecting to SFTP server with PEM, PPK files with private key authentication. When using some PPK files, the library started to throw following
fs
error:Cause
As per documentation, I got to know that the library accepts the primary key as a file path or raw content. I am passing the row content so this error shouldn't come at all. After quick google search and looking into the validation/assertion code, I found following issue (check the code)
privateKey
.BEGIN
+KEY
ORPuTTY-User-Key-File-2
. If none of them exists in the content then it assumes that provided string is a file path and try to read the file usingfs
and it eventually throws above mentioned error.I checked PPK files that I am using and it has
PuTTY-User-Key-File-3
. This implies that it is new version of PuTTY.Are there any plans to add support of PuTTY 3 or are there any workarounds for this issue? I am directly getting the content of file from S3 so it won't be possible to copy the content of the private file into local system and then passing the path to library.