Bug 3147

Summary: Confusing error message when the public key is missing.
Product: Portable OpenSSH Reporter: Jesper Wallin <jesper>
Component: sshAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED FIXED    
Severity: trivial CC: djm, jjelen
Priority: P5    
Version: -current   
Hardware: All   
OS: OpenBSD   
Bug Depends on:    
Bug Blocks: 3117    
Attachments:
Description Flags
ssh -vvv ifconfig.se none

Description Jesper Wallin 2020-04-09 19:50:31 AEST
I just upgraded my machine to the latest -current as of today. When trying to login to a remote machine using ssh(1), I got the following error because my id_rsa.pub is missing:

> load pubkey "/home/jesper/.ssh/id_rsa": invalid format

The error is very confusing and as I see it, it seems like ssh(1) tries to load my private key and use it as a public key? Or it tries to load the public key *for* my id_rsa, and fails because it does not exist, but then the error should tell me the key/file does not exist rather than invalid format?

Adding the id_rsa.pub again will make the error go away though.
Comment 1 Jakub Jelen 2020-04-09 20:32:35 AEST
Is that really a key you are using for that connection? In what format is it? traditional-PEM/PKCS8 PEM/openssh? Sharing a debug logs would be helpful.
Comment 2 Jesper Wallin 2020-04-09 21:13:01 AEST
Created attachment 3374 [details]
ssh -vvv ifconfig.se
Comment 3 Jesper Wallin 2020-04-09 21:14:53 AEST
(In reply to Jakub Jelen from comment #1)
> Is that really a key you are using for that connection? In what
> format is it? traditional-PEM/PKCS8 PEM/openssh? Sharing a debug
> logs would be helpful.

I've attached the debug output and it's the only key on my system, which works btw, despite the error. It looks like:

-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-128-CBC,48C1EB3613223186C9C28CE40777D53C

[removed]
-----END RSA PRIVATE KEY-----
Comment 4 Damien Miller 2020-05-08 13:45:24 AEST
This should be fixed by commit 2b13d3934d580370 that will be in the openssh-8.3 release
Comment 5 Damien Miller 2021-03-04 09:52:19 AEDT
close bugs that were resolved in OpenSSH 8.5 release cycle