rclone: rclone's sftp not compatible with OpenSSH >=8.8 remote if RSA key pair used
The associated forum post URL from https://forum.rclone.org
None
What is the problem you are having with rclone?
OpenSSH 8.8 dropped the old ssh-rsa in PubkeyAcceptedAlgorithms which means that if one tries to use rclone to connect to sftp or anything that uses ssh as the transport, while using the rsa key pair, it will not work as long as the remote runs modern OpenSSH 8.8 or newer.
The remote end logs the following
Mar 31 15:52:20 [sshd] Connection closed by authenticating user piotr 172.17.17.2 port 60214 [preauth]
Mar 31 15:52:20 [sshd] userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]
Mar 31 15:52:20 [sshd] Connection closed by authenticating user piotr 172.17.17.2 port 60216 [preauth]
Mar 31 15:52:20 [sshd] userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]
Mar 31 15:52:20 [sshd] Connection closed by authenticating user piotr 172.17.17.2 port 60218 [preauth]
Mar 31 15:52:21 [sshd] userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]
Mar 31 15:52:21 [sshd] Connection closed by authenticating user piotr 172.17.17.2 port 60220 [preauth]
Mar 31 15:52:23 [sshd] userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]
Mar 31 15:52:23 [sshd] Connection closed by authenticating user piotr 172.17.17.2 port 60222 [preauth]
Mar 31 15:52:25 [sshd] userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]
Mar 31 15:52:25 [sshd] Connection closed by authenticating user piotr 172.17.17.2 port 60224 [preauth]
Mar 31 15:52:27 [sshd] userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]
Mar 31 15:52:27 [sshd] Connection closed by authenticating user piotr 172.17.17.2 port 60226 [preauth]
Mar 31 15:52:29 [sshd] userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]
Mar 31 15:52:29 [sshd] Connection closed by authenticating user piotr 172.17.17.2 port 60228 [preauth]
As I workaround I can switch keys to ed25519 from rsa, but going forward more and more people wir suffer, would be good to either have rclone default to rsa-sha2-256 for rsa keys and fallback to old ssh-rsa.
What is your rclone version (output from rclone version)
rclone v1.58.0
- os/version: gentoo 2.8 (64 bit)
- os/kernel: 5.17.0 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.17.8
- go/linking: static
- go/tags: none
Which OS you are using and how many bits (e.g. Windows 7, 64 bit)
Linux, Gentoo, ~amd64, 64 bit.
Which cloud storage system are you using? (e.g. Google Drive)
sftp, OpenSSH 8.9
The command you were trying to run (e.g. rclone copy /tmp remote:tmp)
./rclone -vv mount --sftp-host hagane-ethernet :sftp:/ ~/mnt/hagane
A log from the command with the -vv flag (e.g. output from rclone -vv copy /tmp remote:tmp)
% ./rclone -vv mount --sftp-host hagane-ethernet :sftp:/ ~/mnt/hagane
2022/03/31 17:11:33 DEBUG : rclone: Version "v1.58.0" starting with parameters ["./rclone" "-vv" "mount" "--sftp-host" "hagane-ethernet" ":sftp:/" "/home/piotr/mnt/hagane"]
2022/03/31 17:11:33 DEBUG : Creating backend with remote ":sftp:/"
2022/03/31 17:11:33 DEBUG : :sftp: detected overridden config - adding "{OFBPa}" suffix to name
2022/03/31 17:11:33 NOTICE: Config file "/home/piotr/.config/rclone/rclone.conf" not found - using defaults
2022/03/31 17:11:33 DEBUG : pacer: low level retry 1/10 (error couldn't connect SSH: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain)
2022/03/31 17:11:33 DEBUG : pacer: Rate limited, increasing sleep to 200ms
2022/03/31 17:11:33 DEBUG : pacer: low level retry 2/10 (error couldn't connect SSH: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain)
2022/03/31 17:11:33 DEBUG : pacer: Rate limited, increasing sleep to 400ms
2022/03/31 17:11:33 DEBUG : pacer: low level retry 3/10 (error couldn't connect SSH: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain)
2022/03/31 17:11:33 DEBUG : pacer: Rate limited, increasing sleep to 800ms
2022/03/31 17:11:34 DEBUG : pacer: low level retry 4/10 (error couldn't connect SSH: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain)
2022/03/31 17:11:34 DEBUG : pacer: Rate limited, increasing sleep to 1.6s
2022/03/31 17:11:35 DEBUG : pacer: low level retry 5/10 (error couldn't connect SSH: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain)
2022/03/31 17:11:35 DEBUG : pacer: Rate limited, increasing sleep to 2s
2022/03/31 17:11:36 DEBUG : pacer: low level retry 6/10 (error couldn't connect SSH: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain)
2022/03/31 17:11:38 DEBUG : pacer: low level retry 7/10 (error couldn't connect SSH: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain)
2022/03/31 17:11:40 DEBUG : pacer: low level retry 8/10 (error couldn't connect SSH: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain)
2022/03/31 17:11:42 DEBUG : pacer: low level retry 9/10 (error couldn't connect SSH: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain)
2022/03/31 17:11:44 DEBUG : pacer: low level retry 10/10 (error couldn't connect SSH: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain)
2022/03/31 17:11:44 Failed to create file system for ":sftp:/": NewFs: couldn't connect SSH: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
How to use GitHub
- Please use the š reaction to show that you are affected by the same issue.
- Please donāt comment if you have no relevant information to add. Itās just extra noise for everyone subscribed to this issue.
- Subscribe to receive notifications on status change and new comments.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (11 by maintainers)
Commits related to this issue
- sftp: Fix OpenSSH 8.8+ RSA keys incompatibility (#6076) Updates golang.org/x/crypto to v0.0.0-20220331220935-ae2d96664a29. Fixes the issues with connecting to OpenSSH 8.8+ remotes in case the client... — committed to slashbeast/rclone by deleted user 2 years ago
- sftp: Fix OpenSSH 8.8+ RSA keys incompatibility (#6076) Updates golang.org/x/crypto to v0.0.0-20220331220935-ae2d96664a29. Fixes the issues with connecting to OpenSSH 8.8+ remotes in case the client... — committed to rclone/rclone by deleted user 2 years ago
- sftp: Fix OpenSSH 8.8+ RSA keys incompatibility (#6076) Updates golang.org/x/crypto to v0.0.0-20220331220935-ae2d96664a29. Fixes the issues with connecting to OpenSSH 8.8+ remotes in case the client... — committed to rclone/rclone by deleted user 2 years ago
All good. no worries.
The keys remains the same, RSA keys are okay and ot the problem, its just the hash that is send during the āssh handshakeā shall we put it that way needs to be changed. It uses SHA-1 that is no longer supported for security reasons.
The OpenSSH release note explain it good so let me quote it here
What it means for regular Joe is that ssh, sftp and anything that actually uses libssh2 under the hood just work, because it will just use other hashes that are accepted by server, in order for OpenSSH 8.9 for rsa keys it is first rsa-sha2-512 with a fallback to rsa-sha2-256. You can get it out of āssh -vvā output for the server what are the signatures that server will accept
Because thereās no
ssh-rsathere, the rclone will fail to connect.I see rclone uses crypto/ssh and this issue seems like just it https://github.com/golang/go/issues/37278
@slashbeast thank you for the fix.
Iāve merged this to master now which means it will be in the latest beta in 15-30 minutes and released in v1.59 and also in v1.58.1 in a week or two.
Great success
All works
if I might suggest something, unless next release is soon to be released, I really think it would be good to have a minor update to latest stable rclone with this dependency, More and more distributions updates OpenSSH there so I can only expect more and more people hitting this problem