Ssh-rsa deprecated

Hi!

Now that ssh-rsa is not part of OpenSSH 8.8 and officially deprecated, I can't connect to an instance of rclone serve sftp:

$ rclone serve sftp b2:xyz --user xyz --pass xyz --addr 127.0.0.1:2020
$ sftp -P 2020 xyz@127.0.0.1
Unable to negotiate with 127.0.0.1 port 2020: no matching host key type found. Their offer: ssh-rsa

Yes, I can put this into my $HOME/.ssh/config and it works:

Host 127.0.0.1
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa

But that's not a solution, it's just a workaround.

Will rclone support a stronger algorithm? Or does it already and I am just blind? If so, how to set it up?

Thanks!

I believe that's because of the go ssh package doesn't support I'd imagine:

There are numerous issues as it would have to be fixed upstream if i'm not mistaken:

I think you should be able to use an ECDSA key - what keys do you have in ssh keyring? ssh-add -L | awk '{print $1}' will tell you the types.

I think this is the Go upstream issue

I've just added a ECDSA key, but it's not helping:

$ ssh-add -L | awk '{print $1}'
ssh-rsa
ecdsa-sha2-nistp256
$ rclone serve sftp b2:xyz --user user --pass xyz --addr 127.0.0.1:2020
<5>NOTICE: Loaded 0 authorized keys from "/home/user/.ssh/authorized_keys"
<5>NOTICE: SFTP server listening on 127.0.0.1:2020
<3>ERROR : serve sftp 127.0.0.1:38384->127.0.0.1:2020: SSH login failed: ssh: no common algorithm for host key; client offered: [rsa-sha2-512-cert-v01@openssh.com rsa-sha2-256-cert-v01@openssh.com rsa-sha2-512 rsa-sha2-256 ssh-ed25519-cert-v01@openssh.com ecdsa-sha2-nistp256-cert-v01@openssh.com ecdsa-sha2-nistp384-cert-v01@openssh.com ecdsa-sha2-nistp521-cert-v01@openssh.com sk-ssh-ed25519-cert-v01@openssh.com sk-ecdsa-sha2-nistp256-cert-v01@openssh.com ssh-ed25519 ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 sk-ssh-ed25519@openssh.com sk-ecdsa-sha2-nistp256@openssh.com], server offered: [ssh-rsa]

Do you think I am doing something wrong?

Is the public part of that key in /home/user/.ssh/authorized_keys? Looking at the debug I'd say only the ssh-rsa key is in there, but I could be wrong!

Sorry, I looked and realized that authorized_keys didn't exist at all! Nonetheless, I copied the id_rsa.pub and id_ecdsa.pub inside it, but it didn't help.

$ rclone serve sftp b2: --user user --pass test --addr 127.0.0.1:2020
<5>NOTICE: Loaded 2 authorized keys from "/home/user/.ssh/authorized_keys"
<5>NOTICE: SFTP server listening on 127.0.0.1:2020
<3>ERROR : serve sftp 127.0.0.1:32920->127.0.0.1:2020: SSH login failed: ssh: no common algorithm for host key; client offered: [rsa-sha2-512-cert-v01@openssh.com rsa-sha2-256-cert-v01@openssh.com rsa-sha2-512 rsa-sha2-256 ssh-ed25519-cert-v01@openssh.com ecdsa-sha2-nistp256-cert-v01@openssh.com ecdsa-sha2-nistp384-cert-v01@openssh.com ecdsa-sha2-nistp521-cert-v01@openssh.com sk-ssh-ed25519-cert-v01@openssh.com sk-ecdsa-sha2-nistp256-cert-v01@openssh.com ssh-ed25519 ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 sk-ssh-ed25519@openssh.com sk-ecdsa-sha2-nistp256@openssh.com], server offered: [ssh-rsa]

Unless you have a different idea, I probably have to wait for a solution upstream.

Thinking a bit more about this, I think that's the wrong key, we need to change the private key of the server. Rclone normally generates an RSA key (cached here ~/.cache/rclone/serve-sftp/id_rsa) however you can set this with

  --key stringArray                        SSH private host key file (Can be multi-valued, leave blank to auto generate)

So you could try creating a ecdsa key pair for the server

ssh-keygen -t ECDSA -f id_ecdsa
rclone serve -vv sftp --key id_ecdsa .

This seemed to work in my tests provoking an ECDSA key exchange.

Probably what rclone should do is generate an ECDSA key as well as an rsa key and load them both.

I'm not sure I fully understand the problem

You are a genius, this worked! Pointing to the right ECDSA key with --key $HOME/.ssh/id_ecdsa does the trick beautifully. Much appreciated!

Excellent!

Would you mind opening a new issue on Github with a link to this thread in - I think we should probably fix this properly in rclone - thank you!

Here you go. Thanks again!

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.