-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Description
The documentation for the --key
option has the following:
For SSH, if not specified, curl tries the following candidates in order:
~/.ssh/id_rsa
,~/.ssh/id_dsa
,./id_rsa
,./id_dsa
.
Now that libssh2 supports newer key types, and especially now that the key types above (RSA and DSA) are deprecated by default in OpenSSH, I think it would be nice to expand the list above to the default key locations for the newer key types supported by libssh2.
Something that may warrant discussion is the backwards-compatibility aspect. Should we prepend the new key types to the list, because we should prefer newer/stronger algorithms? That could be a breaking change when the user already has a file with the new key type, but the remote host doesn't have it in their authorized_keys
. Or should we append them, flipping the compromise? If libssh2 supports this, we could read and try all keys (which is also what the OpenSSH client does) instead of just the first readable file as a prerequisite to changing this list.
I did this
$ ssh-keygen -t ed25519
$ ssh-copy-id user@host
$ curl sftp://user@host/
I expected the following
Should use the ed25519 key file from the default location.
curl/libcurl version
curl 7.82.0 (x86_64-pc-linux-gnu) libcurl/7.82.0 OpenSSL/1.1.1m zlib/1.2.11 brotli/1.0.9 zstd/1.5.2 libidn2/2.3.2 libpsl/0.21.1 (+libidn2/2.3.0) libssh2/1.10.0 nghttp2/1.47.0
Release-Date: 2022-03-05
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets zstd
operating system
Linux t580.thecybershadow.net 5.16.11-arch1-1 #1 SMP PREEMPT Thu, 24 Feb 2022 02:18:20 +0000 x86_64 GNU/Linux