I don't think so; I think that "signer" is part of signing the challenge as part of the authentication process. But I'm not too sure.
Going back to basics
A simple ssh
key based authentication goes something like...
- Client looks at public key
- Sends key to server (kinda; detail not important)
- Server says "Hey, I like the look of this. It matches what's in the authorized_keys file. Prove you've got the private key"
- Complicated math happens
- Server says "OK, you're good".
The "complicated math" is where signing happens; the client signs a message using the private key, and the server validates it using the public key.
Now one of things hidden, here, is that you don't actually need the pub
file to do this. The private key contains a copy of it! We can see this with ssh-keygen -y
. For example:
$ ssh-keygen -y -f id_rsa
Enter passphrase:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDScBL2j0mwz7swpHBLzE4HjaJ6OpC96sg50aB1LRPbfdojKjiyuc9fC8VSCCCAHdovFihheLsbPyWKGq/tMM4e8JXp0YD2AG63k8FZ98WjAgC5g6UAK+MitmtRxCyjF52JoLioM1R9iACN+8guV0oZ9sSD7DNW2UTZrlgDavrM0QZ17tWu3QEz6U+l1bQwdisZxNpomED5quYI6pZypAdzBKi8HJw7BJDtmoEirPZzTP+T1Iw6pH/7tMDNQ8atk8OAH2VCAYIurXjxXG8+XNoPaqBtU2dF+8gK4TsLU0gqgYRlnE0UIu0aXQb+YSWNV5Xk7oo86F5cMF0WCGCGJ0l9
$ cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDScBL2j0mwz7swpHBLzE4HjaJ6OpC96sg50aB1LRPbfdojKjiyuc9fC8VSCCCAHdovFihheLsbPyWKGq/tMM4e8JXp0YD2AG63k8FZ98WjAgC5g6UAK+MitmtRxCyjF52JoLioM1R9iACN+8guV0oZ9sSD7DNW2UTZrlgDavrM0QZ17tWu3QEz6U+l1bQwdisZxNpomED5quYI6pZypAdzBKi8HJw7BJDtmoEirPZzTP+T1Iw6pH/7tMDNQ8atk8OAH2VCAYIurXjxXG8+XNoPaqBtU2dF+8gK4TsLU0gqgYRlnE0UIu0aXQb+YSWNV5Xk7oo86F5cMF0WCGCGJ0l9 sweh@test1.spuddy.org
You can see the key is the same, just missing the comment at the end.
So why, if the public key is in the private key file do we need a .pub
file? Well, if you looked carefully I needed to enter the passphrase to unlock the encrypted private key file. By having a separate public key file it means we can send the public key to the server and then only need to unlock the one(s) being used to authenticate. This gets important if there's a lot of possible keys (why unlock those that can't be used, anyway?)
So let's unencrypt the private key (to make this easier, going forward) with ssh-keygen -p
and add it to the authorized_keys
file.
Now we can see an example of OpenSSH and the files it opens:
$ strace -ff ssh test1.spuddy.org uname -a 2>&1 | grep ^open.*id_rsa
open("/home/sweh/.ssh/id_rsa", O_RDONLY) = 4
open("/home/sweh/.ssh/id_rsa", O_RDONLY) = 4
open("/home/sweh/.ssh/id_rsa", O_RDONLY) = 4
open("/home/sweh/.ssh/id_rsa.pub", O_RDONLY) = 4
open("/home/sweh/.ssh/id_rsa-cert", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/sweh/.ssh/id_rsa-cert.pub", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/home/sweh/.ssh/id_rsa", O_RDONLY) = 4
$
Let's create a simple rclone
test config:
[sftptest]
type = sftp
host = test1.spuddy.org
user = sweh
key_file = /home/sweh/.ssh/id_rsa
use_insecure_cipher = false
And what do we see with this one?
$ strace -ff rclone lsd sftptest: 2>&1 | grep id_rsa
[pid 4957] openat(AT_FDCWD, "/home/sweh/.ssh/id_rsa", O_RDONLY|O_CLOEXEC) = 8
$
It's not opening the pub
file at all, so it must be extracting the public key from the private key.
However, with a signed certificate the public key file is different. It contains the original information plus a tonne of extra data. This isn't in the private key file.
So what might work (I don't know enough about the GoLang ssh/sftp libraries to be sure this will work) would be to allow the user to optionally specify the public key as well as the private key; if the user specifies the cert signed public key then we might get lucky!