Publii icon indicating copy to clipboard operation
Publii copied to clipboard

[Bug]: SFTP upload using ed25519 key does not work

Open owil opened this issue 2 years ago • 2 comments

Operating system

Linux Mint 20.3

Publii version

0.40.2

Post editor

No response

Bug description

Target server runs on Ubuntu 22.04.1

Ubuntu 22.04 doesn't accept ssh-rsa key files by default (https://askubuntu.com/questions/1409105/ubuntu-22-04-ssh-the-rsa-key-isnt-working-since-upgrading-from-20-04) Publii 0.40.2 doesn't recognize ed25519 key files

Cannot upload to server using ssh-rsa key Cannot upload to server using ed25519 key

Would like to have ed25519 key recognized by Publii's SFTP uploader

Steps to reproduce

Server Type - SFTP (with key) Port - a nonstandard port (works with Filezilla, Putty) Server - server's ipv4 address Username - ubuntu Authentication method - key file Private key - ed25519 private key file using .ppk file extension (works with Filezilla, Putty) Passphrase - none Remote path - a folder inside ubuntu's home directory created and owned by ubuntu (works when uploading using Filezilla)

-> Test Connection "Error! Application was able to connect with your server but was unable to store files. Please check file permissions on your server." -> Ok

-> Prepare to upload -> Sync your website "An error occurred while connecting to the server. Please check your server settings or try again." -> Ok -> Cancel

Relevant log output

deployment-errors.log

/opt/Publii/resources/app.asar/node_modules/ssh2-sftp-client/src/utils.js:55
  let newError = new Error(msg);
                 ^

Error: end: No SFTP connection available
    at fmtError (/opt/Publii/resources/app.asar/node_modules/ssh2-sftp-client/src/utils.js:55:18)
    at haveConnection (/opt/Publii/resources/app.asar/node_modules/ssh2-sftp-client/src/utils.js:319:20)
    at /opt/Publii/resources/app.asar/node_modules/ssh2-sftp-client/src/index.js:1221:11
    at new Promise (<anonymous>)
    at SftpClient.end (/opt/Publii/resources/app.asar/node_modules/ssh2-sftp-client/src/index.js:1212:12)
    at /opt/Publii/resources/app.asar/back-end/modules/deploy/sftp.js:93:29 {
  code: 'ERR_NOT_CONNECTED',
  custom: true
}

deployment-process.log

[Mon, 29 Aug 2022 18:33:03 GMT] ERR (1): Error: connect: Cannot parse privateKey: Unsupported key format

owil avatar Aug 29 '22 18:08 owil

Hi,

I will try to upgrade the used SFTP library in the next Publii release - maybe it will help, but I cannot find obvious information that such key format is supported.

dziudek avatar Sep 02 '22 16:09 dziudek

I updated Publii to 0.40.3 and the same issue is present, so it looks like ed25519 is not a supported key format for the used SFTP library. Thanks for looking into it.

owil avatar Sep 15 '22 20:09 owil

Hi @owil ,

Publii v.0.41 is released and it contains newest version of ssh2 library - maybe it will help with your issue :)

dziudek avatar Nov 01 '22 11:11 dziudek

Hello @dziudek ,

I have updated to Publii v.0.41.1, and the same issue is present. I hope there is someone else with Ubuntu 22.04.1 who uses the ed25519 key to log in, and who might be willing to try replicating the issue.

Looking on my Ubuntu server's /var/log/auth.log file, I wasn't able to see the ssh2 go through for my attempts to upload with Publii. I can see the entry for my Putty session, which uses the same port, username, and key file.

Thank you for following up with me.

owil avatar Nov 16 '22 01:11 owil

Nowhere can I find information about what type of key is supported for an sftp connection

evgenykushnarenko avatar Dec 07 '22 12:12 evgenykushnarenko