Azure / Azure/azure-cli-extensions
"The public key is of type ssh-rsa, not a certificate."
- Dominant language
- Python
- Stars
- 454
- Forks
- 1.7k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 64
Description
### Extension name (the extension in question)
`az ssh`
### Description of issue (in as much detail as possible)
When I attempt to `az ssh vm -g $A_RG -n $A_SERVER`, I get,
```
» az ssh vm -g [snip RG name] -n [snip VM name]
[snip email]@[snip IP]: Permission denied (publickey).
```
**We do not think this is a true positive authentication error:**
* I've double checked that I am logged into the correct tenant (which is evident by the fact that `az ssh vm` attempted an SSH at all: it was able to look up the IP, and this particular VM is uniquely named among all VMs in all tenants I have access to)
* I've double-checked that I have the appropriate role assignment on the VM. Specifically, I have the role "Virtual Machine Administrator Login" assigned to me.
* I've successfully SSH'd into this VM in that past, and to my knowledge, my access has not changed. (And indeed, my check above confirms that.)
`/var/log/auth.log` on the server, when I attempt a log in, says,
```
Oct 26 21:40:04 [snip]-server aad_certhandler[12861]: Version: 1.0.015950001; user: [snip, my email]
Oct 26 21:40:04 [snip]-server aad_certhandler[12861]: The public key is of type ssh-rsa, not a certificate.
```
If I replace `aad_certhandler` with a small wrapper that simply logs calls, it indeed appears to be true that the only thing it gets invoked appears to be a 3072-bit `ssh-rsa` pubkey. I presume this is the key that `az ssh vm` autogenerates.
Normally, and when I have a co-worker attempt a log in, it appears to get invoked with an SSH certificate, and sometimes, a pubkey. I presume it is the invocation with an SSH cert that leads, eventually, to a successful login.
It is not clear to us why, when I run `az ssh vm`, it does not seem to lead to a certificate being sent.
Additionally, if I run `az ssh config`, & then `ssh -F ` I do get,
```
debug1: Will attempt key: /var/folders/gk/[snip]/T/aadsshcertdotd07nv/id_rsa.pub-aadcert.pub RSA-CERT SHA256:[a hash?] explicit
```
However, I also get,
```
debug1: Offering public key: /var/folders/gk/[snip]/T/aadsshcertdotd07nv/id_rsa.pub-aadcert.pub RSA-CERT SHA256:[a hash?] explicit
debug1: send_pubkey_test: no mutual signature algorithm
```
And that Seems Bad.
But it is not clear how there would not be a mutual signature algorithm for me, but there would be for my co-worker? (I've not yet had him replicate this trial; when I do, I'll adjust this to note the difference in our logs.)
I've also temporarily `mv ~/.ssh/config ~/.ssh/config.out-of-the-way`, to ensure that there isn't some cross-talk. My assumption is that my personal config is not used, as `az` will pass `-F` to `ssh` when it `exec`s it. Moving my config aside had no effect.
(We also have an internal support ticket with Azure to this effect.)
Contributor guide
Assessment
This issue has not been assessed yet.