Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading Key Invalid Format #25

Open
Brandin opened this issue Jun 13, 2022 · 7 comments
Open

Loading Key Invalid Format #25

Brandin opened this issue Jun 13, 2022 · 7 comments

Comments

@Brandin
Copy link

Brandin commented Jun 13, 2022

Hi guys,

Doing something slightly unconventional - running this on Windows. I already resolved one issue (subprocess.run needs shell=True added or it fails to load files. However, now I'm having issues with key format. I've uploaded my private key and the file name as described, but unfortunately I'm getting this error:

DEBUG:root:Running ssh-add
Error loading key "(stdin)": invalid format
WARNING:root:Could not add key to the SSH agent

It appears it fails somewhere in the subprocess.run for SSH add, maybe the input? I'm not sure the best thing to look for to debug this problem. Any thoughts or direction would be appreciated!

Thanks,
Brandin.

@joaojacome
Copy link
Owner

maybe it could be related to the linebreak characters?

@Brandin
Copy link
Author

Brandin commented Jun 21, 2022

maybe it could be related to the linebreak characters?

I'm thinking it could be an issue with the API and the data being returned to the CLI. I've reached out to Bitwarden and will report back with my findings. Right now I'm getting a 404 for the attachment, so I think what was being retrieved was old data despite the vault saying its up to date.

@Brandin
Copy link
Author

Brandin commented Jun 25, 2022

I was able to resolve the issue with the CLI. Albeit, I didn't change anything in my configuration, so I don't really know what was causing the CLI to return an empty folder.

Despite - importing the key to PuTTY and then exporting it on OpenSSH format resolved the invalid format issue I was getting earlier. (Ref: https://serverfault.com/questions/1004774/load-key-privkey-ppk-invalid-format)

Now, I'm facing ssh-agent asking for the passphrase since ssh-askpass is not for Windows. I've been looking into solutions for this and came up empty handed so far. If I find a solution, I'll be sure to share it, and any thoughts on this is appreciated. Most of the solutions I've found are referencing PowerShell fixes (example: https://stackoverflow.com/questions/10960269/git-ssh-askpass-on-windows)

@joaojacome
Copy link
Owner

@Brandin I've seen the empty folder happening when the local vault is not synced. Maybe it's the same reason it happened to you.

@modem7
Copy link
Contributor

modem7 commented Dec 14, 2022

@Brandin - Try generating an SSH key using the below script:

https://github.com/modem7/public_scripts/blob/master/Batch%20+%20Powershell/ed25519gen.bat

I've not had any problems with keys generated in this method (except for WinSCP which doesn't like anything not PuTTY based).

Make sure ssh-keygen is installed. I've installed OpenSSH via Powershell, unsure if that'll help any.

@joaojacome
Copy link
Owner

@Brandin there was a fix for windows encoding merged in June, please check if it works for you.

fee2a97

@Brandin
Copy link
Author

Brandin commented Aug 18, 2023

Thanks for the update on this ticket.
I did attempt this again today. No errors related to encoding/etc due to the merge, but ssh-askpass seems to still not work on Windows so I am getting prompted for passphrase still. Debug confirms it is declared. I'll try working with this again soon, but unfortunately still empty handed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants